revlog: choose between ifh and dfh once for all
authorPaul Morelle <paul.morelle@octobus.net>
Sun, 14 Jan 2018 12:49:24 -0800
changeset 35635 0b52c0ecbc23
parent 35634 b43578ec483a
child 35636 8108bb51309d
revlog: choose between ifh and dfh once for all
mercurial/revlog.py
--- a/mercurial/revlog.py	Sun Jan 14 12:46:03 2018 -0800
+++ b/mercurial/revlog.py	Sun Jan 14 12:49:24 2018 -0800
@@ -1901,6 +1901,11 @@
             raise RevlogError(_("%s: attempt to add wdir revision") %
                               (self.indexfile))
 
+        if self._inline:
+            fh = ifh
+        else:
+            fh = dfh
+
         btext = [rawtext]
         def buildtext():
             if btext[0] is not None:
@@ -1915,10 +1920,6 @@
                                                        len(delta) - hlen):
                 btext[0] = delta[hlen:]
             else:
-                if self._inline:
-                    fh = ifh
-                else:
-                    fh = dfh
                 basetext = self.revision(baserev, _df=fh, raw=True)
                 btext[0] = mdiff.patch(basetext, delta)
 
@@ -1947,10 +1948,6 @@
                     header = mdiff.replacediffheader(self.rawsize(rev), len(t))
                     delta = header + t
                 else:
-                    if self._inline:
-                        fh = ifh
-                    else:
-                        fh = dfh
                     ptext = self.revision(rev, _df=fh, raw=True)
                     delta = mdiff.textdiff(ptext, t)
             header, data = self.compress(delta)