[PATCH 12 of 14] revlog: generate full revisions for shallow nodes with no base

Vishakh H vsh426 at gmail.com
Fri Jul 16 02:15:20 CDT 2010


# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1279263210 -19800
# Node ID 896eb69fd908e63b2f5b34593da168fc35f49661
# Parent  3ba8f61d3793dbe0aad3fe8c7ab6e29fd7f53a2e
revlog: generate full revisions for shallow nodes with no base

whenever we encounter a revision whose diff parent is missing
include the whole revision instead of diff.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -35,6 +35,8 @@
 REVLOG_KNOWN_FLAGS = REVLOG_PUNCHED_FLAG
 REVLOGNG_FLAGS = REVLOGNGINLINEDATA | REVLOGSHALLOW
 
+PUNCHED_DATA = struct.pack(">l", -1)
+
 # amount of data read unconditionally, should be >= 4
 # when not inline: threshold for using lazy index
 _prereadsize = 1048576
@@ -1170,7 +1172,7 @@
             self._cache = (node, curr, text)
         return node
 
-    def group(self, nodelist, lookup, infocollect=None):
+    def group(self, nodelist, lookup, infocollect=None, shallownodes=[]):
         """Calculate a delta group, yielding a sequence of changegroup chunks
         (strings).
 
@@ -1195,6 +1197,7 @@
         # build deltas
         for d in xrange(len(revs) - 1):
             a, b = revs[d], revs[d + 1]
+            na = self.node(a)
             nb = self.node(b)
 
             if infocollect is not None:
@@ -1202,7 +1205,7 @@
 
             p = self.parents(nb)
             meta = nb + p[0] + p[1] + lookup(nb)
-            if a == -1:
+            if ((a == -1) or (shallownodes and (na not in shallownodes))):
                 d = self.revision(nb)
                 meta += mdiff.trivialdiffheader(len(d))
             else:


More information about the Mercurial-devel mailing list