[PATCH evolve-ext] uncommit: abort if an explicitly given file cannot be uncommitted (BC)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Apr 9 10:41:47 EDT 2019


PAtch looks good overall, but has compatibility issue with older 
version. Can you have a look at my comment below?

On 4/3/19 4:45 AM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1554259321 14400
> #      Tue Apr 02 22:42:01 2019 -0400
> # Node ID 272e76e20c3c52fcae8a4c2003f73d8db77e566b
> # Parent  e8515ee7a7cc0281d905f762e26e8956ccfd7f74
> uncommit: abort if an explicitly given file cannot be uncommitted (BC)
> 
> This corresponds to f4147ca63d39 in the core uncommit extension.
> 
> diff --git a/hgext3rd/evolve/cmdrewrite.py b/hgext3rd/evolve/cmdrewrite.py
> --- a/hgext3rd/evolve/cmdrewrite.py
> +++ b/hgext3rd/evolve/cmdrewrite.py
> @@ -520,17 +520,42 @@
>           if disallowunstable and not onahead:
>               raise error.Abort(_("cannot uncommit in the middle of a stack"))
>   
> +        match = scmutil.match(old, pats, opts)
> +
> +        # Check all explicitly given files; abort if there's a problem.
> +        if match.files():
> +            s = old.status(old.p1(), match, listclean=True)
> +            eligible = set(s.added) | set(s.modified) | set(s.removed)
> +
> +            badfiles = set(match.files()) - eligible
> +
> +            # Naming a parent directory of an eligible file is OK, even
> +            # if not everything tracked in that directory can be
> +            # uncommitted.
> +            if badfiles:
> +                badfiles -= set([f for f in util.dirs(eligible)])
> +
> +            for f in sorted(badfiles):
> +                if f in s.clean:
> +                    hint = _(b"file was not changed in working directory "
> +                             b"parent")
> +                elif repo.wvfs.exists(f):
> +                    hint = _(b"file was untracked in working directory parent")
> +                else:
> +                    hint = _(b"file does not exist")
> +
> +                raise error.Abort(_(b'cannot uncommit "%s"')
> +                                  % scmutil.getuipathfn(repo)(f), hint=hint)
> +

Evolve is compatible with version down to 4.4 and `getuipathfn` seems 
newer than that. Can you send a V2 compatible with the older version ?

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list