manifest: backed out changeset b60a5fe98b73
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sat, 10 Sep 2016 01:41:38 +0200
changeset 29915 548fa75cdb07
parent 29914 770128405002
child 29916 8a658b8b795a
manifest: backed out changeset b60a5fe98b73 There is some suspicious failure in evolution tests. This changeset was supposed to be dropped until we investigate.
mercurial/context.py
mercurial/manifest.py
--- a/mercurial/context.py	Sun Aug 21 12:36:23 2016 +0900
+++ b/mercurial/context.py	Sat Sep 10 01:41:38 2016 +0200
@@ -528,7 +528,7 @@
 
     @propertycache
     def _manifest(self):
-        return self._repo.manifestlog[self._changeset.manifest].read()
+        return self._repo.manifestlog[self._changeset.manifest]
 
     @propertycache
     def _manifestdelta(self):
--- a/mercurial/manifest.py	Sun Aug 21 12:36:23 2016 +0900
+++ b/mercurial/manifest.py	Sat Sep 10 01:41:38 2016 +0200
@@ -962,13 +962,12 @@
             self._mancache[node] = m
         return m
 
-class manifestctx(object):
+class manifestctx(manifestdict):
     """A class representing a single revision of a manifest, including its
     contents, its parent revs, and its linkrev.
     """
     def __init__(self, revlog, node):
         self._revlog = revlog
-        self._data = None
 
         self._node = node
 
@@ -979,26 +978,21 @@
         #rev = revlog.rev(node)
         #self.linkrev = revlog.linkrev(rev)
 
+        # This should eventually be made lazy loaded, so consumers can access
+        # the node/p1/linkrev data without having to parse the whole manifest.
+        data = revlog.revision(node)
+        arraytext = array.array('c', data)
+        revlog._fulltextcache[node] = arraytext
+        super(manifestctx, self).__init__(data)
+
     def node(self):
         return self._node
 
-    def read(self):
-        if not self._data:
-            if self._node == revlog.nullid:
-                self._data = manifestdict()
-            else:
-                text = self._revlog.revision(self._node)
-                arraytext = array.array('c', text)
-                self._revlog._fulltextcache[self._node] = arraytext
-                self._data = manifestdict(text)
-        return self._data
-
-class treemanifestctx(object):
+class treemanifestctx(treemanifest):
     def __init__(self, revlog, dir, node):
         revlog = revlog.dirlog(dir)
         self._revlog = revlog
         self._dir = dir
-        self._data = None
 
         self._node = node
 
@@ -1009,26 +1003,19 @@
         #rev = revlog.rev(node)
         #self.linkrev = revlog.linkrev(rev)
 
-    def read(self):
-        if not self._data:
-            if self._node == revlog.nullid:
-                self._data = treemanifest()
-            elif self._revlog._treeondisk:
-                m = treemanifest(dir=self._dir)
-                def gettext():
-                    return self._revlog.revision(self._node)
-                def readsubtree(dir, subm):
-                    return treemanifestctx(self._revlog, dir, subm).read()
-                m.read(gettext, readsubtree)
-                m.setnode(self._node)
-                self._data = m
-            else:
-                text = self._revlog.revision(self._node)
-                arraytext = array.array('c', text)
-                self._revlog.fulltextcache[self._node] = arraytext
-                self._data = treemanifest(dir=self._dir, text=text)
-
-        return self._data
+        if revlog._treeondisk:
+            super(treemanifestctx, self).__init__(dir=dir)
+            def gettext():
+                return revlog.revision(node)
+            def readsubtree(dir, subm):
+                return revlog.dirlog(dir).read(subm)
+            self.read(gettext, readsubtree)
+            self.setnode(node)
+        else:
+            text = revlog.revision(node)
+            arraytext = array.array('c', text)
+            revlog.fulltextcache[node] = arraytext
+            super(treemanifestctx, self).__init__(dir=dir, text=text)
 
     def node(self):
         return self._node