# HG changeset patch # User Durham Goode # Date 1478131847 25200 # Node ID f65faa4422c8d819b087c38474cbb0ba40101bb2 # Parent bce79dfcf5e4692f4a9e614e4e5a7e22dddca18a manifest: remove manifest.readshallowdelta This removes manifest.readshallowdelta and converts its one consumer to use manifestlog instead. diff -r bce79dfcf5e4 -r f65faa4422c8 mercurial/manifest.py --- a/mercurial/manifest.py Wed Nov 02 17:10:47 2016 -0700 +++ b/mercurial/manifest.py Wed Nov 02 17:10:47 2016 -0700 @@ -1365,6 +1365,12 @@ return self.read() def readdelta(self, shallow=False): + '''Returns a manifest containing just the entries that are present + in this manifest, but not in its p1 manifest. This is efficient to read + if the revlog delta is already p1. + + Changing the value of `shallow` has no effect on flat manifests. + ''' revlog = self._repo.manifestlog._revlog if revlog._usemanifestv2: # Need to perform a slow delta @@ -1427,6 +1433,16 @@ return self._node def readdelta(self, shallow=False): + '''Returns a manifest containing just the entries that are present + in this manifest, but not in its p1 manifest. This is efficient to read + if the revlog delta is already p1. + + If `shallow` is True, this will read the delta for this directory, + without recursively reading subdirectory manifests. Instead, any + subdirectory entry will be reported as it appears in the manifest, i.e. + the subdirectory will be reported among files and distinguished only by + its 't' flag. + ''' revlog = self._revlog() if shallow and not revlog._usemanifestv2: r = revlog.rev(self._node) @@ -1500,41 +1516,6 @@ self._dirlogcache) return self._dirlogcache[dir] - 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 or self._treeondisk: - return self._slowreaddelta(node) - r = self.rev(node) - d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r)) - return self._newmanifest(d) - - def readshallowdelta(self, node): - '''For flat manifests, this is the same as readdelta(). For - treemanifests, this will read the delta for this revlog's directory, - without recursively reading subdirectory manifests. Instead, any - subdirectory entry will be reported as it appears in the manifests, i.e. - the subdirectory will be reported among files and distinguished only by - its 't' flag.''' - if not self._treeondisk: - return self.readdelta(node) - if self._usemanifestv2: - raise error.Abort( - _("readshallowdelta() not implemented for manifestv2")) - r = self.rev(node) - d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r)) - return manifestdict(d) - def read(self, node): if node == revlog.nullid: return self._newmanifest() # don't upset local cache diff -r bce79dfcf5e4 -r f65faa4422c8 mercurial/verify.py --- a/mercurial/verify.py Wed Nov 02 17:10:47 2016 -0700 +++ b/mercurial/verify.py Wed Nov 02 17:10:47 2016 -0700 @@ -201,7 +201,8 @@ progress=None): repo = self.repo ui = self.ui - mf = self.repo.manifest.dirlog(dir) + mfl = self.repo.manifestlog + mf = mfl._revlog.dirlog(dir) if not dir: self.ui.status(_("checking manifests\n")) @@ -235,7 +236,8 @@ self.err(lr, _("%s not in changesets") % short(n), label) try: - for f, fn, fl in mf.readshallowdelta(n).iterentries(): + mfdelta = mfl.get(dir, n).readdelta(shallow=True) + for f, fn, fl in mfdelta.iterentries(): if not f: self.err(lr, _("entry without name in manifest")) elif f == "/dev/null": # ignore this in very old repos