help: remove redundant 'hg <command>' from command synopses
authorMatt Mackall <mpm@selenic.com>
Wed, 12 Nov 2008 19:11:09 -0600
changeset 7364 ad7f736f3214
parent 7363 9d28ff207030
child 7365 ec3aafa84d44
help: remove redundant 'hg <command>' from command synopses
mercurial/commands.py
--- a/mercurial/commands.py	Wed Nov 12 15:58:46 2008 -0600
+++ b/mercurial/commands.py	Wed Nov 12 19:11:09 2008 -0600
@@ -1310,7 +1310,13 @@
             return
 
         # synopsis
-        ui.write("%s\n" % i[2])
+        if len(i) > 2:
+            if i[2].startswith('hg'):
+                ui.write("%s\n" % i[2])
+            else:
+                ui.write('hg %s %s\n' % (aliases[0], i[2]))
+        else:
+            ui.write('hg %s\n' % aliases[0])
 
         # aliases
         if not ui.quiet and len(aliases) > 1:
@@ -2999,13 +3005,13 @@
 ]
 
 table = {
-    "^add": (add, walkopts + dryrunopts, _('hg add [OPTION]... [FILE]...')),
+    "^add": (add, walkopts + dryrunopts, _('[OPTION]... [FILE]...')),
     "addremove":
         (addremove,
          [('s', 'similarity', '',
            _('guess renamed files by similarity (0<=s<=100)')),
          ] + walkopts + dryrunopts,
-         _('hg addremove [OPTION]... [FILE]...')),
+         _('[OPTION]... [FILE]...')),
     "^annotate|blame":
         (annotate,
          [('r', 'rev', '', _('annotate the specified revision')),
@@ -3018,7 +3024,7 @@
           ('l', 'line-number', None,
            _('show line number at the first appearance'))
          ] + walkopts,
-         _('hg annotate [-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')),
+         _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')),
     "archive":
         (archive,
          [('', 'no-decode', None, _('do not pass files through decoders')),
@@ -3026,7 +3032,7 @@
           ('r', 'rev', '', _('revision to distribute')),
           ('t', 'type', '', _('type of distribution to create')),
          ] + walkopts,
-         _('hg archive [OPTION]... DEST')),
+         _('[OPTION]... DEST')),
     "backout":
         (backout,
          [('', 'merge', None,
@@ -3034,7 +3040,7 @@
           ('', 'parent', '', _('parent to choose when backing out merge')),
           ('r', 'rev', '', _('revision to backout')),
          ] + walkopts + commitopts + commitopts2,
-         _('hg backout [OPTION]... [-r] REV')),
+         _('[OPTION]... [-r] REV')),
     "bisect":
         (bisect,
          [('r', 'reset', False, _('reset bisect state')),
@@ -3043,18 +3049,18 @@
           ('s', 'skip', False, _('skip testing changeset')),
           ('c', 'command', '', _('Use command to check changeset state')),
           ('U', 'noupdate', False, _('do not update to target'))],
-         _("hg bisect [-gbsr] [-c CMD] [REV]")),
+         _("[-gbsr] [-c CMD] [REV]")),
     "branch":
         (branch,
          [('f', 'force', None,
            _('set branch name even if it shadows an existing branch')),
           ('C', 'clean', None, _('reset branch name to parent branch name'))],
-         _('hg branch [-fC] [NAME]')),
+         _('[-fC] [NAME]')),
     "branches":
         (branches,
          [('a', 'active', False,
            _('show only branches that have unmerged heads'))],
-         _('hg branches [-a]')),
+         _('[-a]')),
     "bundle":
         (bundle,
          [('f', 'force', None,
@@ -3066,14 +3072,14 @@
           ('a', 'all', None, _('bundle all changesets in the repository')),
           ('t', 'type', 'bzip2', _('bundle compression type to use')),
          ] + remoteopts,
-         _('hg bundle [-f] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
+         _('[-f] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
     "cat":
         (cat,
          [('o', 'output', '', _('print output to file with formatted name')),
           ('r', 'rev', '', _('print the given revision')),
           ('', 'decode', None, _('apply any matching decode filter')),
          ] + walkopts,
-         _('hg cat [OPTION]... FILE...')),
+         _('[OPTION]... FILE...')),
     "^clone":
         (clone,
          [('U', 'noupdate', None,
@@ -3084,70 +3090,67 @@
           ('', 'uncompressed', None,
            _('use uncompressed transfer (fast over LAN)')),
          ] + remoteopts,
-         _('hg clone [OPTION]... SOURCE [DEST]')),
+         _('[OPTION]... SOURCE [DEST]')),
     "^commit|ci":
         (commit,
          [('A', 'addremove', None,
            _('mark new/missing files as added/removed before committing')),
          ] + walkopts + commitopts + commitopts2,
-         _('hg commit [OPTION]... [FILE]...')),
+         _('[OPTION]... [FILE]...')),
     "copy|cp":
         (copy,
          [('A', 'after', None, _('record a copy that has already occurred')),
           ('f', 'force', None,
            _('forcibly copy over an existing managed file')),
          ] + walkopts + dryrunopts,
-         _('hg copy [OPTION]... [SOURCE]... DEST')),
-    "debugancestor": (debugancestor, [],
-                      _('hg debugancestor [INDEX] REV1 REV2')),
-    "debugcheckstate": (debugcheckstate, [], _('hg debugcheckstate')),
+         _('[OPTION]... [SOURCE]... DEST')),
+    "debugancestor": (debugancestor, [], _('[INDEX] REV1 REV2')),
+    "debugcheckstate": (debugcheckstate, []),
     "debugcomplete":
         (debugcomplete,
          [('o', 'options', None, _('show the command options'))],
-         _('hg debugcomplete [-o] CMD')),
+         _('[-o] CMD')),
     "debugdate":
         (debugdate,
          [('e', 'extended', None, _('try extended date formats'))],
-         _('hg debugdate [-e] DATE [RANGE]')),
-    "debugdata": (debugdata, [], _('hg debugdata FILE REV')),
-    "debugfsinfo": (debugfsinfo, [], _('hg debugfsinfo [PATH]')),
-    "debugindex": (debugindex, [], _('hg debugindex FILE')),
-    "debugindexdot": (debugindexdot, [], _('hg debugindexdot FILE')),
-    "debuginstall": (debuginstall, [], _('hg debuginstall')),
+         _('[-e] DATE [RANGE]')),
+    "debugdata": (debugdata, [], _('FILE REV')),
+    "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
+    "debugindex": (debugindex, [], _('FILE')),
+    "debugindexdot": (debugindexdot, [], _('FILE')),
+    "debuginstall": (debuginstall, []),
     "debugrawcommit|rawcommit":
         (rawcommit,
          [('p', 'parent', [], _('parent')),
           ('F', 'files', '', _('file list'))
           ] + commitopts + commitopts2,
-         _('hg debugrawcommit [OPTION]... [FILE]...')),
+         _('[OPTION]... [FILE]...')),
     "debugrebuildstate":
         (debugrebuildstate,
          [('r', 'rev', '', _('revision to rebuild to'))],
-         _('hg debugrebuildstate [-r REV] [REV]')),
+         _('[-r REV] [REV]')),
     "debugrename":
         (debugrename,
          [('r', 'rev', '', _('revision to debug'))],
-         _('hg debugrename [-r REV] FILE')),
+         _('[-r REV] FILE')),
     "debugsetparents":
