D6140: revset: add new contiguous(x) function for "x::x"

Josef 'Jeff' Sipek jeffpc at josefsipek.net
Wed Mar 20 14:08:18 EDT 2019


On Wed, Mar 20, 2019 at 17:28:46 +0000, martinvonz (Martin von Zweigbergk) wrote:
> 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" :)

Technically true :)

> 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?

That would make it clearer.  My brain connected the word set with the whole
expression "x::x" (which is *obviously* a set), not with the input - even
though the string in the @predicate does say that the input is a set.

> We could make that change to all the existing cases of plain
>   "set" referring to the input.

In general, I'm always for docs being accessible.  If a doc makes the user
feel like they need a degree in mathematics, the doc is bad.  With that
said, I have not looked at the other doc strings so I don't know where the
place on the good/bad scale.

Jeff.

> 
> REPOSITORY
>   rHG Mercurial
> 
> REVISION DETAIL
>   https://phab.mercurial-scm.org/D6140
> 
> To: martinvonz, #hg-reviewers
> Cc: mharbison72, yuja, av6, spectral, gracinet, marmoute, mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

-- 
I have always wished for my computer to be as easy to use as my telephone;
my wish has come true because I can no longer figure out how to use my
telephone.
		- Bjarne Stroustrup


More information about the Mercurial-devel mailing list