##// END OF EJS Templates
debugdeltachain: stop summing the same chain over and over...
marmoute -
r51243:af776c3d stable
parent child Browse files
Show More
@@ -803,11 +803,12 b' def debugdeltachain(ui, repo, file_=None'
803 # security to avoid crash on corrupted revlogs
803 # security to avoid crash on corrupted revlogs
804 total_revs = len(index)
804 total_revs = len(index)
805
805
806 chain_size_cache = {}
807
806 def revinfo(rev):
808 def revinfo(rev):
807 e = index[rev]
809 e = index[rev]
808 compsize = e[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH]
810 compsize = e[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH]
809 uncompsize = e[revlog_constants.ENTRY_DATA_UNCOMPRESSED_LENGTH]
811 uncompsize = e[revlog_constants.ENTRY_DATA_UNCOMPRESSED_LENGTH]
810 chainsize = 0
811
812
812 base = e[revlog_constants.ENTRY_DELTA_BASE]
813 base = e[revlog_constants.ENTRY_DELTA_BASE]
813 p1 = e[revlog_constants.ENTRY_PARENT_1]
814 p1 = e[revlog_constants.ENTRY_PARENT_1]
@@ -870,11 +871,17 b' def debugdeltachain(ui, repo, file_=None'
870 deltatype = b'prev'
871 deltatype = b'prev'
871
872
872 chain = r._deltachain(rev)[0]
873 chain = r._deltachain(rev)[0]
873 for iterrev in chain:
874 chain_size = 0
874 e = index[iterrev]
875 for iter_rev in reversed(chain):
875 chainsize += e[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH]
876 cached = chain_size_cache.get(iter_rev)
876
877 if cached is not None:
877 return p1, p2, compsize, uncompsize, deltatype, chain, chainsize
878 chain_size += cached
879 break
880 e = index[iter_rev]
881 chain_size += e[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH]
882 chain_size_cache[rev] = chain_size
883
884 return p1, p2, compsize, uncompsize, deltatype, chain, chain_size
878
885
879 fm = ui.formatter(b'debugdeltachain', opts)
886 fm = ui.formatter(b'debugdeltachain', opts)
880
887
General Comments 0
You need to be logged in to leave comments. Login now