diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -353,7 +353,7 @@ p2 = node if self.filemapmode and nparents == 1: - man = self.repo.manifestlog._revlog + man = self.repo.manifestlog.getstorage(b'') mnode = self.repo.changelog.read(nodemod.bin(p2))[0] closed = 'close' in commit.extra if not closed and not man.cmp(m1node, man.revision(mnode)): diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -253,8 +253,7 @@ # be empty during the pull self.manifestheader() deltas = self.deltaiter() - # TODO this violates storage abstraction. - repo.manifestlog._revlog.addgroup(deltas, revmap, trp) + repo.manifestlog.getstorage(b'').addgroup(deltas, revmap, trp) prog.complete() self.callback = None @@ -485,9 +484,8 @@ # If we get here, there are directory manifests in the changegroup d = chunkdata["filename"] repo.ui.debug("adding %s revisions\n" % d) - dirlog = repo.manifestlog._revlog.dirlog(d) deltas = self.deltaiter() - if not dirlog.addgroup(deltas, revmap, trp): + if not repo.manifestlog.getstorage(d).addgroup(deltas, revmap, trp): raise error.Abort(_("received dir revlog group is empty")) class headerlessfixup(object): @@ -1019,7 +1017,6 @@ """ repo = self._repo mfl = repo.manifestlog - dirlog = mfl._revlog.dirlog tmfnodes = {'': manifests} # Callback for the manifest, used to collect linkrevs for filelog @@ -1066,7 +1063,7 @@ while tmfnodes: tree, nodes = tmfnodes.popitem() - store = dirlog(tree) + store = mfl.getstorage(tree) if not self._filematcher.visitdir(store._tree[:-1] or '.'): prunednodes = [] diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1083,11 +1083,11 @@ "treemanifest enabled")) if not dir.endswith('/'): dir = dir + '/' - dirlog = repo.manifestlog._revlog.dirlog(dir) + dirlog = repo.manifestlog.getstorage(dir) if len(dirlog): r = dirlog elif mf: - r = repo.manifestlog._revlog + r = repo.manifestlog.getstorage(b'') elif file_: filelog = repo.file(file_) if len(filelog): diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1486,7 +1486,7 @@ def debugmanifestfulltextcache(ui, repo, add=None, **opts): """show, clear or amend the contents of the manifest fulltext cache""" with repo.lock(): - r = repo.manifestlog._revlog + r = repo.manifestlog.getstorage(b'') try: cache = r._fulltextcache except AttributeError: diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1452,7 +1452,7 @@ if tree: if self._revlog._treeondisk: if verify: - dirlog = self._revlog.dirlog(tree) + dirlog = self.getstorage(tree) if node not in dirlog.nodemap: raise LookupError(node, dirlog.indexfile, _('no node')) @@ -1479,6 +1479,9 @@ mancache[node] = m return m + def getstorage(self, tree): + return self._revlog.dirlog(tree) + def clearcaches(self, clear_persisted_data=False): self._dirmancache.clear() self._revlog.clearcaches(clear_persisted_data=clear_persisted_data) @@ -1638,7 +1641,7 @@ if not narrowmatch.always(): if not narrowmatch.visitdir(self._dir[:-1] or '.'): return excludedmanifestrevlog(self._dir) - return self._manifestlog._revlog.dirlog(self._dir) + return self._manifestlog.getstorage(self._dir) def read(self): if self._data is None: diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -81,7 +81,7 @@ return [revlog.linkrev(r) for r in brokenset] def _collectmanifest(repo, striprev): - return _collectrevlog(repo.manifestlog._revlog, striprev) + return _collectrevlog(repo.manifestlog.getstorage(b''), striprev) def _collectbrokencsets(repo, files, striprev): """return the changesets which will be broken by the truncation""" @@ -322,7 +322,7 @@ callback.addnodes(nodelist) def stripmanifest(repo, striprev, tr, files): - revlog = repo.manifestlog._revlog + revlog = repo.manifestlog.getstorage(b'') revlog.strip(striprev, tr) striptrees(repo, tr, striprev, files) @@ -333,7 +333,7 @@ if (unencoded.startswith('meta/') and unencoded.endswith('00manifest.i')): dir = unencoded[5:-12] - repo.manifestlog._revlog.dirlog(dir).strip(striprev, tr) + repo.manifestlog.getstorage(dir).strip(striprev, tr) def rebuildfncache(ui, repo): """Rebuilds the fncache file from repo history. diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -1023,6 +1023,15 @@ interface. """ + def getstorage(tree): + """Retrieve an interface to storage for a particular tree. + + If ``tree`` is the empty bytestring, storage for the root manifest will + be returned. Otherwise storage for a tree manifest is returned. + + TODO formalize interface for returned object. + """ + def clearcaches(): """Clear caches associated with this collection.""" diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -45,7 +45,7 @@ self.errors = 0 self.warnings = 0 self.havecl = len(repo.changelog) > 0 - self.havemf = len(repo.manifestlog._revlog) > 0 + self.havemf = len(repo.manifestlog.getstorage(b'')) > 0 self.revlogv1 = repo.changelog.version != revlog.REVLOGV0 self.lrugetctx = util.lrucachefunc(repo.__getitem__) self.refersmf = False @@ -205,7 +205,7 @@ ui = self.ui match = self.match mfl = self.repo.manifestlog - mf = mfl._revlog.dirlog(dir) + mf = mfl.getstorage(dir) if not dir: self.ui.status(_("checking manifests\n"))