comparison mercurial/debugcommands.py @ 38115:b17fa9041695

debugdeltachain: r.start and r.length can be retrieved outside the loop
author Paul Morelle <paul.morelle@octobus.net>
date Thu, 19 Apr 2018 07:57:06 +0200
parents 8ba0344f9fb1
children aac4be30e250
comparison
equal deleted inserted replaced
38114:f79ba1d1b4b1 38115:b17fa9041695
627 The sparse read can be enabled with experimental.sparse-read = True 627 The sparse read can be enabled with experimental.sparse-read = True
628 """ 628 """
629 opts = pycompat.byteskwargs(opts) 629 opts = pycompat.byteskwargs(opts)
630 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts) 630 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
631 index = r.index 631 index = r.index
632 start = r.start
633 length = r.length
632 generaldelta = r.version & revlog.FLAG_GENERALDELTA 634 generaldelta = r.version & revlog.FLAG_GENERALDELTA
633 withsparseread = getattr(r, '_withsparseread', False) 635 withsparseread = getattr(r, '_withsparseread', False)
634 636
635 def revinfo(rev): 637 def revinfo(rev):
636 e = index[rev] 638 e = index[rev]
674 chainbases = {} 676 chainbases = {}
675 for rev in r: 677 for rev in r:
676 comp, uncomp, deltatype, chain, chainsize = revinfo(rev) 678 comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
677 chainbase = chain[0] 679 chainbase = chain[0]
678 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1) 680 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
679 start = r.start
680 length = r.length
681 basestart = start(chainbase) 681 basestart = start(chainbase)
682 revstart = start(rev) 682 revstart = start(rev)
683 lineardist = revstart + comp - basestart 683 lineardist = revstart + comp - basestart
684 extradist = lineardist - chainsize 684 extradist = lineardist - chainsize
685 try: 685 try: