mercurial/revlogutils/debug.py
changeset 51072 810446d2d5ef
parent 51071 793a058f64bd
child 51073 752e380c5702
equal deleted inserted replaced
51071:793a058f64bd 51072:810446d2d5ef
   799         self._chain_size_cache[rev] = chain_size
   799         self._chain_size_cache[rev] = chain_size
   800 
   800 
   801         return p1, p2, compsize, uncompsize, deltatype, chain, chain_size
   801         return p1, p2, compsize, uncompsize, deltatype, chain, chain_size
   802 
   802 
   803 
   803 
   804 def debug_delta_chain(revlog):
   804 def debug_delta_chain(revlog, revs=None):
   805     auditor = DeltaChainAuditor(revlog)
   805     auditor = DeltaChainAuditor(revlog)
   806     r = revlog
   806     r = revlog
   807     start = r.start
   807     start = r.start
   808     length = r.length
   808     length = r.length
   809     withsparseread = revlog.data_config.with_sparse_read
   809     withsparseread = revlog.data_config.with_sparse_read
   816     if withsparseread:
   816     if withsparseread:
   817         header += b'   readsize largestblk rddensity srchunks'
   817         header += b'   readsize largestblk rddensity srchunks'
   818     header += b'\n'
   818     header += b'\n'
   819     yield header
   819     yield header
   820 
   820 
       
   821     if revs is None:
       
   822         all_revs = iter(r)
       
   823     else:
       
   824         revlog_size = len(r)
       
   825         all_revs = sorted(rev for rev in revs if rev < revlog_size)
       
   826 
   821     chainbases = {}
   827     chainbases = {}
   822     for rev in r:
   828     for rev in all_revs:
   823         p1, p2, comp, uncomp, deltatype, chain, chainsize = auditor.revinfo(rev)
   829         p1, p2, comp, uncomp, deltatype, chain, chainsize = auditor.revinfo(rev)
   824         chainbase = chain[0]
   830         chainbase = chain[0]
   825         chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
   831         chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
   826         basestart = start(chainbase)
   832         basestart = start(chainbase)
   827         revstart = start(rev)
   833         revstart = start(rev)