changeset 18882:ce8c169a0dec

graft: use missing ancestors algorithm to find earlier grafts When the revisions to graft are numerically close to the destination, this avoids two walks up the DAG, which for a repository with over 470,000 changesets translates to around 2.2 seconds.
author Siddharth Agarwal <sid0@fb.com>
date Sat, 06 Apr 2013 19:50:03 -0700
parents 177774e4b04a
children 667441789d25
files mercurial/commands.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Apr 06 20:05:17 2013 -0700
+++ b/mercurial/commands.py	Sat Apr 06 19:50:03 2013 -0700
@@ -2937,7 +2937,9 @@
 
     # check ancestors for earlier grafts
     ui.debug('scanning for duplicate grafts\n')
-    for ctx in repo.set("::. - ::%ld", revs):
+
+    for rev in repo.changelog.findmissingrevs(revs, [crev]):
+        ctx = repo[rev]
         n = ctx.extra().get('source')
         if n in ids:
             r = repo[n].rev()
@@ -2951,7 +2953,7 @@
         elif ctx.hex() in ids:
             r = ids[ctx.hex()]
             ui.warn(_('skipping already grafted revision %s '
-                            '(was grafted from %d)\n') % (r, ctx.rev()))
+                            '(was grafted from %d)\n') % (r, rev))
             revs.remove(r)
     if not revs:
         return -1