From patchwork Thu Feb 27 01:19:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: revset: added _hexlist method to replace _list for %ln From: Lucas Moscovicz X-Patchwork-Id: 3781 Message-Id: <34bf12ea670796e0da95.1393463962@dev1037.prn2.facebook.com> To: mercurial-devel@selenic.com Date: Wed, 26 Feb 2014 17:19:22 -0800 # HG changeset patch # User Lucas Moscovicz # 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)