rebase: use lazy ancestor membership testing
For a repository with over 400,000 commits, rebasing one revision near tip,
this avoids one walk up the DAG, speeding the operation up by around 0.8
seconds.
--- a/hgext/rebase.py Mon Dec 17 20:43:37 2012 -0800
+++ b/hgext/rebase.py Mon Dec 17 20:51:21 2012 -0800
@@ -214,8 +214,8 @@
else:
originalwd, target, state = result
if collapsef:
- targetancestors = set(repo.changelog.ancestors([target]))
- targetancestors.add(target)
+ targetancestors = repo.changelog.ancestors([target],
+ inclusive=True)
external = checkexternal(repo, state, targetancestors)
if keepbranchesf:
@@ -233,8 +233,7 @@
# Rebase
if not targetancestors:
- targetancestors = set(repo.changelog.ancestors([target]))
- targetancestors.add(target)
+ targetancestors = repo.changelog.ancestors([target], inclusive=True)
# Keep track of the current bookmarks in order to reset them later
currentbookmarks = repo._bookmarks.copy()