changeset 35635:0b52c0ecbc23

revlog: choose between ifh and dfh once for all
author Paul Morelle <paul.morelle@octobus.net>
date Sun, 14 Jan 2018 12:49:24 -0800
parents b43578ec483a
children 8108bb51309d
files mercurial/revlog.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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)