##// END OF EJS Templates
bundlerevlog: extract 'baserevision' method...
Wojciech Lopata -
r19629:81241f97 default
parent child Browse files
Show More
@@ -120,7 +120,7 b' class bundlerevlog(revlog.revlog):'
120 chain.append(iterrev)
120 chain.append(iterrev)
121 iterrev = self.index[iterrev][3]
121 iterrev = self.index[iterrev][3]
122 if text is None:
122 if text is None:
123 text = revlog.revlog.revision(self, iterrev)
123 text = self.baserevision(iterrev)
124
124
125 while chain:
125 while chain:
126 delta = self._chunk(chain.pop())
126 delta = self._chunk(chain.pop())
@@ -130,6 +130,12 b' class bundlerevlog(revlog.revlog):'
130 self._cache = (node, rev, text)
130 self._cache = (node, rev, text)
131 return text
131 return text
132
132
133 def baserevision(self, nodeorrev):
134 # Revlog subclasses may override 'revision' method to modify format of
135 # content retrieved from revlog. To use bundlerevlog with such class one
136 # needs to override 'baserevision' and make more specific call here.
137 return revlog.revlog.revision(self, nodeorrev)
138
133 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
139 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
134 raise NotImplementedError
140 raise NotImplementedError
135 def addgroup(self, revs, linkmapper, transaction):
141 def addgroup(self, revs, linkmapper, transaction):
@@ -146,12 +152,21 b' class bundlechangelog(bundlerevlog, chan'
146 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
152 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
147 linkmapper)
153 linkmapper)
148
154
155 def baserevision(self, nodeorrev):
156 # Although changelog doesn't override 'revision' method, some extensions
157 # may replace this class with another that does. Same story with
158 # manifest and filelog classes.
159 return changelog.changelog.revision(self, nodeorrev)
160
149 class bundlemanifest(bundlerevlog, manifest.manifest):
161 class bundlemanifest(bundlerevlog, manifest.manifest):
150 def __init__(self, opener, bundle, linkmapper):
162 def __init__(self, opener, bundle, linkmapper):
151 manifest.manifest.__init__(self, opener)
163 manifest.manifest.__init__(self, opener)
152 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
164 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
153 linkmapper)
165 linkmapper)
154
166
167 def baserevision(self, nodeorrev):
168 return manifest.manifest.revision(self, nodeorrev)
169
155 class bundlefilelog(bundlerevlog, filelog.filelog):
170 class bundlefilelog(bundlerevlog, filelog.filelog):
156 def __init__(self, opener, path, bundle, linkmapper, repo):
171 def __init__(self, opener, path, bundle, linkmapper, repo):
157 filelog.filelog.__init__(self, opener, path)
172 filelog.filelog.__init__(self, opener, path)
@@ -159,6 +174,9 b' class bundlefilelog(bundlerevlog, filelo'
159 linkmapper)
174 linkmapper)
160 self._repo = repo
175 self._repo = repo
161
176
177 def baserevision(self, nodeorrev):
178 return filelog.filelog.revision(self, nodeorrev)
179
162 def _file(self, f):
180 def _file(self, f):
163 self._repo.file(f)
181 self._repo.file(f)
164
182
General Comments 0
You need to be logged in to leave comments. Login now