# HG changeset patch # User Lucas Moscovicz # Date 1391532667 28800 # Node ID 8dabcc889e3329ff3c5f2cbd4eda859a7712124c # Parent ed7b674824a3e1f0fdbdc815bbf87b82999c3d73 revset: added lazyset implementation to _matchfiles Performance Benchmarking: $ time hg log -qr "first(file(README))" 0:9117c6561b0b real 0m2.234s user 0m2.180s sys 0m0.044s $ time ./hg log -qr "first(file(README))" 0:9117c6561b0b real 0m0.172s user 0m0.129s sys 0m0.042s diff -r ed7b674824a3 -r 8dabcc889e33 mercurial/revset.py --- a/mercurial/revset.py Fri Jan 31 10:47:51 2014 -0800 +++ b/mercurial/revset.py Tue Feb 04 08:51:07 2014 -0800 @@ -857,10 +857,10 @@ hasset = True if not default: default = 'glob' - m = None - s = [] - for r in subset: - c = repo[r] + + def matches(x): + m = None + c = repo[x] if not m or (hasset and rev is None): ctx = c if rev is not None: @@ -869,9 +869,10 @@ exclude=exc, ctx=ctx, default=default) for f in c.files(): if m(f): - s.append(r) - break - return baseset(s) + return True + return False + + return lazyset(subset, matches) def hasfile(repo, subset, x): """``file(pattern)``