D6140: revset: add new contiguous(x) function for "x::x"
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Mar 20 13:28:46 EDT 2019
martinvonz added a comment.
In https://phab.mercurial-scm.org/D6140#89770, @martinvonz wrote:
> Josef 'Jeff' Sipek <jeffpc at josefsipek.net> sent this to mercurial-devel. I'm adding it here for reference.
> > "x::x" is a useful trick for making a range contiguous, but it gets
> > annoying if "x" is a long expression. Let's provide a simple function
> > that helps with that. It also makes it the trick more discoverable.
> > + at predicate('contiguous(set)', safe=True, takeorder=True)
> > +def contiguous(repo, subset, x, order):
> > + """Changesets that have both ancestors and descendants in the set. This
> > + effectively fills in gaps in the set to make it contiguous, without adding
> > + new common ancestors or common descendants.
> > +
> > + "contiguous(x)" is identical to "x::x".
> I read this doc string and the patch intro several times, and every time I
> concluded that this function was useless. Only after reading some of the
> other replies, did I realize that "x" here can be a set.
The docstring does say "in the set" :) But I agree that it's not very clear. I copied the pattern from other functions. I would probably have said "in the input set" otherwise. Do you think that would have been clearer? We could make that change to all the existing cases of plain "set" referring to the input.
To: martinvonz, #hg-reviewers
Cc: mharbison72, yuja, av6, spectral, gracinet, marmoute, mercurial-devel
More information about the Mercurial-devel