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

2019-02-03 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers. REVISION SUMMARY `expect(, )` revset fails if `` is not exactly `` elements. `expect(, , )` revset fails if `` is not exactly between `` and `` inclusive. `

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

2019-02-03 Thread pulkit (Pulkit Goyal)
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

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

2019-02-03 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 13735. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13731&id=13735 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS

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

2019-02-03 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh marked 2 inline comments as done. navaneeth.suresh added a comment. @pulkit Thanks for the quick review! I've updated the revision with the suggested changes. @durin42 It would be great if you let us know your opinion on `one()` as an alias for `expect(, 1)`. I did it as it w

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

2019-02-03 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 13736. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13735&id=13736 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS

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

2019-02-04 Thread yuja (Yuya Nishihara)
yuja added a comment. > +@predicate('expect(set[, size[, min, max]])', safe=True, takeorder=True) First, I think the word `expect` is too general. Perhaps, this should be called `expectsize()` or `expectlen()`. It's also unclear what's the difference between `size` and `min`/`max`.

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

2019-02-05 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment. > First, I think the word `expect` is too general. Perhaps, this should be called > `expectsize()` or `expectlen()`. I can make it `expectsize()`. > It's also unclear what's the difference between `size` and `min`/`max`. > Instead of these para

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

2019-02-05 Thread yuja (Yuya Nishihara)
yuja added a comment. > > You can try out some combinations of `expect(5:0) & 1:10` and > > `10:1 & expect(0:5)`. > > I got into many errors while using this. I might be not understanding this correctly. Could you please elaborate? Can you share your failed attempt? M

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

2019-02-06 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 13851. navaneeth.suresh edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13736&id=13851 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercu

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

2019-02-06 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment. > Can you share your failed attempt? > > Maybe you can get how revset works by testing expression with > `hg debugrevspec -v`. I somehow managed to meet your requirements in the current revision @yuja. Please let me know if I missed out something

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

2019-02-07 Thread yuja (Yuya Nishihara)
yuja added a comment. > + $ hg log -r 'expectsize(0:2, 3)' > + changeset: 0:2785f51eece5 > + branch: a > + user:test > + date:Thu Jan 01 00:00:00 1970 + > + summary: 0 Nit: the test outputs look unnecessarily verbose. Use `log` (not `hg l

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

2019-02-07 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 13899. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13851&id=13899 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS

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

2019-02-07 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment. @yuja I've updated the revision with the suggested changes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5813 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel __

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

2019-02-09 Thread yuja (Yuya Nishihara)
yuja added a comment. > +@predicate('expectsize(set[, size])', safe=True, takeorder=True) > +def expectrevsetsize(repo, subset, x, order): > +"""Abort if the revset doesn't expect given size""" > +args = getargsdict(x, 'expect', 'set size') > +size = args.get('size') >

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

2019-02-09 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 14000. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13899&id=14000 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS

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

2019-02-10 Thread yuja (Yuya Nishihara)
yuja added a comment. Getting close. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5813 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercur

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

2019-02-10 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 14013. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=14000&id=14013 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS

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

2019-02-10 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment. nit-pick is resolved. `getintrange()` will throw a `ParseError` on setting size to one of `min:`, `:max` or `:`. In ideal case, on calling from `expectsize()` it shouldn't fail. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D58

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

2019-02-11 Thread yuja (Yuya Nishihara)
yuja added a comment. > nit-pick is resolved. `getintrange()` will throw a `ParseError` on setting size to one of `min:`, `:max` or `:`. In ideal case, on calling from `expectsize()` it shouldn't fail. So you need to pass in the default min/max values to `getintrange()`. The default

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

2019-02-11 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 14029. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=14013&id=14029 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS

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

2019-02-12 Thread yuja (Yuya Nishihara)
yuja added a comment. > +@predicate('expectsize(set[, size])', safe=True, takeorder=True) > +def expectrevsetsize(repo, subset, x, order): > +"""Abort if the revset doesn't expect given size""" > +args = getargsdict(x, 'expect', 'set size') Fixed function name and queued,

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

2019-02-12 Thread navaneeth.suresh (Navaneeth Suresh)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8185c8abce87: revset: add expectsize to check the size of a set (authored by navaneeth.suresh, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5813?vs=14029&id=14043#toc REPOSI

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

2019-02-12 Thread pulkit (Pulkit Goyal)
pulkit added inline comments. INLINE COMMENTS > revset.py:866 > +def expectsize(repo, subset, x, order): > +"""Abort if the revset doesn't expect given size""" > +args = getargsdict(x, 'expectsize', 'set size') Can you improve this documentation as a follow-up? We should mentioned about

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

2019-02-13 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added inline comments. INLINE COMMENTS > pulkit wrote in revset.py:866 > Can you improve this documentation as a follow-up? We should mentioned about > specifying ranges, and also if the set has the given size, that set is > returned. Doing that right away! REPOSITORY rHG M

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

2019-02-04 Thread Yuya Nishihara
> +@predicate('expect(set[, size[, min, max]])', safe=True, takeorder=True) First, I think the word `expect` is too general. Perhaps, this should be called `expectsize()` or `expectlen()`. It's also unclear what's the difference between `size` and `min`/`max`. Instead of these parameters, maybe w

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

2019-02-05 Thread Yuya Nishihara
> > You can try out some combinations of `expect(5:0) & 1:10` and > > `10:1 & expect(0:5)`. > > I got into many errors while using this. I might be not understanding this > correctly. Could you please elaborate? Can you share your failed attempt? Maybe you can get how revset works by t

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

2019-02-07 Thread Yuya Nishihara
> + $ hg log -r 'expectsize(0:2, 3)' > + changeset: 0:2785f51eece5 > + branch: a > + user:test > + date:Thu Jan 01 00:00:00 1970 + > + summary: 0 Nit: the test outputs look unnecessarily verbose. Use `log` (not `hg log`) instead. > +@predicate('expectsize(set[

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

2019-02-09 Thread Yuya Nishihara
> +@predicate('expectsize(set[, size])', safe=True, takeorder=True) > +def expectrevsetsize(repo, subset, x, order): > +"""Abort if the revset doesn't expect given size""" > +args = getargsdict(x, 'expect', 'set size') > +size = args.get('size') > +if size is not None: > +mi

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

2019-02-10 Thread Yuya Nishihara
Getting close. On Sun, 10 Feb 2019 05:19:55 +, navaneeth.suresh (Navaneeth Suresh) wrote: > + $ log 'expectsize(0:2, 2:4)' Can you test `:max`, `min:`, and `:` (no constraint)? They shouldn't fail. > +@predicate('expectsize(set[, size])', safe=True, takeorder=True) > +def expectrevsetsize(r

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

2019-02-11 Thread Yuya Nishihara
> nit-pick is resolved. `getintrange()` will throw a `ParseError` on setting > size to one of `min:`, `:max` or `:`. In ideal case, on calling from > `expectsize()` it shouldn't fail. So you need to pass in the default min/max values to `getintrange()`. The default min can be just `0`. The def

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

2019-02-12 Thread Yuya Nishihara
> +@predicate('expectsize(set[, size])', safe=True, takeorder=True) > +def expectrevsetsize(repo, subset, x, order): > +"""Abort if the revset doesn't expect given size""" > +args = getargsdict(x, 'expect', 'set size') Fixed function name and queued, thanks. ___