changeset 26116:562cfc99e611

revlog: move textlen calculation to be above delta chooser This moves the textlen calculation to be above the delta chooser. Since textlen is needed for calling isgooddelta, we need it above the delta chooser so future patches can call isgooddelta.
author Durham Goode <durham@fb.com>
date Sun, 30 Aug 2015 13:34:30 -0700
parents 748347e0e8d4
children 4dc5b51f38fe
files mercurial/revlog.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sun Aug 30 13:33:00 2015 -0700
+++ b/mercurial/revlog.py	Sun Aug 30 13:34:30 2015 -0700
@@ -1332,6 +1332,14 @@
         basecache = self._basecache
         p1r, p2r = self.rev(p1), self.rev(p2)
 
+        # full versions are inserted when the needed deltas
+        # become comparable to the uncompressed text
+        if text is None:
+            textlen = mdiff.patchedsize(self.rawsize(cachedelta[0]),
+                                        cachedelta[1])
+        else:
+            textlen = len(text)
+
         # should we try to build a delta?
         if prev != nullrev:
             if self._generaldelta:
@@ -1345,14 +1353,6 @@
                 d = builddelta(prev)
             dist, l, data, base, chainbase, chainlen, compresseddeltalen = d
 
-        # full versions are inserted when the needed deltas
-        # become comparable to the uncompressed text
-        if text is None:
-            textlen = mdiff.patchedsize(self.rawsize(cachedelta[0]),
-                                        cachedelta[1])
-        else:
-            textlen = len(text)
-
         if not self._isgooddelta(d, textlen):
             text = buildtext()
             data = self.compress(text)