revlog: make code in builddelta() slightly easier to read
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 24 Aug 2016 20:00:52 -0700
changeset 30011 d81fe5af92b8
parent 30008 e83f89d3b1f7
child 30012 60a66c79125f
revlog: make code in builddelta() slightly easier to read self.compress() is destructured into its components. "l" is renamed to "deltalen."
mercurial/revlog.py
--- 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