diff mercurial/upgrade.py @ 46060:c407513a44a3

upgrade: start moving the "to be happening" data in a dedicated object The upgrade code has a lot of logic to determine which action needs to be performed depending of various element (sometimes depending from each other). It would be nice to have a consistent object representing this. That could be cleanly passed and avoid some logic duplication. So we create this object as a start. Differential Revision: https://phab.mercurial-scm.org/D9487
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 01 Dec 2020 22:37:34 +0100
parents 72b7b4bf3e65
children 945b33a7edfd
line wrap: on
line diff
--- a/mercurial/upgrade.py	Sun Dec 06 20:38:01 2020 -0500
+++ b/mercurial/upgrade.py	Tue Dec 01 22:37:34 2020 +0100
@@ -176,6 +176,12 @@
                 ui.write((b'  - %s\n' % r))
         ui.write((b'\n'))
 
+    upgrade_op = upgrade_actions.UpgradeOperation(
+        newreqs,
+        [a.name for a in actions],
+        revlogs,
+    )
+
     if not run:
         fromconfig = []
         onlydefault = []
@@ -249,8 +255,6 @@
     printupgradeactions()
     print_affected_revlogs()
 
-    upgradeactions = [a.name for a in actions]
-
     ui.status(_(b'beginning upgrade...\n'))
     with repo.wlock(), repo.lock():
         ui.status(_(b'repository locked and read-only\n'))
@@ -276,7 +280,7 @@
 
             with dstrepo.wlock(), dstrepo.lock():
                 backuppath = upgrade_engine.upgrade(
-                    ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs
+                    ui, repo, dstrepo, upgrade_op
                 )
             if not (backup or backuppath is None):
                 ui.status(