mercurial/help.py
changeset 44306 a0ec05d93c8e
parent 44295 142d2a4cb69a
child 44657 843418dc0b1b
equal deleted inserted replaced
44305:d8d4fa9a7f18 44306:a0ec05d93c8e
   150         )
   150         )
   151     )
   151     )
   152     doc = b''.join(rst)
   152     doc = b''.join(rst)
   153     return doc
   153     return doc
   154 
   154 
       
   155 
   155 def parsedefaultmarker(text):
   156 def parsedefaultmarker(text):
   156     """given a text 'abc (DEFAULT: def.ghi)',
   157     """given a text 'abc (DEFAULT: def.ghi)',
   157     returns (b'abc', (b'def', b'ghi')). Otherwise return None"""
   158     returns (b'abc', (b'def', b'ghi')). Otherwise return None"""
   158     if text[-1:] == b')':
   159     if text[-1:] == b')':
   159         marker = b' (DEFAULT: '
   160         marker = b' (DEFAULT: '
   160         pos = text.find(marker)
   161         pos = text.find(marker)
   161         if pos >= 0:
   162         if pos >= 0:
   162             item = text[pos + len(marker):-1]
   163             item = text[pos + len(marker) : -1]
   163             return text[:pos], item.split(b'.', 2)
   164             return text[:pos], item.split(b'.', 2)
       
   165 
   164 
   166 
   165 def optrst(header, options, verbose, ui):
   167 def optrst(header, options, verbose, ui):
   166     data = []
   168     data = []
   167     multioccur = False
   169     multioccur = False
   168     for option in options:
   170     for option in options:
   732         if not ui.quiet and entry[1]:
   734         if not ui.quiet and entry[1]:
   733             rst.append(optrst(_(b"options"), entry[1], ui.verbose, ui))
   735             rst.append(optrst(_(b"options"), entry[1], ui.verbose, ui))
   734 
   736 
   735         if ui.verbose:
   737         if ui.verbose:
   736             rst.append(
   738             rst.append(
   737                 optrst(_(b"global options"), commands.globalopts, ui.verbose, ui)
   739                 optrst(
       
   740                     _(b"global options"), commands.globalopts, ui.verbose, ui
       
   741                 )
   738             )
   742             )
   739 
   743 
   740         if not ui.verbose:
   744         if not ui.verbose:
   741             if not full:
   745             if not full:
   742                 rst.append(_(b"\n(use 'hg %s -h' to show more help)\n") % name)
   746                 rst.append(_(b"\n(use 'hg %s -h' to show more help)\n") % name)
   872         if ui.quiet:
   876         if ui.quiet:
   873             pass
   877             pass
   874         elif ui.verbose:
   878         elif ui.verbose:
   875             rst.append(
   879             rst.append(
   876                 b'\n%s\n'
   880                 b'\n%s\n'
   877                 % optrst(_(b"global options"), commands.globalopts, ui.verbose, ui)
   881                 % optrst(
       
   882                     _(b"global options"), commands.globalopts, ui.verbose, ui
       
   883                 )
   878             )
   884             )
   879             if name == b'shortlist':
   885             if name == b'shortlist':
   880                 rst.append(
   886                 rst.append(
   881                     _(b"\n(use 'hg help' for the full list of commands)\n")
   887                     _(b"\n(use 'hg help' for the full list of commands)\n")
   882                 )
   888                 )