changeset 25766:d51dac68ec98

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.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 28 Jun 2015 16:08:07 +0900
parents 5e1b0739611c
children 026105c442d7
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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())'