# HG changeset patch # User Martin von Zweigbergk # Date 2015-03-28 03:41:30 # Node ID b538ae24aa975785f1cf829a7749e66535d1c481 # Parent 8aead3bc5ff83ac39856ccd98654c86f534244ab 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). diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -613,7 +613,21 @@ class manifest(revlog.revlog): 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)