[PATCH 3 of 4] changegroup: collect manifest and file nodes for shallow clone

Vishakh H vsh426 at gmail.com
Tue Aug 10 08:08:55 CDT 2010


# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1281445635 -19800
# Node ID fad9bbac7eea83282c1d807213702dc048fe3d34
# Parent  24bc8a82d4f7b4cff194b96c0e0c1601563b6eee
changegroup: collect manifest and file nodes for shallow clone

if the changegroup is being calculated for shallow clone then collect
changedfiles and manifests when changelog node is needed in the shallow clone.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -56,13 +56,14 @@
     "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
 }
 
-def collector(cl, mmfs, files):
+def collector(cl, mmfs, files, sh_cl=None):
     # Gather information about changeset nodes going out in a bundle.
     # We want to gather manifests needed and filelogs affected.
     def collect(node):
         c = cl.read(node)
-        files.update(c[3])
-        mmfs.setdefault(c[0], node)
+        if not sh_cl or node in sh_cl:
+            files.update(c[3])
+            mmfs.setdefault(c[0], node)
     return collect
 
 # hgweb uses this list to communicate its preferred type


More information about the Mercurial-devel mailing list