[PATCH evolve-ext-V2] uncommit: add support for interactive selection

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed May 27 19:10:27 CDT 2015



On 05/27/2015 04:39 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1432747476 25200
> #      Wed May 27 10:24:36 2015 -0700
> # Node ID 2ba8f8322588f8940ab93e3801fd23c0e1fa8456
> # Parent  69e5de3e6129185469c2cbf98383ac6d58260d0c
> uncommit: add support for interactive selection
>
> This patch adds a --interactive flag to the uncommit command. This allows
> the user to interactively (record and crecord) select changes to be uncommited.

Actually, this apparently letting the user select the chunk he wants to 
keep. (with a default of "keep all") this sounds wrong.

- I would probably expect to select change to uncommit (because that is 
the command name)… but this discussion seems familliar.

- Default value should be uncommit --all

>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -28,8 +28,10 @@
>   from StringIO import StringIO
>   import struct
>   import re
> +import inspect
>   import socket
>   import errno
> +import cStringIO
>   sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
>
>   import mercurial
> @@ -1985,6 +1987,69 @@
>           touched.update(files)
>       return touched
>
> +def _commitfilteredinteractive(repo, ctx, match, target=None):
> +    """Recommit ctx with changed files not in match. Return the new
> +    node identifier, or None if nothing changed.
> +    """
> +
> +    # In older versions of mercurial context.makememctx does not accept
> +    # the extra argument. If that is not the case we fail early
> +    if not 'extra' in inspect.getargspec(context.makememctx).args:
> +        raise util.Abort('Your version of mercurial does not support this'
> +                         'feature, please update it and try again or do not'
> +                         'use the interactive mode')

This message is a bit uncannonical, as we are going to need a V2, try to 
aims at something as:

   Abort(_('requires mercurial 3.5 or older to use --interactive'),
         _(hint='upgrade your mercurial or drop the --interactive option.'))

- both lines fit in 80 char
- explicite reference to the version needed
- not sure if the hint is useful.

Feel free to play around such theme.


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list