[PATCH] commands: adjust metavariables as appropriate

Anton Shestakov av6 at dwimlabs.net
Wed Oct 17 14:23:01 UTC 2018


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1539781236 -28800
#      Wed Oct 17 21:00:36 2018 +0800
# Node ID 02ad74c4abc1b66e63f118f1247ccc7c97acc786
# Parent  ef0baff11aeaaa8424294982235a18c476728264
commands: adjust metavariables as appropriate

Apart from looking better in hg help command, these strings are also helpful
when generating shell completions programmatically.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -478,20 +478,25 @@ emailopts = [
     ('', 'body', None, _('send patches as inline message text (default)')),
     ('a', 'attach', None, _('send patches as attachments')),
     ('i', 'inline', None, _('send patches as inline attachments')),
-    ('', 'bcc', [], _('email addresses of blind carbon copy recipients')),
-    ('c', 'cc', [], _('email addresses of copy recipients')),
+    ('', 'bcc', [],
+     _('email addresses of blind carbon copy recipients'), _('EMAIL')),
+    ('c', 'cc', [], _('email addresses of copy recipients'), _('EMAIL')),
     ('', 'confirm', None, _('ask for confirmation before sending')),
     ('d', 'diffstat', None, _('add diffstat output to messages')),
-    ('', 'date', '', _('use the given date as the sending date')),
-    ('', 'desc', '', _('use the given file as the series description')),
-    ('f', 'from', '', _('email address of sender')),
+    ('', 'date', '', _('use the given date as the sending date'), _('DATE')),
+    ('', 'desc', '',
+     _('use the given file as the series description'), _('FILE')),
+    ('f', 'from', '', _('email address of sender'), _('EMAIL')),
     ('n', 'test', None, _('print messages that would be sent')),
-    ('m', 'mbox', '', _('write messages to mbox file instead of sending them')),
-    ('', 'reply-to', [], _('email addresses replies should be sent to')),
-    ('s', 'subject', '', _('subject of first message (intro or single patch)')),
-    ('', 'in-reply-to', '', _('message identifier to reply to')),
-    ('', 'flag', [], _('flags to add in subject prefixes')),
-    ('t', 'to', [], _('email addresses of recipients'))]
+    ('m', 'mbox', '',
+     _('write messages to mbox file instead of sending them'), _('FILE')),
+    ('', 'reply-to', [],
+     _('email addresses replies should be sent to'), _('EMAIL')),
+    ('s', 'subject', '',
+     _('subject of first message (intro or single patch)'), _('TEXT')),
+    ('', 'in-reply-to', '', _('message identifier to reply to'), _('MSGID')),
+    ('', 'flag', [], _('flags to add in subject prefixes'), _('FLAG')),
+    ('t', 'to', [], _('email addresses of recipients'), _('EMAIL'))]
 
 @command('email',
     [('g', 'git', None, _('use git extended diff format')),
@@ -499,7 +504,8 @@ emailopts = [
     ('o', 'outgoing', None,
      _('send changes not found in the target repository')),
     ('b', 'bundle', None, _('send changes not in target as a binary bundle')),
-    ('B', 'bookmark', '', _('send changes only reachable by given bookmark')),
+    ('B', 'bookmark', '',
+     _('send changes only reachable by given bookmark'), _('BOOKMARK')),
     ('', 'bundlename', 'bundle',
      _('name of the bundle attachment file'), _('NAME')),
     ('r', 'rev', [], _('a revision to send'), _('REV')),
diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -110,7 +110,7 @@ def strip(ui, repo, revs, update=True, b
           ('k', 'keep', None, _("do not modify working directory during "
                                 "strip")),
           ('B', 'bookmark', [], _("remove revs only reachable from given"
-                                  " bookmark"))],
+                                  " bookmark"), _('BOOKMARK'))],
           _('hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
           helpcategory=command.CATEGORY_MAINTENANCE)
 def stripcmd(ui, repo, *revs, **opts):
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -149,7 +149,7 @@ diffopts2 = [
 ]
 
 mergetoolopts = [
-    ('t', 'tool', '', _('specify merge tool')),
+    ('t', 'tool', '', _('specify merge tool'), _('TOOL')),
 ]
 
 similarityopts = [
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1996,7 +1996,7 @@ def diff(ui, repo, *pats, **opts):
 
 @command('export',
     [('B', 'bookmark', '',
-     _('export changes only reachable by given bookmark')),
+     _('export changes only reachable by given bookmark'), _('BOOKMARK')),
     ('o', 'output', '',
      _('print output to file with formatted name'), _('FORMAT')),
     ('', 'switch-parent', None, _('diff against the second parent')),
@@ -2257,7 +2257,7 @@ def forget(ui, repo, *pats, **opts):
      ('D', 'currentdate', False,
       _('record the current date as commit date')),
      ('U', 'currentuser', False,
-      _('record the current user as committer'), _('DATE'))]
+      _('record the current user as committer'))]
     + commitopts2 + mergetoolopts  + dryrunopts,
     _('[OPTION]... [-r REV]... REV...'),
     helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
@@ -3016,9 +3016,10 @@ def heads(ui, repo, *branchrevs, **opts)
     [('e', 'extension', None, _('show only help for extensions')),
      ('c', 'command', None, _('show only help for commands')),
      ('k', 'keyword', None, _('show topics matching keyword')),
-     ('s', 'system', [], _('show help for specific platform(s)')),
+     ('s', 'system', [],
+      _('show help for specific platform(s)'), _('PLATFORM')),
      ],
-    _('[-ecks] [TOPIC]'),
+    _('[-eck] [-s PLATFORM] [TOPIC]'),
     helpcategory=command.CATEGORY_HELP,
     norepo=True,
     intents={INTENT_READONLY})
diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -10,7 +10,7 @@ ensure that failing ui.atexit handlers r
   > EOF
   $ hg -q --config extensions.bailatexit=$TESTTMP/bailatexit.py \
   >  help help
-  hg help [-ecks] [TOPIC]
+  hg help [-eck] [-s PLATFORM] [TOPIC]
   
   show help for a given topic or a help overview
   error in exit handlers:
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -715,14 +715,14 @@ Make sure no one adds back a -b option:
   
   options ([+] can be repeated):
   
-   -r --rev REV [+]        strip specified revision (optional, can specify
-                           revisions without this option)
-   -f --force              force removal of changesets, discard uncommitted
-                           changes (no backup)
-      --no-backup          do not save backup bundle
-   -k --keep               do not modify working directory during strip
-   -B --bookmark VALUE [+] remove revs only reachable from given bookmark
-      --mq                 operate on patch repository
+   -r --rev REV [+]           strip specified revision (optional, can specify
+                              revisions without this option)
+   -f --force                 force removal of changesets, discard uncommitted
+                              changes (no backup)
+      --no-backup             do not save backup bundle
+   -k --keep                  do not modify working directory during strip
+   -B --bookmark BOOKMARK [+] remove revs only reachable from given bookmark
+      --mq                    operate on patch repository
   
   (use 'hg strip -h' to show more help)
   [255]


More information about the Mercurial-devel mailing list