changeset 46218:3f92a9bb80f0

engine: prevent multiple checking of re-delta-multibase The _perform_clone function is called for each revlog cloned, hence we should prevent this function call overhead. Differential Revision: https://phab.mercurial-scm.org/D9669
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 30 Dec 2020 16:39:35 +0530
parents 02df91e895bd
children 481d9aed669c
files mercurial/upgrade_utils/actions.py mercurial/upgrade_utils/engine.py
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/upgrade_utils/actions.py	Wed Dec 30 16:33:49 2020 +0530
+++ b/mercurial/upgrade_utils/actions.py	Wed Dec 30 16:39:35 2020 +0530
@@ -658,6 +658,11 @@
         elif b're-delta-fulladd' in self._upgrade_actions_names:
             self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
 
+        # should this operation force re-delta of both parents
+        self.force_re_delta_both_parents = (
+            b're-delta-multibase' in self._upgrade_actions_names
+        )
+
     def _write_labeled(self, l, label):
         """
         Utility function to aid writing of a list under one label
--- a/mercurial/upgrade_utils/engine.py	Wed Dec 30 16:33:49 2020 +0530
+++ b/mercurial/upgrade_utils/engine.py	Wed Dec 30 16:39:35 2020 +0530
@@ -140,9 +140,7 @@
             newrl,
             addrevisioncb=oncopiedrevision,
             deltareuse=upgrade_op.delta_reuse_mode,
-            forcedeltabothparents=upgrade_op.has_upgrade_action(
-                b're-delta-multibase'
-            ),
+            forcedeltabothparents=upgrade_op.force_re_delta_both_parents,
             sidedatacompanion=sidedatacompanion,
         )
     else: