diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -42,6 +42,15 @@ class filelog: opts = opener.options self._fix_issue6528 = opts.get(b'issue6528.fix-incoming', True) + def get_revlog(self): + """return an actual revlog instance if any + + This exist because a lot of code leverage the fact the underlying + storage is a revlog for optimization, so giving simple way to access + the revlog instance helps such code. + """ + return self._revlog + def __len__(self): return len(self._revlog) diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py +++ b/mercurial/interfaces/repository.py @@ -1404,6 +1404,14 @@ class imanifeststorage(interfaceutil.Int This one behaves the same way, except for manifest data. """ + def get_revlog(): + """return an actual revlog instance if any + + This exist because a lot of code leverage the fact the underlying + storage is a revlog for optimization, so giving simple way to access + the revlog instance helps such code. + """ + class imanifestlog(interfaceutil.Interface): """Interface representing a collection of manifest snapshots. diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1617,6 +1617,15 @@ class manifestrevlog: self.index = self._revlog.index self._generaldelta = self._revlog._generaldelta + def get_revlog(self): + """return an actual revlog instance if any + + This exist because a lot of code leverage the fact the underlying + storage is a revlog for optimization, so giving simple way to access + the revlog instance helps such code. + """ + return self._revlog + def _setupmanifestcachehooks(self, repo): """Persist the manifestfulltextcache on lock release""" if not util.safehasattr(repo, '_wlockref'): diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -663,6 +663,10 @@ class revlog: # revlog header -> revlog compressor self._decompressors = {} + def get_revlog(self): + """simple function to mirror API of other not-really-revlog API""" + return self + @util.propertycache def revlog_kind(self): return self.target[0]