[PATCH evolve-ext STABLE] topic: make command names valid as expected, even if ui.strict=true

Boris Feld boris.feld at octobus.net
Tue Jul 25 11:30:13 EDT 2017


Queued thanks!

On Tue, 2017-07-25 at 21:55 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1500784228 -32400
> #      Sun Jul 23 13:30:28 2017 +0900
> # Branch stable
> # Node ID 85c84eacbdeeaf10f3643a1bcf4ae7f38afcb30b
> # Parent  74456bc055ae1a17b0e8654ce9ed913aaf66c458
> # Available At https://foozy@bitbucket.org/foozy/hgext-evolve
> #              hg pull https://foozy@bitbucket.org/foozy/hgext-evolve
>  -r 85c84eacbdee
> 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.
> 
> diff --git a/hgext3rd/topic/__init__.py b/hgext3rd/topic/__init__.py
> --- a/hgext3rd/topic/__init__.py
> +++ b/hgext3rd/topic/__init__.py
> @@ -307,12 +307,13 @@ def reposetup(ui, repo):
>              'topics', 'topic', namemap=_namemap, nodemap=_nodemap,
>              listnames=lambda repo: repo.topics))
>  
> - at command('topics [TOPIC]', [
> + at 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 @@ def topics(ui, repo, topic='', clear=Fal
>  
>      _listtopics(ui, repo, opts)
>  
> - at command('stack [TOPIC]', [] + commands.formatteropts)
> + at command('stack', [
> +    ] + commands.formatteropts,
> +    _('hg stack [TOPIC]'))
>  def cmdstack(ui, repo, topic='', **opts):
>      """list all changesets in a topic and other information
>  
> diff --git a/tests/test-topic-stack.t b/tests/test-topic-stack.t
> --- a/tests/test-topic-stack.t
> +++ b/tests/test-topic-stack.t
> @@ -187,6 +187,29 @@ Simple test
>        }
>    ]
>  
> +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
>  
>    $ hg topic --clear
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list