Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 20445:507261c0914f
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
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Wed, 05 Feb 2014 16:12:03 -0800 |
parents | b68984d288d4 |
children | d258486604f4 |
comparison
equal
deleted
inserted
replaced
20444:1478a9ce6790 | 20445:507261c0914f |
---|---|
428 kind, pattern, matcher = _stringmatcher(b) | 428 kind, pattern, matcher = _stringmatcher(b) |
429 if kind == 'literal': | 429 if kind == 'literal': |
430 # note: falls through to the revspec case if no branch with | 430 # note: falls through to the revspec case if no branch with |
431 # this name exists | 431 # this name exists |
432 if pattern in repo.branchmap(): | 432 if pattern in repo.branchmap(): |
433 return baseset([r for r in subset if matcher(repo[r].branch())]) | 433 return lazyset(subset, lambda r: matcher(repo[r].branch())) |
434 else: | 434 else: |
435 return baseset([r for r in subset if matcher(repo[r].branch())]) | 435 return lazyset(subset, lambda r: matcher(repo[r].branch())) |
436 | 436 |
437 s = getset(repo, baseset(repo), x) | 437 s = getset(repo, baseset(repo), x) |
438 b = set() | 438 b = set() |
439 for r in s: | 439 for r in s: |
440 b.add(repo[r].branch()) | 440 b.add(repo[r].branch()) |
441 s = s.set() | 441 s = s.set() |
442 return baseset([r for r in subset if r in s or repo[r].branch() in b]) | 442 return lazyset(subset, lambda r: r in s or repo[r].branch() in b) |
443 | 443 |
444 def bumped(repo, subset, x): | 444 def bumped(repo, subset, x): |
445 """``bumped()`` | 445 """``bumped()`` |
446 Mutable changesets marked as successors of public changesets. | 446 Mutable changesets marked as successors of public changesets. |
447 | 447 |