Mercurial > hg
comparison mercurial/commands.py @ 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 | f02045645d12 |
children | ce8c169a0dec |
comparison
equal
deleted
inserted
replaced
18878:3cfaace0441e | 18881:177774e4b04a |
---|---|
2915 revs.remove(rev) | 2915 revs.remove(rev) |
2916 if not revs: | 2916 if not revs: |
2917 return -1 | 2917 return -1 |
2918 | 2918 |
2919 # check for ancestors of dest branch | 2919 # check for ancestors of dest branch |
2920 for rev in repo.revs('::. and %ld', revs): | 2920 crev = repo['.'].rev() |
2921 ui.warn(_('skipping ancestor revision %s\n') % rev) | 2921 ancestors = repo.changelog.ancestors([crev], inclusive=True) |
2922 revs.remove(rev) | 2922 # don't mutate while iterating, create a copy |
2923 for rev in list(revs): | |
2924 if rev in ancestors: | |
2925 ui.warn(_('skipping ancestor revision %s\n') % rev) | |
2926 revs.remove(rev) | |
2923 if not revs: | 2927 if not revs: |
2924 return -1 | 2928 return -1 |
2925 | 2929 |
2926 # analyze revs for earlier grafts | 2930 # analyze revs for earlier grafts |
2927 ids = {} | 2931 ids = {} |