# HG changeset patch # User Lucas Moscovicz # Date 1391534085 28800 # Node ID 51890507c6b3be0b24afffaedd77a8ecd523ac9c # Parent 8dabcc889e3329ff3c5f2cbd4eda859a7712124c revset: added lazyset implementation to matching revset Performance Benchmarking: $ time hg log -qr "first(matching(0))" 0:9117c6561b0b real 0m2.213s user 0m2.149s sys 0m0.055s $ time ./hg log -qr "first(matching(0))" 0:9117c6561b0b real 0m0.177s user 0m0.137s sys 0m0.038s diff -r 8dabcc889e33 -r 51890507c6b3 mercurial/revset.py --- a/mercurial/revset.py Tue Feb 04 08:51:07 2014 -0800 +++ b/mercurial/revset.py Tue Feb 04 09:14:45 2014 -0800 @@ -1365,18 +1365,18 @@ # is only one field to match) getinfo = lambda r: [f(r) for f in getfieldfuncs] - matches = set() - for rev in revs: - target = getinfo(rev) - for r in subset: + def matches(x): + for rev in revs: + target = getinfo(rev) match = True for n, f in enumerate(getfieldfuncs): - if target[n] != f(r): + if target[n] != f(x): match = False - break if match: - matches.add(r) - return baseset([r for r in subset if r in matches]) + return True + return False + + return lazyset(subset, matches) def reverse(repo, subset, x): """``reverse(set)``