-        (debugsetparents,
-         [],
-         _('hg debugsetparents REV1 [REV2]')),
+        (debugsetparents, [], _('REV1 [REV2]')),
     "debugstate":
         (debugstate,
          [('', 'nodates', None, _('do not display the saved mtime'))],
-         _('hg debugstate [OPTION]...')),
-    "debugwalk": (debugwalk, walkopts, _('hg debugwalk [OPTION]... [FILE]...')),
+         _('[OPTION]...')),
+    "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')),
     "^diff":
         (diff,
          [('r', 'rev', [], _('revision'))
          ] + diffopts + diffopts2 + walkopts,
-         _('hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
+         _('[OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
     "^export":
         (export,
          [('o', 'output', '', _('print output to file with formatted name')),
           ('', 'switch-parent', None, _('diff against the second parent'))
           ] + diffopts,
-         _('hg export [OPTION]... [-o OUTFILESPEC] REV...')),
+         _('[OPTION]... [-o OUTFILESPEC] REV...')),
     "grep":
         (grep,
          [('0', 'print0', None, _('end fields with NUL')),
@@ -3162,13 +3165,13 @@
           ('u', 'user', None, _('list the author (long with -v)')),
           ('d', 'date', None, _('list the date (short with -q)')),
          ] + walkopts,
-         _('hg grep [OPTION]... PATTERN [FILE]...')),
+         _('[OPTION]... PATTERN [FILE]...')),
     "heads":
         (heads,
          [('r', 'rev', '', _('show only heads which are descendants of rev')),
          ] + templateopts,
-         _('hg heads [-r REV] [REV]...')),
-    "help": (help_, [], _('hg help [TOPIC]')),
+         _('[-r REV] [REV]...')),
+    "help": (help_, [], _('[TOPIC]')),
     "identify|id":
         (identify,
          [('r', 'rev', '', _('identify the specified rev')),
@@ -3176,7 +3179,7 @@
           ('i', 'id', None, _('show global revision id')),
           ('b', 'branch', None, _('show branch')),
           ('t', 'tags', None, _('show tags'))],
-         _('hg identify [-nibt] [-r REV] [SOURCE]')),
+         _('[-nibt] [-r REV] [SOURCE]')),
     "import|patch":
         (import_,
          [('p', 'strip', 1,
@@ -3191,7 +3194,7 @@
           ('', 'import-branch', None,
            _('Use any branch information in patch (implied by --exact)'))] +
          commitopts + commitopts2,
-         _('hg import [OPTION]... PATCH...')),
+         _('[OPTION]... PATCH...')),
     "incoming|in":
         (incoming,
          [('f', 'force', None,
@@ -3201,12 +3204,12 @@
           ('r', 'rev', [],
            _('a specific revision up to which you would like to pull')),
          ] + logopts + remoteopts,
-         _('hg incoming [-p] [-n] [-M] [-f] [-r REV]...'
+         _('[-p] [-n] [-M] [-f] [-r REV]...'
            ' [--bundle FILENAME] [SOURCE]')),
     "^init":
         (init,
          remoteopts,
-         _('hg init [-e CMD] [--remotecmd CMD] [DEST]')),
+         _('[-e CMD] [--remotecmd CMD] [DEST]')),
     "locate":
         (locate,
          [('r', 'rev', '', _('search the repository as it stood at rev')),
@@ -3215,7 +3218,7 @@
           ('f', 'fullpath', None,
            _('print complete paths from the filesystem root')),
          ] + walkopts,
-         _('hg locate [OPTION]... [PATTERN]...')),
+         _('[OPTION]... [PATTERN]...')),
     "^log|history":
         (log,
          [('f', 'follow', None,
@@ -3233,17 +3236,17 @@
             _('show only changesets within the given named branch')),
           ('P', 'prune', [], _('do not display revision or any of its ancestors')),
          ] + logopts + walkopts,
-         _('hg log [OPTION]... [FILE]')),
+         _('[OPTION]... [FILE]')),
     "manifest":
         (manifest,
          [('r', 'rev', '', _('revision to display'))],
-         _('hg manifest [-r REV]')),
+         _('[-r REV]')),
     "^merge":
         (merge,
          [('f', 'force', None, _('force a merge with outstanding changes')),
           ('r', 'rev', '', _('revision to merge')),
              ],
-         _('hg merge [-f] [[-r] REV]')),
+         _('[-f] [[-r] REV]')),
     "outgoing|out":
         (outgoing,
          [('f', 'force', None,
@@ -3252,13 +3255,13 @@
            _('a specific revision up to which you would like to push')),
           ('n', 'newest-first', None, _('show newest record first')),
          ] + logopts + remoteopts,
-         _('hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
+         _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
     "^parents":
         (parents,
          [('r', 'rev', '', _('show parents from the specified rev')),
          ] + templateopts,
          _('hg parents [-r REV] [FILE]')),
-    "paths": (paths, [], _('hg paths [NAME]')),
+    "paths": (paths, [], _('[NAME]')),
     "^pull":
         (pull,
          [('u', 'update', None,
@@ -3268,35 +3271,35 @@
           ('r', 'rev', [],
            _('a specific revision up to which you would like to pull')),
          ] + remoteopts,
-         _('hg pull [-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
+         _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
     "^push":
         (push,
          [('f', 'force', None, _('force push')),
           ('r', 'rev', [],
            _('a specific revision up to which you would like to push')),
          ] + remoteopts,
-         _('hg push [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
-    "recover": (recover, [], _('hg recover')),
+         _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
+    "recover": (recover, []),
     "^remove|rm":
         (remove,
          [('A', 'after', None, _('record delete for missing files')),
           ('f', 'force', None,
            _('remove (and delete) file even if added or modified')),
          ] + walkopts,
-         _('hg remove [OPTION]... FILE...')),
+         _('[OPTION]... FILE...')),
     "rename|mv":
         (rename,
          [('A', 'after', None, _('record a rename that has already occurred')),
           ('f', 'force', None,
            _('forcibly copy over an existing managed file')),
          ] + walkopts + dryrunopts,
-         _('hg rename [OPTION]... SOURCE... DEST')),
+         _('[OPTION]... SOURCE... DEST')),
     "resolve":
         (resolve,
          [('l', 'list', None, _('list state of files needing merge')),
           ('m', 'mark', None, _('mark files as resolved')),
           ('u', 'unmark', None, _('unmark files as resolved'))],
-          _('hg resolve [OPTION]... [FILE]...')),
+          _('[OPTION]... [FILE]...')),
     "revert":
         (revert,
          [('a', 'all', None, _('revert all changes when no arguments given')),
@@ -3304,9 +3307,9 @@
           ('r', 'rev', '', _('revision to revert to')),
           ('', 'no-backup', None, _('do not save backup copies of files')),
          ] + walkopts + dryrunopts,
-         _('hg revert [OPTION]... [-r REV] [NAME]...')),
-    "rollback": (rollback, [], _('hg rollback')),
-    "root": (root, [], _('hg root')),
+         _('[OPTION]... [-r REV] [NAME]...')),
+    "rollback": (rollback, []),
+    "root": (root, []),
     "^serve":
         (serve,
          [('A', 'accesslog', '', _('name of access log file to write to')),
@@ -3326,11 +3329,11 @@
           ('', 'style', '', _('template style to use')),
           ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
           ('', 'certificate', '', _('SSL certificate file'))],
-         _('hg serve [OPTION]...')),
+         _('[OPTION]...')),
     "showconfig|debugconfig":
         (showconfig,
          [('u', 'untrusted', None, _('show untrusted configuration options'))],
-         _('hg showconfig [-u] [NAME]...')),
+         _('[-u] [NAME]...')),
     "^status|st":
         (status,
          [('A', 'all', None, _('show status of all files')),
@@ -3347,7 +3350,7 @@
            _('end filenames with NUL, for use with xargs')),
           ('', 'rev', [], _('show difference from revision')),
          ] + walkopts,
-         _('hg status [OPTION]... [FILE]...')),
+         _('[OPTION]... [FILE]...')),
     "tag":
         (tag,
          [('f', 'force', None, _('replace existing tag')),
@@ -3357,26 +3360,26 @@
           # -l/--local is already there, commitopts cannot be used
           ('m', 'message', '', _('use <text> as commit message')),
          ] + commitopts2,
-         _('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')),
-    "tags": (tags, [], _('hg tags')),
+         _('[-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')),
+    "tags": (tags, []),
     "tip":
         (tip,
          [('p', 'patch', None, _('show patch')),
          ] + templateopts,
-         _('hg tip [-p]')),
+         _('[-p]')),
     "unbundle":
         (unbundle,
          [('u', 'update', None,
            _('update to new tip if changesets were unbundled'))],
-         _('hg unbundle [-u] FILE...')),
+         _('[-u] FILE...')),
     "^update|up|checkout|co":
         (update,
          [('C', 'clean', None, _('overwrite locally modified files (no backup)')),
           ('d', 'date', '', _('tipmost revision matching date')),
           ('r', 'rev', '', _('revision'))],
-         _('hg update [-C] [-d DATE] [[-r] REV]')),
-    "verify": (verify, [], _('hg verify')),
-    "version": (version_, [], _('hg version')),
+         _('[-C] [-d DATE] [[-r] REV]')),
+    "verify": (verify, []),
+    "version": (version_, []),
 }
 
 norepo = ("clone init version help debugcomplete debugdata"