--- a/mercurial/bundlerepo.py Mon Aug 26 15:20:44 2013 -0700
+++ b/mercurial/bundlerepo.py Mon Aug 26 16:50:31 2013 -0700
@@ -120,7 +120,7 @@
chain.append(iterrev)
iterrev = self.index[iterrev][3]
if text is None:
- text = revlog.revlog.revision(self, iterrev)
+ text = self.baserevision(iterrev)
while chain:
delta = self._chunk(chain.pop())
@@ -130,6 +130,12 @@
self._cache = (node, rev, text)
return text
+ def baserevision(self, nodeorrev):
+ # Revlog subclasses may override 'revision' method to modify format of
+ # content retrieved from revlog. To use bundlerevlog with such class one
+ # needs to override 'baserevision' and make more specific call here.
+ return revlog.revlog.revision(self, nodeorrev)
+
def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
raise NotImplementedError
def addgroup(self, revs, linkmapper, transaction):
@@ -146,12 +152,21 @@
bundlerevlog.__init__(self, opener, self.indexfile, bundle,
linkmapper)
+ def baserevision(self, nodeorrev):
+ # Although changelog doesn't override 'revision' method, some extensions
+ # may replace this class with another that does. Same story with
+ # manifest and filelog classes.
+ return changelog.changelog.revision(self, nodeorrev)
+
class bundlemanifest(bundlerevlog, manifest.manifest):
def __init__(self, opener, bundle, linkmapper):
manifest.manifest.__init__(self, opener)
bundlerevlog.__init__(self, opener, self.indexfile, bundle,
linkmapper)
+ def baserevision(self, nodeorrev):
+ return manifest.manifest.revision(self, nodeorrev)
+
class bundlefilelog(bundlerevlog, filelog.filelog):
def __init__(self, opener, path, bundle, linkmapper, repo):
filelog.filelog.__init__(self, opener, path)
@@ -159,6 +174,9 @@
linkmapper)
self._repo = repo
+ def baserevision(self, nodeorrev):
+ return filelog.filelog.revision(self, nodeorrev)
+
def _file(self, f):
self._repo.file(f)