comparison mercurial/manifest.py @ 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 4daae7edf166
comparison
equal deleted inserted replaced
24527:8aead3bc5ff8 24528:b538ae24aa97
611 def _newmanifest(self, data=''): 611 def _newmanifest(self, data=''):
612 if self._usetreemanifest: 612 if self._usetreemanifest:
613 return treemanifest('', data) 613 return treemanifest('', data)
614 return manifestdict(data) 614 return manifestdict(data)
615 615
616 def _slowreaddelta(self, node):
617 r0 = self.deltaparent(self.rev(node))
618 m0 = self.read(self.node(r0))
619 m1 = self.read(node)
620 md = self._newmanifest()
621 for f, ((n0, fl0), (n1, fl1)) in m0.diff(m1).iteritems():
622 if n1:
623 md[f] = n1
624 if fl1:
625 md.setflag(f, fl1)
626 return md
627
616 def readdelta(self, node): 628 def readdelta(self, node):
629 if self._usemanifestv2:
630 return self._slowreaddelta(node)
617 r = self.rev(node) 631 r = self.rev(node)
618 d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r)) 632 d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r))
619 return self._newmanifest(d) 633 return self._newmanifest(d)
620 634
621 def readfast(self, node): 635 def readfast(self, node):