[PATCH 4 of 5 V2] localrepo: use lazy ancestor sets

Siddharth Agarwal sid0 at fb.com
Fri Dec 14 18:13:54 CST 2012


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1355529168 28800
# Node ID b29bbee669ad1b035641d4b8490ad188ca0f3009
# Parent  a00028bfa9eeb2e39b2256e25792695463aa22d8
localrepo: use lazy ancestor sets

For a repository with over 400,000 commits, rebasing one revision near tip,
this avoids two treks up the DAG, speeding the operation up by around 1.6
seconds.

diff -r a00028bfa9ee -r b29bbee669ad mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri Dec 14 15:48:39 2012 -0800
+++ b/mercurial/localrepo.py	Fri Dec 14 15:52:48 2012 -0800
@@ -9,7 +9,7 @@
 import peer, changegroup, subrepo, discovery, pushkey, obsolete
 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
 import lock, transaction, store, encoding, base85
-import scmutil, util, extensions, hook, error, revset
+import scmutil, util, extensions, hook, error, revset, ancestor
 import match as matchmod
 import merge as mergemod
 import tags as tagsmod
@@ -2078,7 +2078,8 @@
             bases = [nullid]
         csets, bases, heads = cl.nodesbetween(bases, heads)
         # We assume that all ancestors of bases are known
-        common = set(cl.ancestors([cl.rev(n) for n in bases]))
+        common = ancestor.lazyancestorset(self, [cl.rev(n) for n in bases],
+                                          False)
         return self._changegroupsubset(common, csets, heads, source)
 
     def getlocalbundle(self, source, outgoing):


More information about the Mercurial-devel mailing list