Patchwork [2,of,2] revset: drop special case of 'revset(...)' function in analyze

login
register
mail settings
Submitter Boris Feld
Date Oct. 16, 2018, 10:09 a.m.
Message ID <c1241e62986a91ebaf5a.1539684542@localhost.localdomain>
Download mbox | patch
Permalink /patch/36036/
State Accepted
Headers show

Comments

Boris Feld - Oct. 16, 2018, 10:09 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1539220504 -7200
#      Thu Oct 11 03:15:04 2018 +0200
# Node ID c1241e62986a91ebaf5a421c6d78560113be7111
# Parent  16ae7c19c2a2bb89ad4d201630cd87f6c635b7e0
# EXP-Topic revset-doc
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c1241e62986a
revset: drop special case of 'revset(...)' function in analyze

We now have a valid no-op function. We no longer need the special case.

Patch

diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -355,9 +355,6 @@  def _analyze(x):
     elif op == 'keyvalue':
         return (op, x[1], _analyze(x[2]))
     elif op == 'func':
-        f = getsymbol(x[1])
-        if f == 'revset':
-            return _analyze(x[2])
         return (op, x[1], _analyze(x[2]))
     raise ValueError('invalid operator %r' % op)
 
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -2926,16 +2926,20 @@  test multiline revset with errors
         (symbol '0'))))
   * analyzed:
   (func
-    (symbol 'first')
+    (symbol 'revset')
     (func
-      (symbol 'rev')
-      (symbol '0')))
+      (symbol 'first')
+      (func
+        (symbol 'rev')
+        (symbol '0'))))
   * optimized:
   (func
-    (symbol 'first')
+    (symbol 'revset')
     (func
-      (symbol 'rev')
-      (symbol '0')))
+      (symbol 'first')
+      (func
+        (symbol 'rev')
+        (symbol '0'))))
   * set:
   <baseset+ [0]>
   0