##// END OF EJS Templates
debugrevlog: fix computing chain length in debugrevlog -d...
Mateusz Kwapich -
r23254:d23834b8 default
parent child Browse files
Show More
@@ -2653,22 +2653,13 b' def debugrevlog(ui, repo, file_=None, **'
2653 2653 " rawsize totalsize compression heads chainlen\n")
2654 2654 ts = 0
2655 2655 heads = set()
2656 rindex = r.index
2657
2658 def chainbaseandlen(rev):
2659 clen = 0
2660 base = rindex[rev][3]
2661 while base != rev:
2662 clen += 1
2663 rev = base
2664 base = rindex[rev][3]
2665 return base, clen
2666 2656
2667 2657 for rev in xrange(numrevs):
2668 2658 dbase = r.deltaparent(rev)
2669 2659 if dbase == -1:
2670 2660 dbase = rev
2671 cbase, clen = chainbaseandlen(rev)
2661 cbase = r.chainbase(rev)
2662 clen = r.chainlen(rev)
2672 2663 p1, p2 = r.parentrevs(rev)
2673 2664 rs = r.rawsize(rev)
2674 2665 ts = ts + rs
@@ -350,6 +350,20 b' class revlog(object):'
350 350 rev = base
351 351 base = index[rev][3]
352 352 return base
353 def chainlen(self, rev):
354 index = self.index
355 generaldelta = self._generaldelta
356 iterrev = rev
357 e = index[iterrev]
358 clen = 0
359 while iterrev != e[3]:
360 clen += 1
361 if generaldelta:
362 iterrev = e[3]
363 else:
364 iterrev -= 1
365 e = index[iterrev]
366 return clen
353 367 def flags(self, rev):
354 368 return self.index[rev][0] & 0xFFFF
355 369 def rawsize(self, rev):
General Comments 0
You need to be logged in to leave comments. Login now