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
--- 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)``