On Mon, 08 Apr 2019 14:27:53 -0400, Jordi Gutiérrez Hermoso wrote:
> 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?

Something like that. My point is that checkstatus(..., getcopiedfiles) will
be more readable than checkstatus(..., 3), which sounds like returning the
3rd status field.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to