revset: work around x:y range where x or y is wdir()
All revisions must be contiguous in spanset, so we need the special case
for the wdir revision.
--- a/mercurial/revset.py Mon Mar 16 16:17:06 2015 +0900
+++ b/mercurial/revset.py Sun Jun 28 16:08:07 2015 +0900
@@ -362,7 +362,13 @@
return baseset()
m, n = m.first(), n.last()
- if m < n:
+ if m == n:
+ r = baseset([m])
+ elif n == node.wdirrev:
+ r = spanset(repo, m, len(repo)) + baseset([n])
+ elif m == node.wdirrev:
+ r = baseset([m]) + spanset(repo, len(repo) - 1, n - 1)
+ elif m < n:
r = spanset(repo, m, n + 1)
else:
r = spanset(repo, m, n - 1)
--- a/tests/test-revset.t Mon Mar 16 16:17:06 2015 +0900
+++ b/tests/test-revset.t Sun Jun 28 16:08:07 2015 +0900
@@ -726,6 +726,16 @@
9
2147483647
$ hg debugrevspec '0:tip and wdir()'
+ $ log '0:wdir()' | tail -3
+ 8
+ 9
+ 2147483647
+ $ log 'wdir():0' | head -3
+ 2147483647
+ 9
+ 8
+ $ log 'wdir():wdir()'
+ 2147483647
$ log '(all() + wdir()) & min(. + wdir())'
9
$ log '(all() + wdir()) & max(. + wdir())'