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

login
register
mail settings
Submitter Siddharth Agarwal
Date Dec. 15, 2012, 12:13 a.m.
Message ID <b29bbee669ad1b035641.1355530434@sid0x220>
Download mbox | patch
Permalink /patch/116/
State Superseded
Headers show

Comments

Siddharth Agarwal - Dec. 15, 2012, 12:13 a.m.
# 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.

Patch

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):