engine: prevent multiple checking of re-delta-multibase
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 30 Dec 2020 16:39:35 +0530
changeset 46218 3f92a9bb80f0
parent 46217 02df91e895bd
child 46219 481d9aed669c
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
mercurial/upgrade_utils/actions.py
mercurial/upgrade_utils/engine.py
--- 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: