revset: parse nullary ":" operator as "0:tip"
authorYuya Nishihara <yuya@tcha.org>
Sun, 05 Jul 2015 12:15:54 +0900
changeset 25819 be29d26e2949
parent 25818 455190fb4e51
child 25820 701d8c362aa2
revset: parse nullary ":" operator as "0:tip" This is necessary for compatibility with the old-style parser that will be removed by future patches.
mercurial/revset.py
tests/test-revset.t
--- a/mercurial/revset.py	Mon Jul 06 22:01:41 2015 +0900
+++ b/mercurial/revset.py	Sun Jul 05 12:15:54 2015 +0900
@@ -125,7 +125,7 @@
            ("dagrangepost", 17)),
     "..": (17, None, ("dagrangepre", 17), ("dagrange", 17),
            ("dagrangepost", 17)),
-    ":": (15, None, ("rangepre", 15), ("range", 15), ("rangepost", 15)),
+    ":": (15, "rangeall", ("rangepre", 15), ("range", 15), ("rangepost", 15)),
     "not": (10, None, ("not", 10), None, None),
     "!": (10, None, ("not", 10), None, None),
     "and": (5, None, None, ("and", 5), None),
@@ -2227,6 +2227,8 @@
         return optimize(('func', ('symbol', 'ancestors'), x[1]), small)
     elif op == 'dagrangepost':
         return optimize(('func', ('symbol', 'descendants'), x[1]), small)
+    elif op == 'rangeall':
+        return optimize(('range', ('string', '0'), ('string', 'tip')), small)
     elif op == 'rangepre':
         return optimize(('range', ('string', '0'), x[1]), small)
     elif op == 'rangepost':
--- a/tests/test-revset.t	Mon Jul 06 22:01:41 2015 +0900
+++ b/tests/test-revset.t	Sun Jul 05 12:15:54 2015 +0900
@@ -117,6 +117,25 @@
   <spanset+ 0:1>
   0
   1
+  $ try --optimize :
+  (rangeall
+    None)
+  * optimized:
+  (range
+    ('string', '0')
+    ('string', 'tip'))
+  * set:
+  <spanset+ 0:9>
+  0
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
   $ try 3::6
   (dagrange
     ('symbol', '3')