[PATCH] revset: added _intlist method to replace _list for %ld
Lucas Moscovicz
lmoscovicz at fb.com
Wed Feb 26 14:43:00 CST 2014
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz at fb.com>
# Date 1393446996 28800
# Wed Feb 26 12:36:36 2014 -0800
# Node ID d9cf5e6843d7b15fe82ab0cd64a614489ff590da
# Parent e1b82805679d24f3de891162d780971da4e8e151
revset: added _intlist method to replace _list for %ld
Now %ld expression goes through _intlist and doesn't do any unnecesary
processing anymore.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -428,7 +428,7 @@
'''Return a list of revisions matching the given revset'''
expr = revset.formatspec(expr, *args)
m = revset.match(None, expr)
- return revset.baseset([r for r in m(self, revset.baseset(self))])
+ return m(self, revset.spanset(self))
def set(self, expr, *args):
'''
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -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':
More information about the Mercurial-devel
mailing list