##// END OF EJS Templates
repoview: define filteredchangelog as a top-level (non-local) class...
Martin von Zweigbergk -
r43797:bad4a26b default
parent child Browse files
Show More
@@ -227,7 +227,14 b' def wrapchangelog(unfichangelog, filtere'
227 227 cl = copy.copy(unfichangelog)
228 228 cl.filteredrevs = filteredrevs
229 229
230 class filteredchangelog(cl.__class__):
230 cl.__class__ = type(
231 'filteredchangelog', (filteredchangelogmixin, cl.__class__), {}
232 )
233
234 return cl
235
236
237 class filteredchangelogmixin(object):
231 238 def tiprev(self):
232 239 """filtered version of revlog.tiprev"""
233 240 for i in pycompat.xrange(len(self) - 1, -2, -1):
@@ -250,7 +257,7 b' def wrapchangelog(unfichangelog, filtere'
250 257
251 258 def revs(self, start=0, stop=None):
252 259 """filtered version of revlog.revs"""
253 for i in super(filteredchangelog, self).revs(start, stop):
260 for i in super(filteredchangelogmixin, self).revs(start, stop):
254 261 if i not in self.filteredrevs:
255 262 yield i
256 263
@@ -285,17 +292,17 b' def wrapchangelog(unfichangelog, filtere'
285 292 return self._headrevs()
286 293
287 294 revs = self._checknofilteredinrevs(revs)
288 return super(filteredchangelog, self).headrevs(revs)
295 return super(filteredchangelogmixin, self).headrevs(revs)
289 296
290 297 def strip(self, *args, **kwargs):
291 298 # XXX make something better than assert
292 299 # We can't expect proper strip behavior if we are filtered.
293 300 assert not self.filteredrevs
294 super(filteredchangelog, self).strip(*args, **kwargs)
301 super(filteredchangelogmixin, self).strip(*args, **kwargs)
295 302
296 303 def rev(self, node):
297 304 """filtered version of revlog.rev"""
298 r = super(filteredchangelog, self).rev(node)
305 r = super(filteredchangelogmixin, self).rev(node)
299 306 if r in self.filteredrevs:
300 307 raise error.FilteredLookupError(
301 308 hex(node), self.indexfile, _(b'filtered node')
@@ -306,29 +313,25 b' def wrapchangelog(unfichangelog, filtere'
306 313 """filtered version of revlog.node"""
307 314 if rev in self.filteredrevs:
308 315 raise error.FilteredIndexError(rev)
309 return super(filteredchangelog, self).node(rev)
316 return super(filteredchangelogmixin, self).node(rev)
310 317
311 318 def linkrev(self, rev):
312 319 """filtered version of revlog.linkrev"""
313 320 if rev in self.filteredrevs:
314 321 raise error.FilteredIndexError(rev)
315 return super(filteredchangelog, self).linkrev(rev)
322 return super(filteredchangelogmixin, self).linkrev(rev)
316 323
317 324 def parentrevs(self, rev):
318 325 """filtered version of revlog.parentrevs"""
319 326 if rev in self.filteredrevs:
320 327 raise error.FilteredIndexError(rev)
321 return super(filteredchangelog, self).parentrevs(rev)
328 return super(filteredchangelogmixin, self).parentrevs(rev)
322 329
323 330 def flags(self, rev):
324 331 """filtered version of revlog.flags"""
325 332 if rev in self.filteredrevs:
326 333 raise error.FilteredIndexError(rev)
327 return super(filteredchangelog, self).flags(rev)
328
329 cl.__class__ = filteredchangelog
330
331 return cl
334 return super(filteredchangelogmixin, self).flags(rev)
332 335
333 336
334 337 class repoview(object):
General Comments 0
You need to be logged in to leave comments. Login now