Mercurial > hg-stable
changeset 18881:177774e4b04a
graft: find ancestors of destination lazily
When the revisions to graft are numerically close to the destination, this
avoids one walk up the DAG, which for a repository with over 470,000
changesets translates to around 1.1 seconds.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sat, 06 Apr 2013 20:05:17 -0700 |
parents | 3cfaace0441e |
children | ce8c169a0dec |
files | mercurial/commands.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Apr 04 20:22:29 2013 -0700 +++ b/mercurial/commands.py Sat Apr 06 20:05:17 2013 -0700 @@ -2917,9 +2917,13 @@ return -1 # check for ancestors of dest branch - for rev in repo.revs('::. and %ld', revs): - ui.warn(_('skipping ancestor revision %s\n') % rev) - revs.remove(rev) + crev = repo['.'].rev() + ancestors = repo.changelog.ancestors([crev], inclusive=True) + # don't mutate while iterating, create a copy + for rev in list(revs): + if rev in ancestors: + ui.warn(_('skipping ancestor revision %s\n') % rev) + revs.remove(rev) if not revs: return -1