changeset 20566:98024950ade0

revset: added _intlist method to replace _list for %ld Now %ld expression goes through _intlist and doesn't do any unnecesary processing anymore.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Wed, 26 Feb 2014 12:36:36 -0800
parents 0ad353831461
children de8eb208b7d0
files mercurial/revset.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Feb 24 18:50:29 2014 -0600
+++ b/mercurial/revset.py	Wed Feb 26 12:36:36 2014 -0800
@@ -1580,6 +1580,15 @@
     s = subset.set()
     return baseset([r for r in ls if r in s])
 
+# for internal use
+def _intlist(repo, subset, x):
+    s = getstring(x, "internal error")
+    if not s:
+        return baseset([])
+    ls = [int(r) for r in s.split('\0')]
+    s = subset.set()
+    return baseset([r for r in ls if r in s])
+
 symbols = {
     "adds": adds,
     "all": getall,
@@ -1647,6 +1656,7 @@
     "user": user,
     "unstable": unstable,
     "_list": _list,
+    "_intlist": _intlist,
 }
 
 # symbols which can't be used for a DoS attack for any given input
@@ -1717,6 +1727,7 @@
     "user",
     "unstable",
     "_list",
+    "_intlist",
 ])
 
 methods = {
@@ -2023,7 +2034,7 @@
         elif l == 1:
             return argtype(t, s[0])
         elif t == 'd':
-            return "_list('%s')" % "\0".join(str(int(a)) for a in s)
+            return "_intlist('%s')" % "\0".join(str(int(a)) for a in s)
         elif t == 's':
             return "_list('%s')" % "\0".join(s)
         elif t == 'n':