Patchwork [2,of,6] debugdeltachain: r.start and r.length can be retrieved outside the loop

login
register
mail settings
Submitter Paul Morelle
Date May 21, 2018, 9:47 p.m.
Message ID <3eb11b8fe014f5698a3c.1526939274@belenos.localdomain>
Download mbox | patch
Permalink /patch/31793/
State Accepted
Headers show

Comments

Paul Morelle - May 21, 2018, 9:47 p.m.
# HG changeset patch
# User Paul Morelle <paul.morelle@octobus.net>
# Date 1524117426 -7200
#      Thu Apr 19 07:57:06 2018 +0200
# Node ID 3eb11b8fe014f5698a3c857ee670a7892f06fc56
# Parent  054469518b3480201e7f8ada16957027009e9f64
# EXP-Topic semi-snapshots
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 3eb11b8fe014
debugdeltachain: r.start and r.length can be retrieved outside the loop

Patch

diff -r 054469518b34 -r 3eb11b8fe014 mercurial/debugcommands.py
--- a/mercurial/debugcommands.py	Fri May 04 15:00:55 2018 +0200
+++ b/mercurial/debugcommands.py	Thu Apr 19 07:57:06 2018 +0200
@@ -629,6 +629,8 @@ 
     opts = pycompat.byteskwargs(opts)
     r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts)
     index = r.index
+    start = r.start
+    length = r.length
     generaldelta = r.version & revlog.FLAG_GENERALDELTA
     withsparseread = getattr(r, '_withsparseread', False)
 
@@ -676,8 +678,6 @@ 
         comp, uncomp, deltatype, chain, chainsize = revinfo(rev)
         chainbase = chain[0]
         chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
-        start = r.start
-        length = r.length
         basestart = start(chainbase)
         revstart = start(rev)
         lineardist = revstart + comp - basestart