[PATCH 08 of 14] changelog: add support for shallowroot

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


# HG changeset patch
# User Vishakh H <vsh426 at gmail.com>
# Date 1279263210 -19800
# Node ID 0218b69c65e2014af11f287cac005ffd206d45c5
# Parent  8a0c8d3600e2cbd14e2ddf5353ca58b038187be0
changelog: add support for shallowroot

cleate list of shallownodes and check if manifest node requested is available
else return null manifest id.

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -98,11 +98,16 @@
     return o
 
 class changelog(revlog.revlog):
-    def __init__(self, opener):
-        revlog.revlog.__init__(self, opener, "00changelog.i")
+    def __init__(self, opener, shallowroot):
+        revlog.revlog.__init__(self, opener, "00changelog.i",
+                               shallow=shallowroot)
         self._realopener = opener
         self._delayed = False
         self._divert = False
+        if self._shallow and shallowroot in self.nodemap:
+            self._shallownodes.add(shallowroot)
+            self._shallownodes.update(map(self.node,
+                                self.descendants(self.rev(self._shallowroot))))
 
     def delayupdate(self):
         "delay visibility of index updates to other readers"
@@ -176,7 +181,10 @@
         last = text.index("\n\n")
         desc = encoding.tolocal(text[last + 2:])
         l = text[:last].split('\n')
-        manifest = bin(l[0])
+        if self._shallow and node not in self._shallownodes:
+            manifest = nullid
+        else:
+            manifest = bin(l[0])
         user = encoding.tolocal(l[1])
 
         extra_data = l[2].split(' ', 2)


More information about the Mercurial-devel mailing list