This instance will be upgraded to Heptapod 0.26.0rc1 on 2021-10-26 at 14:00 UTC+2 (a few minutes of down time)

Commit d0e5fbca authored by Gregory Szorc's avatar Gregory Szorc
Browse files

commands: use revlog._deltachain in debugdeltachain

We have a nice API now. Use it.

This does mean we introduce an extra index lookup for each revision.
Considering this is a debug command, the overhead should be acceptable.
We could add the chain size to revlog._deltachain(). However, that
feels like avoidable overhead.
parent 93ac15f03331
......@@ -2542,9 +2542,7 @@ def debugdeltachain(ui, repo, file_=None, **opts):
generaldelta = r.version & revlog.REVLOGGENERALDELTA
def revinfo(rev):
iterrev = rev
e = index[iterrev]
chain = []
e = index[rev]
compsize = e[1]
uncompsize = e[2]
chainsize = 0
......@@ -2566,19 +2564,11 @@ def debugdeltachain(ui, repo, file_=None, **opts):
deltatype = 'prev'
while iterrev != e[3]:
chainsize += e[1]
if generaldelta:
iterrev = e[3]
iterrev -= 1
chain = r._deltachain(rev)[0]
for iterrev in chain:
e = index[iterrev]
chainsize += e[1]
return compsize, uncompsize, deltatype, chain, chainsize
fm = ui.formatter('debugdeltachain', opts)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment