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.
`
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
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
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
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
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`.
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
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
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
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
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
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
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
__
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')
>
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
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
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
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
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
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
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,
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
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
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
> +@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
> > 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
> + $ 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[
> +@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
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
> 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
> +@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.
___
31 matches
Mail list logo