changeset 30013:d81fe5af92b8

revlog: make code in builddelta() slightly easier to read self.compress() is destructured into its components. "l" is renamed to "deltalen."
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 24 Aug 2016 20:00:52 -0700
parents e83f89d3b1f7
children 60a66c79125f
files mercurial/revlog.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Sep 23 08:15:05 2016 +0000
+++ b/mercurial/revlog.py	Wed Aug 24 20:00:52 2016 -0700
@@ -1440,18 +1440,19 @@
                         fh = dfh
                     ptext = self.revision(self.node(rev), _df=fh)
                     delta = mdiff.textdiff(ptext, t)
-            data = self.compress(delta)
-            l = len(data[1]) + len(data[0])
+            header, data = self.compress(delta)
+            deltalen = len(header) + len(data)
             chainbase = self.chainbase(rev)
-            dist = l + offset - self.start(chainbase)
+            dist = deltalen + offset - self.start(chainbase)
             if self._generaldelta:
                 base = rev
             else:
                 base = chainbase
             chainlen, compresseddeltalen = self._chaininfo(rev)
             chainlen += 1
-            compresseddeltalen += l
-            return dist, l, data, base, chainbase, chainlen, compresseddeltalen
+            compresseddeltalen += deltalen
+            return (dist, deltalen, (header, data), base,
+                    chainbase, chainlen, compresseddeltalen)
 
         curr = len(self)
         prev = curr - 1