D6367: context: add modified(), added(), removed() to changectx too

Martin von Zweigbergk martinvonz at google.com
Sun May 12 13:06:04 EDT 2019


*From: *yuja (Yuya Nishihara) <phabricator at mercurial-scm.org>
*Date: *Sat, May 11, 2019, 20:12
*To: * <mercurial-devel at mercurial-scm.org>

yuja added a comment.
>
>
>   > +    def modified(self):
>   >  +        modified = set(self.files())
>   >  +        modified.difference_update(self.added())
>   >  +        modified.difference_update(self.removed())
>   >  +        return sorted(modified)
>   >  +    def added(self):
>   >  +        added = []
>   >  +        for f in self.files():
>   >  +            if not any(f in p for p in self.parents()):
>   >  +                added.append(f)
>   >  +        return added
>   >  +    def removed(self):
>   >  +        removed = []
>   >  +        for f in self.files():
>   >  +            if f not in self:
>   >  +                removed.append(f)
>   >  +        return removed
>
>   Do these definitions agree with the committablectx ones?
>   I think the committablectx calculates them based on the status from p1.
>

Oh, good point. I suppose I should rename these to something like
files{modified,added,removed} since they're slightly different.


> REPOSITORY
>   rHG Mercurial
>
> REVISION DETAIL
>   https://phab.mercurial-scm.org/D6367
>
> To: martinvonz, #hg-reviewers
> Cc: yuja, mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20190512/b0a7af62/attachment.html>


More information about the Mercurial-devel mailing list