[PATCH] revset: remove unused 'only' from methods table

Yuya Nishihara yuya at tcha.org
Fri May 15 09:52:53 CDT 2015


This patch is related to "[PATCH STABLE] revset: map postfix '%' to only() to
optimize operand recursively (issue4670)", but for the default branch.

# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1431697104 -32400
#      Fri May 15 22:38:24 2015 +0900
# Node ID 43bb5b24f6d8c1ca11168d52a990839f7254571d
# Parent  8b99e9a8db05d77937a9905cc77e946171159acc
revset: remove unused 'only' from methods table

The infix 'only' operator is mapped to 'only()' function by optimize(), so
it won't be looked up as a method. The test shows it.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2097,7 +2097,6 @@ methods = {
     "ancestor": ancestorspec,
     "parent": parentspec,
     "parentpost": p1,
-    "only": only,
 }
 
 def optimize(x, small):
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -555,6 +555,24 @@ Test opreand of '%' is optimized recursi
   <baseset+ [8, 9]>
   8
   9
+  $ try --optimize '(9)%(5)'
+  (only
+    (group
+      ('symbol', '9'))
+    (group
+      ('symbol', '5')))
+  * optimized:
+  (func
+    ('symbol', 'only')
+    (list
+      ('symbol', '9')
+      ('symbol', '5')))
+  * set:
+  <baseset+ [8, 9, 2, 4]>
+  2
+  4
+  8
+  9
 
 Test the order of operations
 



More information about the Mercurial-devel mailing list