[PATCH 2 of 3] revset: implement copies and renames for checkstatus

Jordi Gutiérrez Hermoso jordigh at octave.org
Mon Apr 8 14:27:53 EDT 2019


On Sun, 2019-04-07 at 09:55 +0900, Yuya Nishihara wrote:
> On Fri, 05 Apr 2019 14:42:38 -0400, Jordi Gutiérrez Hermoso wrote:

> > @@ -624,7 +627,18 @@ def checkstatus(repo, subset, pat, field
> >                      break
> >              else:
> >                  return False
> > -        files = repo.status(c.p1().node(), c.node())[field]
> > +        p1 = c.p1()
> > +        status = repo.status(p1.node(), c.node())
> > +        if field == 3:
> > +            copymap = copiesmod.pathcopies(p1, c, m)
> > +            removed = status[2]
> > +            files = [dest for (dest, src) in copymap.items() if src not in removed]
> > +        elif field == 4:
> > +            copymap = copiesmod.pathcopies(p1, c, m)
> > +            removed = status[2]
> > +            files = [dest for (dest, src) in copymap.items() if src in removed]
> > +        else:
> > +            files = status[field]
> 
> Maybe we can turn the field argument into a lambda function. It doesn't make
> sense to introduce pseudo indices for copies and renames.

I don't understand what you mean. Are you saing that the caller should
pass a function that should say how to get the appropriate data out of
the status object or copymap objects?


More information about the Mercurial-devel mailing list