actions: store deltareuse mode of whole operation in UpgradeOperation
UpgradeOperation should provide easy access to all the things related to the
current operation. Clients should not need to compute them.
Differential Revision: https://phab.mercurial-scm.org/D9666
--- a/mercurial/upgrade_utils/actions.py Wed Dec 30 16:11:24 2020 +0530
+++ b/mercurial/upgrade_utils/actions.py Wed Dec 30 16:20:25 2020 +0530
@@ -12,6 +12,7 @@
error,
localrepo,
requirements,
+ revlog,
util,
)
@@ -646,6 +647,17 @@
i for i in all_optimizations if i not in self.upgrade_actions
]
+ # delta reuse mode of this upgrade operation
+ self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
+ if b're-delta-all' in self._upgrade_actions_names:
+ self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
+ elif b're-delta-parent' in self._upgrade_actions_names:
+ self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
+ elif b're-delta-multibase' in self._upgrade_actions_names:
+ self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
+ elif b're-delta-fulladd' in self._upgrade_actions_names:
+ self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
+
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:11:24 2020 +0530
+++ b/mercurial/upgrade_utils/engine.py Wed Dec 30 16:20:25 2020 +0530
@@ -446,24 +446,13 @@
)
)
- if upgrade_op.has_upgrade_action(b're-delta-all'):
- deltareuse = revlog.revlog.DELTAREUSENEVER
- elif upgrade_op.has_upgrade_action(b're-delta-parent'):
- deltareuse = revlog.revlog.DELTAREUSESAMEREVS
- elif upgrade_op.has_upgrade_action(b're-delta-multibase'):
- deltareuse = revlog.revlog.DELTAREUSESAMEREVS
- elif upgrade_op.has_upgrade_action(b're-delta-fulladd'):
- deltareuse = revlog.revlog.DELTAREUSEFULLADD
- else:
- deltareuse = revlog.revlog.DELTAREUSEALWAYS
-
with dstrepo.transaction(b'upgrade') as tr:
_clonerevlogs(
ui,
srcrepo,
dstrepo,
tr,
- deltareuse,
+ upgrade_op.delta_reuse_mode,
upgrade_op.has_upgrade_action(b're-delta-multibase'),
revlogs=upgrade_op.revlogs_to_process,
)