[PATCH 4 of 5] revset: also parse x^: as (x^):

Yuya Nishihara yuya at tcha.org
Mon Aug 8 11:25:23 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1470483468 -32400
#      Sat Aug 06 20:37:48 2016 +0900
# Node ID ba93a75f774fbbaa07bef5327e4f8c43755f42cd
# Parent  0d0857c1d633b0fc5ad8d8f3df08dc706dde8845
revset: also parse x^: as (x^):

Given x^:y is (x^):y, this seems sensible.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2323,11 +2323,14 @@ def _fixops(x):
     op = x[0]
     if op == 'parent':
         # x^:y means (x^) : y, not x ^ (:y)
+        # x^:  means (x^) :,   not x ^ (:)
         post = ('parentpost', x[1])
         if x[2][0] == 'dagrangepre':
             return _fixops(('dagrange', post, x[2][1]))
         elif x[2][0] == 'rangepre':
             return _fixops(('range', post, x[2][1]))
+        elif x[2][0] == 'rangeall':
+            return _fixops(('rangepost', post))
 
     return (op,) + tuple(_fixops(y) for y in x[1:])
 
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -504,6 +504,15 @@ infix/suffix resolution of ^ operator (i
   1
   2
 
+  $ try '9^:'
+  (rangepost
+    (parentpost
+      ('symbol', '9')))
+  * set:
+  <spanset+ 8:9>
+  8
+  9
+
  x^:y should be resolved before omitting group operators
 
   $ try '1^(:2)'
@@ -560,6 +569,22 @@ infix/suffix resolution of ^ operator (i
   1
   2
 
+  $ try '(9^:)^:'
+  (rangepost
+    (parentpost
+      (group
+        (rangepost
+          (parentpost
+            ('symbol', '9'))))))
+  * set:
+  <spanset+ 4:9>
+  4
+  5
+  6
+  7
+  8
+  9
+
  x^ in alias should also be resolved
 
   $ try 'A' --config 'revsetalias.A=1^:2'


More information about the Mercurial-devel mailing list