Patchwork [3,of,4,V3,part,2] localrepo: use lazy ancestor membership testing

login
register
mail settings
Submitter Siddharth Agarwal
Date Dec. 18, 2012, 5:30 a.m.
Message ID <952ec71894acfbd8ff7f.1355808612@sid0x220>
Download mbox | patch
Permalink /patch/184/
State Accepted
Commit ff36650e4238810e260e954fc55b9fa0be069f18
Headers show

Comments

Siddharth Agarwal - Dec. 18, 2012, 5:30 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1355805817 28800
# Node ID 952ec71894acfbd8ff7f9f831ce6a6d1060e5ccc
# Parent  379ba541bc8c1c1d0b014b073da1767a6f2fa17e
localrepo: use lazy ancestor membership testing

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 379ba541bc8c -r 952ec71894ac mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Dec 17 21:26:33 2012 -0800
+++ b/mercurial/localrepo.py	Mon Dec 17 20:43:37 2012 -0800
@@ -2081,7 +2081,7 @@ 
             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 = cl.ancestors([cl.rev(n) for n in bases])
         return self._changegroupsubset(common, csets, heads, source)
 
     def getlocalbundle(self, source, outgoing):