Submitter | Lucas Moscovicz |
---|---|
Date | Feb. 26, 2014, 8:43 p.m. |
Message ID | <d9cf5e6843d7b15fe82a.1393447380@dev1037.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/3773/ |
State | Accepted |
Commit | 98024950ade0a8b4a68a6ca048b805cbb8a203a3 |
Headers | show |
Comments
On Wed, 2014-02-26 at 12:43 -0800, Lucas Moscovicz wrote: > # HG changeset patch > # User Lucas Moscovicz <lmoscovicz@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)) This bit appears unrelated to $DESC, I've queued the rest of the patch.
Patch
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':