D5813: revset: add expect to check the size of a set
navaneeth.suresh (Navaneeth Suresh)
phabricator at mercurial-scm.org
Tue Feb 5 12:33:32 EST 2019
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 parameters, maybe we can add a `size` parameter that takes
> a number or a range `min:max`. See also the following patch.
>
> https://www.mercurial-scm.org/pipermail/mercurial-devel/2019-February/127916.html
Unfortunately, I can't see this in `hg-stable` which I was working.
>> + if len(rev) != n:
>> + raise error.Abort(_('revset is not of expected size'))
>
> Better to raise RepoLookupError so the error can be caught by `present(...)`.
For sure. I could do that.
>> + return rev
>
> You need to filter rev by subset. Since we'll probably want to get an ordered
> result from `expect(set)`, we'll have to conditionalize the filtering direction:
>
> if order == followorder:
> return subset & rev
> else:
> return rev & subset
>
>
> 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?
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5813
To: navaneeth.suresh, #hg-reviewers
Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list