[PATCH 4 of 6] context: introduce changes function to get a list of files changed

Idan Kamara idankk86 at gmail.com
Fri Mar 9 09:07:25 CST 2012


On Thu, Mar 8, 2012 at 9:48 PM, Matt Mackall <mpm at selenic.com> wrote:

> On Tue, 2012-03-06 at 18:44 +0200, Idan Kamara wrote:
> > # HG changeset patch
> > # User Idan Kamara <idankk86 at gmail.com>
> > # Date 1331052186 -7200
> > # Node ID 2d6eb93415d09c26c3bdf94bf74b584acc6ebab6
> > # Parent  d432a8416495be0ed9ff2ad3dbcb6dce55ac8739
> > context: introduce changes function to get a list of files changed
> >
> > Will be used to display the list of changed files in the editor
> > when amending.
> >
> > diff --git a/mercurial/context.py b/mercurial/context.py
> > --- a/mercurial/context.py
> > +++ b/mercurial/context.py
> > @@ -237,6 +237,12 @@
> >          return patch.diff(self._repo, ctx2.node(), self.node(),
> >                            match=match, opts=diffopts)
> >
> > +    def changes(self, ctx2=None, ignored=False, clean=False,
> unknown=False):
> > +        """Returns a list of files that were changed between ctx2 and
> self"""
> > +        if ctx2 is None:
> > +            ctx2 = self.p1()
> > +        return self._repo.status(ctx2, self._node, ignored, clean,
> unknown)
>
> I guess this is a useful primitive, but I don't really care for all the
> options. I'd rather the prototype simply be:
>
> def changes(self, other):
>
> with no defaults or optional args. If you're looking at self.p1(), then
> you probably should be looking at self.files() or using one of the
> internally cached added()/removed()/modified() methods. And
> ignored/clean/unknown files are.. well not really "changes".
>
> As for the return, it currently returns a MARDUIC vector, not a "list of
> files". And since there's not much sense in returning a bunch of empty
> elements, we probably want to simplify this to MAR.
>
> Unless of course the goal is to replace repo.status, in which case it's
> probably misnamed.
>
> On the whole, this should probably not be part of the series.
>

It seems like the need for it in my series has vanished, so
we can probably wait with it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120309/35fad504/attachment.html>


More information about the Mercurial-devel mailing list