[PATCH 1 of 4] revlog: generate full revisions when parent node is missing

Vishakh H vsh426 at gmail.com
Thu Aug 12 10:39:47 CDT 2010


# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1281627410 -19800
# Node ID f003541038c2d149eb697dd00d85f3b56632999b
# Parent  6a5e159eb93ed120407e533bda4eceb0cf7f0435
revlog: generate full revisions when parent node is missing

The full revision is sent if the first parent, against which diff is calculated, is
missing at remote. This happens in the case of shallow clones.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1172,7 +1172,7 @@
             self._cache = (node, curr, text)
         return node
 
-    def group(self, nodelist, lookup, infocollect=None):
+    def group(self, nodelist, lookup, infocollect=None, fullrev=False):
         """Calculate a delta group, yielding a sequence of changegroup chunks
         (strings).
 
@@ -1204,9 +1204,10 @@
 
             p = self.parents(nb)
             meta = nb + p[0] + p[1] + lookup(nb)
-            if a == -1:
+            if fullrev:
                 d = self.revision(nb)
                 meta += mdiff.trivialdiffheader(len(d))
+                fullrev = False
             else:
                 d = self.revdiff(a, b)
             yield changegroup.chunkheader(len(meta) + len(d))


More information about the Mercurial-devel mailing list