D5813: revset: add expect to check the size of a set

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sun Feb 3 12:22:52 EST 2019


pulkit added subscribers: durin42, pulkit.
pulkit added a comment.


  > This then allows an alias for hg next to be update -r one(children(.))
  >  with sane failure behavior, and also makes some other scripting tasks
  >  a little less difficult.
  
  Just for record, `hg next` has a nice prompt if there are multiple childrens. So the `expect` or `one` revset might not be very useful there.

INLINE COMMENTS

> revset.py:838
> +        if len(rev) != n:
> +            raise error.Abort(_('revset is not of expected size'))
> +    if n==1:

it will be good if we add the length of revset in the error message here.

> revset.py:839
> +            raise error.Abort(_('revset is not of expected size'))
> +    if n==1:
> +        if len(rev) != n:

why are we special casing 1 here?

> revset.py:1442
>  
> + at predicate('one(set)', safe=True)
> +def one(repo, subset, x):

I am not sure why we need this. @durin42 might have thoughts on this.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5813

To: navaneeth.suresh, #hg-reviewers
Cc: pulkit, durin42, mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list