[PATCH 4 of 5 evolve-ext] evolve: add selector for trouble types

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed May 13 19:16:22 CDT 2015



On 05/13/2015 10:04 AM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1431532715 25200
> #      Wed May 13 08:58:35 2015 -0700
> # Node ID f7b2e0e5e05e76d181c99e6ed3fbcc9508cc0c33
> # Parent  96db44ca62d46ac9b57042885e40adb8c1fd9e4e
> evolve: add selector for trouble types
>
> This patch adds command line flags to select the kind of troubles to solve.
> It is limited to --rev. The default of --rev remains solving all three kinds of
> troubles.
>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -1243,6 +1243,9 @@
>           'ask for confirmation before performing the action'),
>       ('A', 'any', False, 'also consider troubled changesets unrelated to current working directory'),
>       ('r', 'rev', '', 'solves troubles of these revisions'),
> +    ('', 'bumped', False, 'with --rev: solves only bumped changesets'),
> +    ('', 'divergent', False, 'with --rev: solves only divergent changesets'),
> +    ('', 'unstable', False, 'with --rev: solves only unstable changesets'),

Why are we stricting this to the --rev case? Can't we apply this in all 
cases

>       ('a', 'all', False, 'evolve all troubled changesets in the repo '
>                           '(implies any)'),
>       ('c', 'continue', False, 'continue an interrupted evolution'),
> @@ -1281,6 +1284,7 @@
>       dryrunopt = opts['dry_run']
>       confirmopt = opts['confirm']
>       revopt = opts['rev']
> +    troubletypes = ['bumped', 'divergent', 'unstable']
>       ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve')
>       troubled = set(repo.revs('troubled()'))
>
> @@ -1304,7 +1308,12 @@
>       # Rev specified on the commands line
>       if revopt:
>           revs = repo.revs(revopt)
> -        troubled = repo.revs('troubled()')
> +        # () as we use these in a revset
> +        specifictypes = [t + '()' for t in troubletypes if opts[t]]
> +        if specifictypes:
> +            troubled = repo.revs(' or '.join(specifictypes))
> +        else:
> +            troubled = repo.revs('troubled()')
>           _revs = revs & troubled
>           if not _revs:
>               ui.write_err("No troubled changes in the specified revset\n")
> diff --git a/tests/test-evolve.t b/tests/test-evolve.t
> --- a/tests/test-evolve.t
> +++ b/tests/test-evolve.t
> @@ -1001,7 +1001,9 @@
>     |
>     o  0	: a0 - test
>
> -  $ hg evolve --rev "14::"
> +  $ hg evolve --rev "14::" --bumped
> +  No troubled changes in the specified revset

This message is wrong. There is trouble in the specified revisions. But 
there is no bumped one in there. We need a working that:

1) make the filter clear
2) maybe point that other troubles affect (in the "do you want --any) 
fashion.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list