D6901: upgrade: fix DELTAREUSEFULLADD implementation in revlog.clone

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Fri Sep 27 16:22:55 EDT 2019


marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If we do a full addition, we need to start from the full text.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6901

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2437,21 +2437,21 @@
             # the revlog chunk is a delta.
             cachedelta = None
             rawtext = None
-            if (deltareuse != self.DELTAREUSEFULLADD and destrevlog._lazydelta):
-                dp = self.deltaparent(rev)
-                if dp != nullrev:
-                    cachedelta = (dp, bytes(self._chunk(rev)))
-
-            if not cachedelta:
-                rawtext = self.rawdata(rev)
-
-
             if deltareuse == self.DELTAREUSEFULLADD:
-                destrevlog.addrevision(rawtext, tr, linkrev, p1, p2,
+                text = self.revision(rev)
+                destrevlog.addrevision(text, tr, linkrev, p1, p2,
                                        cachedelta=cachedelta,
                                        node=node, flags=flags,
                                        deltacomputer=deltacomputer)
             else:
+                if destrevlog._lazydelta:
+                    dp = self.deltaparent(rev)
+                    if dp != nullrev:
+                        cachedelta = (dp, bytes(self._chunk(rev)))
+
+                if not cachedelta:
+                    rawtext = self.rawdata(rev)
+
                 ifh = destrevlog.opener(destrevlog.indexfile, 'a+',
                                         checkambig=False)
                 dfh = None



To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list