[PATCH] revset: added _hexlist method to replace _list for %ln
Lucas Moscovicz
lmoscovicz at fb.com
Wed Feb 26 19:19:22 CST 2014
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz at fb.com>
# Date 1393463755 28800
# Wed Feb 26 17:15:55 2014 -0800
# Node ID 34bf12ea670796e0da95f44bf4ef95c1e0da8fd2
# Parent d9cf5e6843d7b15fe82ab0cd64a614489ff590da
revset: added _hexlist method to replace _list for %ln
Now %ln expression goes through _hexlist and doesn't do any unnecesary
processing anymore.
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1589,6 +1589,16 @@
s = subset.set()
return baseset([r for r in ls if r in s])
+# for internal use
+def _hexlist(repo, subset, x):
+ s = getstring(x, "internal error")
+ if not s:
+ return baseset([])
+ cl = repo.changelog
+ ls = [cl.rev(node.bin(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,
@@ -1657,6 +1667,7 @@
"unstable": unstable,
"_list": _list,
"_intlist": _intlist,
+ "_hexlist": _hexlist,
}
# symbols which can't be used for a DoS attack for any given input
@@ -1728,6 +1739,7 @@
"unstable",
"_list",
"_intlist",
+ "_hexlist",
])
methods = {
@@ -2038,7 +2050,7 @@
elif t == 's':
return "_list('%s')" % "\0".join(s)
elif t == 'n':
- return "_list('%s')" % "\0".join(node.hex(a) for a in s)
+ return "_hexlist('%s')" % "\0".join(node.hex(a) for a in s)
elif t == 'b':
return "_list('%s')" % "\0".join(a.branch() for a in s)
More information about the Mercurial-devel
mailing list