[PATCH] revset: add function for matching extra data (issue2767)

Matt Mackall mpm at selenic.com
Sat May 12 02:21:00 CDT 2012


On Sat, 2012-05-12 at 09:03 +0200, Henrik Stuart wrote:
> On 11-05-2012 22:30, Matt Mackall wrote:
> > On Fri, 2012-05-11 at 14:23 +0200, Henrik Stuart wrote:
> >> # HG changeset patch
> >> # User Henrik Stuart<hg at hstuart.dk>
> >> # Date 1336738342 -7200
> >> # Node ID 417f576e3552190b4a5ba9d2e2d1db0ec5b65927
> >> # Parent  ddd4996740c785cc187766249977ea3ece8c17ab
> >> revset: add function for matching extra data (issue2767)
> >>
> >> diff --git a/mercurial/revset.py b/mercurial/revset.py
> >> --- a/mercurial/revset.py
> >> +++ b/mercurial/revset.py
> >> @@ -464,6 +464,31 @@
> >>       getargs(x, 0, 0, _("draft takes no arguments"))
> >>       return [r for r in subset if repo._phaserev[r] == phases.draft]
> >>
> >> +def extra(repo, subset, x):
> >> +    """``extra(label, [value], [set])``
> >> +    Changesets with the given label in the extra metadata, with the given
> >> +    optional value, matched globally or from the optional set."""
> >
> > Not sure about the optional set bit. Is there any reason not to do:
> >
> > <set>  and extra(foo)
> >
> > instead?
> 
> Mostly just convenience (and possibly performance in some cases?); I 
> don't feel strongly about it, so I can omit it if you prefer.

Unlike heads(<set>) and the like, this predicate is fully orthogonal:
the membership of each element can be established without looking at the
rest of the set. So I think it's best for such methods to not take a set
as an argument.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list