Mercurial > evolve
comparison 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 |
comparison
equal
deleted
inserted
replaced
2804:bae174e0e0ac | 2805:a789b9d5b60c |
---|---|
305 if util.safehasattr(repo, 'names'): | 305 if util.safehasattr(repo, 'names'): |
306 repo.names.addnamespace(namespaces.namespace( | 306 repo.names.addnamespace(namespaces.namespace( |
307 'topics', 'topic', namemap=_namemap, nodemap=_nodemap, | 307 'topics', 'topic', namemap=_namemap, nodemap=_nodemap, |
308 listnames=lambda repo: repo.topics)) | 308 listnames=lambda repo: repo.topics)) |
309 | 309 |
310 @command('topics [TOPIC]', [ | 310 @command('topics', [ |
311 ('', 'clear', False, 'clear active topic if any'), | 311 ('', 'clear', False, 'clear active topic if any'), |
312 ('r', 'rev', '', 'revset of existing revisions', _('REV')), | 312 ('r', 'rev', '', 'revset of existing revisions', _('REV')), |
313 ('l', 'list', False, 'show the stack of changeset in the topic'), | 313 ('l', 'list', False, 'show the stack of changeset in the topic'), |
314 ('', 'age', False, 'show when you last touched the topics') | 314 ('', 'age', False, 'show when you last touched the topics') |
315 ] + commands.formatteropts) | 315 ] + commands.formatteropts, |
316 _('hg topics [TOPIC]')) | |
316 def topics(ui, repo, topic='', clear=False, rev=None, list=False, **opts): | 317 def topics(ui, repo, topic='', clear=False, rev=None, list=False, **opts): |
317 """View current topic, set current topic, change topic for a set of revisions, or see all topics. | 318 """View current topic, set current topic, change topic for a set of revisions, or see all topics. |
318 | 319 |
319 Clear topic on existing topiced revisions: | 320 Clear topic on existing topiced revisions: |
320 `hg topic --rev <related revset> --clear` | 321 `hg topic --rev <related revset> --clear` |
363 if topic: | 364 if topic: |
364 return _changecurrenttopic(repo, topic) | 365 return _changecurrenttopic(repo, topic) |
365 | 366 |
366 _listtopics(ui, repo, opts) | 367 _listtopics(ui, repo, opts) |
367 | 368 |
368 @command('stack [TOPIC]', [] + commands.formatteropts) | 369 @command('stack', [ |
370 ] + commands.formatteropts, | |
371 _('hg stack [TOPIC]')) | |
369 def cmdstack(ui, repo, topic='', **opts): | 372 def cmdstack(ui, repo, topic='', **opts): |
370 """list all changesets in a topic and other information | 373 """list all changesets in a topic and other information |
371 | 374 |
372 List the current topic by default. | 375 List the current topic by default. |
373 | 376 |