2534 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) |
2534 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) |
2535 |
2535 |
2536 if opts.get("dump"): |
2536 if opts.get("dump"): |
2537 numrevs = len(r) |
2537 numrevs = len(r) |
2538 ui.write("# rev p1rev p2rev start end deltastart base p1 p2" |
2538 ui.write("# rev p1rev p2rev start end deltastart base p1 p2" |
2539 " rawsize totalsize compression heads\n") |
2539 " rawsize totalsize compression heads chainlen\n") |
2540 ts = 0 |
2540 ts = 0 |
2541 heads = set() |
2541 heads = set() |
|
2542 rindex = r.index |
|
2543 |
|
2544 def chainbaseandlen(rev): |
|
2545 clen = 0 |
|
2546 base = rindex[rev][3] |
|
2547 while base != rev: |
|
2548 clen += 1 |
|
2549 rev = base |
|
2550 base = rindex[rev][3] |
|
2551 return base, clen |
|
2552 |
2542 for rev in xrange(numrevs): |
2553 for rev in xrange(numrevs): |
2543 dbase = r.deltaparent(rev) |
2554 dbase = r.deltaparent(rev) |
2544 if dbase == -1: |
2555 if dbase == -1: |
2545 dbase = rev |
2556 dbase = rev |
2546 cbase = r.chainbase(rev) |
2557 cbase, clen = chainbaseandlen(rev) |
2547 p1, p2 = r.parentrevs(rev) |
2558 p1, p2 = r.parentrevs(rev) |
2548 rs = r.rawsize(rev) |
2559 rs = r.rawsize(rev) |
2549 ts = ts + rs |
2560 ts = ts + rs |
2550 heads -= set(r.parentrevs(rev)) |
2561 heads -= set(r.parentrevs(rev)) |
2551 heads.add(rev) |
2562 heads.add(rev) |
2552 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d %11d %5d\n" % |
2563 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d " |
|
2564 "%11d %5d %8d\n" % |
2553 (rev, p1, p2, r.start(rev), r.end(rev), |
2565 (rev, p1, p2, r.start(rev), r.end(rev), |
2554 r.start(dbase), r.start(cbase), |
2566 r.start(dbase), r.start(cbase), |
2555 r.start(p1), r.start(p2), |
2567 r.start(p1), r.start(p2), |
2556 rs, ts, ts / r.end(rev), len(heads))) |
2568 rs, ts, ts / r.end(rev), len(heads), clen)) |
2557 return 0 |
2569 return 0 |
2558 |
2570 |
2559 v = r.version |
2571 v = r.version |
2560 format = v & 0xFFFF |
2572 format = v & 0xFFFF |
2561 flags = [] |
2573 flags = [] |