Mercurial > hg
changeset 21217:2195ac506c6a stable 3.0
revset: directly use __contains__ instead of a lambda
We get rid of lambda in a bunch of other place. This is equivalent and much
faster. (no new timing as this is the same change as three other changesets)
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 01 May 2014 14:07:04 -0700 |
parents | 6d632cf8a811 |
children | 95671eead199 |
files | mercurial/revset.py |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Thu May 01 14:33:06 2014 -0500 +++ b/mercurial/revset.py Thu May 01 14:07:04 2014 -0700 @@ -283,7 +283,7 @@ r = spanset(repo) xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y)) s = subset.set() - return xs.filter(lambda r: r in s) + return xs.filter(s.__contains__) def andset(repo, subset, x, y): return getset(repo, getset(repo, subset, x), y) @@ -348,7 +348,7 @@ if not args: return baseset([]) s = _revancestors(repo, args, followfirst) - return subset.filter(lambda r: r in s) + return subset.filter(s.__contains__) def ancestors(repo, subset, x): """``ancestors(set)`` @@ -376,7 +376,7 @@ for i in range(n): r = cl.parentrevs(r)[0] ps.add(r) - return subset.filter(lambda r: r in ps) + return subset.filter(ps.__contains__) def author(repo, subset, x): """``author(string)`` @@ -406,7 +406,7 @@ exclude = getset(repo, spanset(repo), args[1]) results = set(ancestormod.missingancestors(include, exclude, cl.parentrevs)) - return lazyset(subset, lambda x: x in results) + return lazyset(subset, results.__contains__) def bisect(repo, subset, x): """``bisect(string)`` @@ -423,7 +423,7 @@ # i18n: "bisect" is a keyword status = getstring(x, _("bisect requires a string")).lower() state = set(hbisect.get(repo, status)) - return subset.filter(lambda r: r in state) + return subset.filter(state.__contains__) # Backward-compatibility # - no help entry so that we do not advertise it any more @@ -466,7 +466,7 @@ bms = set([repo[r].rev() for r in repo._bookmarks.values()]) - return subset.filter(lambda r: r in bms) + return subset.filter(bms.__contains__) def branch(repo, subset, x): """``branch(string or set)`` @@ -725,7 +725,7 @@ r = src src = _getrevsource(repo, r) - return subset.filter(lambda r: r in dests) + return subset.filter(dests.__contains__) def divergent(repo, subset, x): """``divergent()`` @@ -734,7 +734,7 @@ # i18n: "divergent" is a keyword getargs(x, 0, 0, _("divergent takes no arguments")) divergent = obsmod.getrevs(repo, 'divergent') - return subset.filter(lambda r: r in divergent) + return subset.filter(divergent.__contains__) def draft(repo, subset, x): """``draft()`` @@ -811,7 +811,7 @@ for fr in fl: s.add(fl.linkrev(fr)) - return subset.filter(lambda r: r in s) + return subset.filter(s.__contains__) def first(repo, subset, x): """``first(set, [n])`` @@ -834,7 +834,7 @@ else: s = _revancestors(repo, baseset([c.rev()]), followfirst) - return subset.filter(lambda r: r in s) + return subset.filter(s.__contains__) def follow(repo, subset, x): """``follow([file])`` @@ -1176,7 +1176,7 @@ src = prev o = set([_firstsrc(r) for r in args]) - return subset.filter(lambda r: r in o) + return subset.filter(o.__contains__) def outgoing(repo, subset, x): """``outgoing([path])`` @@ -1199,7 +1199,7 @@ repo.ui.popbuffer() cl = repo.changelog o = set([cl.rev(r) for r in outgoing.missing]) - return subset.filter(lambda r: r in o) + return subset.filter(o.__contains__) def p1(repo, subset, x): """``p1([set])``