Commit a789b9d5 authored by Katsunori FUJIWARA's avatar Katsunori FUJIWARA
Browse files

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.
parent bae174e0e0ac
...@@ -140,6 +140,7 @@ ...@@ -140,6 +140,7 @@
- topic: allow 'hg prev' to me move to 't0', - topic: allow 'hg prev' to me move to 't0',
- topic: add a config option to enforce topic on new commit - topic: add a config option to enforce topic on new commit
(experimental.enforce-topic) (experimental.enforce-topic)
- topic: make command names valid as expected, even if ui.strict=true
6.5.0 -- 2017-07-02 6.5.0 -- 2017-07-02
------------------- -------------------
......
...@@ -307,8 +307,8 @@ ...@@ -307,8 +307,8 @@
'topics', 'topic', namemap=_namemap, nodemap=_nodemap, 'topics', 'topic', namemap=_namemap, nodemap=_nodemap,
listnames=lambda repo: repo.topics)) listnames=lambda repo: repo.topics))
@command('topics [TOPIC]', [ @command('topics', [
('', 'clear', False, 'clear active topic if any'), ('', 'clear', False, 'clear active topic if any'),
('r', 'rev', '', 'revset of existing revisions', _('REV')), ('r', 'rev', '', 'revset of existing revisions', _('REV')),
('l', 'list', False, 'show the stack of changeset in the topic'), ('l', 'list', False, 'show the stack of changeset in the topic'),
('', 'age', False, 'show when you last touched the topics') ('', 'age', False, 'show when you last touched the topics')
...@@ -311,8 +311,9 @@ ...@@ -311,8 +311,9 @@
('', 'clear', False, 'clear active topic if any'), ('', 'clear', False, 'clear active topic if any'),
('r', 'rev', '', 'revset of existing revisions', _('REV')), ('r', 'rev', '', 'revset of existing revisions', _('REV')),
('l', 'list', False, 'show the stack of changeset in the topic'), ('l', 'list', False, 'show the stack of changeset in the topic'),
('', 'age', False, 'show when you last touched the topics') ('', '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): 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. """View current topic, set current topic, change topic for a set of revisions, or see all topics.
...@@ -365,7 +366,9 @@ ...@@ -365,7 +366,9 @@
_listtopics(ui, repo, opts) _listtopics(ui, repo, opts)
@command('stack [TOPIC]', [] + commands.formatteropts) @command('stack', [
] + commands.formatteropts,
_('hg stack [TOPIC]'))
def cmdstack(ui, repo, topic='', **opts): def cmdstack(ui, repo, topic='', **opts):
"""list all changesets in a topic and other information """list all changesets in a topic and other information
......
...@@ -187,6 +187,29 @@ ...@@ -187,6 +187,29 @@
} }
] ]
check that topics and stack are available even if ui.strict=true
$ hg topics
* foo
$ hg stack
### topic: foo
### branch: default
t4@ c_f (current)
t3: c_e
t2: c_d
t1: c_c
t0^ c_b (base)
$ hg topics --config ui.strict=true
* foo
$ hg stack --config ui.strict=true
### topic: foo
### branch: default
t4@ c_f (current)
t3: c_e
t2: c_d
t1: c_c
t0^ c_b (base)
error case, nothing to list error case, nothing to list
$ hg topic --clear $ hg topic --clear
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment