[PATCH 6 of 6] revset: parse nullary ":" operator as "0:tip"
Yuya Nishihara
yuya at tcha.org
Fri Jul 17 07:34:07 CDT 2015
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1436066154 -32400
# Sun Jul 05 12:15:54 2015 +0900
# Node ID c8c61831756e1f0e5c969ae2fd694ebc1ea4f7c9
# Parent 8836e46ccea8e45da42b0e2eda90cb0e88880353
revset: parse nullary ":" operator as "0:tip"
This is necessary for compatibility with the old-style parser that will be
removed by future patches.
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -123,7 +123,7 @@ elements = {
"-": (5, None, ("negate", 19), ("minus", 5), None),
"::": (17, None, ("dagrangepre", 17), ("dagrange", 17), "dagrangepost"),
"..": (17, None, ("dagrangepre", 17), ("dagrange", 17), "dagrangepost"),
- ":": (15, None, ("rangepre", 15), ("range", 15), "rangepost"),
+ ":": (15, "rangeall", ("rangepre", 15), ("range", 15), "rangepost"),
"not": (10, None, ("not", 10), None, None),
"!": (10, None, ("not", 10), None, None),
"and": (5, None, None, ("and", 5), None),
@@ -2225,6 +2225,8 @@ def optimize(x, small):
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':
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -117,6 +117,25 @@ trivial
<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')
More information about the Mercurial-devel
mailing list