diff hgext3rd/topic/__init__.py @ 2805:a789b9d5b60c stable

topic: make command names valid as expected, even if ui.strict=true Before this patch, "hg topics" and "hg stack" cause unintentional "unknown command" failure, if ui.strict=true. In such case, "topics [TOPIC]" and "stack [TOPIC]" are required as a canonical name, because synopsis-like string is used as command name pattern of @command annotation for them. This patch also specifies additional "synopsis" for @command annotation, for intentional output in online help of these commands.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 23 Jul 2017 13:30:28 +0900
parents 0dc119ed06b4
children cc3e09e033a3
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Tue Jul 25 14:56:52 2017 +0200
+++ b/hgext3rd/topic/__init__.py	Sun Jul 23 13:30:28 2017 +0900
@@ -307,12 +307,13 @@
             'topics', 'topic', namemap=_namemap, nodemap=_nodemap,
             listnames=lambda repo: repo.topics))
 
-@command('topics [TOPIC]', [
+@command('topics', [
         ('', 'clear', False, 'clear active topic if any'),
         ('r', 'rev', '', 'revset of existing revisions', _('REV')),
         ('l', 'list', False, 'show the stack of changeset in the topic'),
         ('', 'age', False, 'show when you last touched the topics')
-    ] + commands.formatteropts)
+    ] + commands.formatteropts,
+    _('hg topics [TOPIC]'))
 def topics(ui, repo, topic='', clear=False, rev=None, list=False, **opts):
     """View current topic, set current topic, change topic for a set of revisions, or see all topics.
 
@@ -365,7 +366,9 @@
 
     _listtopics(ui, repo, opts)
 
-@command('stack [TOPIC]', [] + commands.formatteropts)
+@command('stack', [
+    ] + commands.formatteropts,
+    _('hg stack [TOPIC]'))
 def cmdstack(ui, repo, topic='', **opts):
     """list all changesets in a topic and other information