changeset 24528:b538ae24aa97

manifestv2: implement slow readdelta() without revdiff For manifest v2, revlog.revdiff() usually does not provide enough information to produce a manifest. As a simple workaround, implement readdelta() by reading both the old and the new manifest and use manifest.diff() to find the difference. This is several times slower than the current readdelta() for v1 manifests, but there seems to be no other simple option, and this is still much faster than returning the full manifest (at least for verify).
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 27 Mar 2015 20:41:30 -0700
parents 8aead3bc5ff8
children 14873da80bc1
files mercurial/manifest.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Fri Mar 27 17:07:24 2015 -0700
+++ b/mercurial/manifest.py	Fri Mar 27 20:41:30 2015 -0700
@@ -613,7 +613,21 @@
             return treemanifest('', data)
         return manifestdict(data)
 
+    def _slowreaddelta(self, node):
+        r0 = self.deltaparent(self.rev(node))
+        m0 = self.read(self.node(r0))
+        m1 = self.read(node)
+        md = self._newmanifest()
+        for f, ((n0, fl0), (n1, fl1)) in m0.diff(m1).iteritems():
+            if n1:
+                md[f] = n1
+                if fl1:
+                    md.setflag(f, fl1)
+        return md
+
     def readdelta(self, node):
+        if self._usemanifestv2:
+            return self._slowreaddelta(node)
         r = self.rev(node)
         d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r))
         return self._newmanifest(d)