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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Apr 10 06:37:50 EDT 2019



On 4/10/19 2:26 AM, Martin von Zweigbergk via Mercurial-devel wrote:
> 
> 
> On Tue, Apr 9, 2019 at 7:44 AM Pierre-Yves David 
> <pierre-yves.david at ens-lyon.org <mailto:pierre-yves.david at ens-lyon.org>> 
> wrote:
> 
>     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
>     <mailto: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 ?
> 
> 
> Pierre-Yves, it may not be clear to Matt what exactly he's supposed to 
> do (it isn't to me anyway).

It is not to me either. The constraint is that we need a version 
compatible with older version. Any approach consistent with the rest of 
the evolve code base/behavior will work.

> Specifically, does `hg uncommit` try to use 
> absolute or relative paths? I'm thinking it's probably not a big deal 
> for now and an absolute path is okay? If that's the case, you could 
> simply replace the "scmutil.getuipathfn(repo)(f)" by "f" in flight if 
> that's okay with both of you.
> 
> 
>     Cheers,
> 
>     -- 
>     Pierre-Yves David
>     _______________________________________________
>     Mercurial-devel mailing list
>     Mercurial-devel at mercurial-scm.org
>     <mailto:Mercurial-devel at mercurial-scm.org>
>     https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> 
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> 

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list