revset: added lazyset implementation to branch revset
Performance Benchmarking:
$ time hg log -l1 -qr "branch(default)"
0:
9117c6561b0b
real 0m3.366s
user 0m3.217s
sys 0m0.095s
$ time ./hg log -l1 -qr "branch(default)"
0:
9117c6561b0b
real 0m0.389s
user 0m0.199s
sys 0m0.061s
--- a/mercurial/revset.py Tue Feb 11 01:15:07 2014 +0100
+++ b/mercurial/revset.py Wed Feb 05 16:12:03 2014 -0800
@@ -430,16 +430,16 @@
# note: falls through to the revspec case if no branch with
# this name exists
if pattern in repo.branchmap():
- return baseset([r for r in subset if matcher(repo[r].branch())])
+ return lazyset(subset, lambda r: matcher(repo[r].branch()))
else:
- return baseset([r for r in subset if matcher(repo[r].branch())])
+ return lazyset(subset, lambda r: matcher(repo[r].branch()))
s = getset(repo, baseset(repo), x)
b = set()
for r in s:
b.add(repo[r].branch())
s = s.set()
- return baseset([r for r in subset if r in s or repo[r].branch() in b])
+ return lazyset(subset, lambda r: r in s or repo[r].branch() in b)
def bumped(repo, subset, x):
"""``bumped()``