Patchwork revset: remove unused 'only' from methods table

login
register
mail settings
Submitter Yuya Nishihara
Date May 15, 2015, 2:52 p.m.
Message ID <20150515235253.afff5362f2d09c3355341522@tcha.org>
Download mbox | patch
Permalink /patch/9099/
State Accepted
Headers show

Comments

Yuya Nishihara - May 15, 2015, 2:52 p.m.
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@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.
Pierre-Yves David - May 15, 2015, 5:28 p.m.
On 05/15/2015 07:52 AM, Yuya Nishihara wrote:
> 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@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.


I've pushed this one to default. Thanks
Special credit for splitting this into two.

Patch

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