[Commented On] D12612: upgrade: split some logic from UpgradeOperation

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Tue May 24 14:33:42 UTC 2022


baymax added a comment.
baymax updated this revision to Diff 33425.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12612?vs=33410&id=33425

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12612/new/

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

AFFECTED FILES
  mercurial/upgrade_utils/actions.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py
--- a/mercurial/upgrade_utils/actions.py
+++ b/mercurial/upgrade_utils/actions.py
@@ -691,7 +691,24 @@
     return newactions
 
 
-class UpgradeOperation:
+class BaseOperation:
+    """base class that contains the minimum for an upgrade to work
+
+    (this might need to be extended as the usage for subclass alternative to
+    UpgradeOperation extends)
+    """
+
+    def __init__(
+        self,
+        new_requirements,
+        backup_store,
+    ):
+        self.new_requirements = new_requirements
+        # should this operation create a backup of the store
+        self.backup_store = backup_store
+
+
+class UpgradeOperation(BaseOperation):
     """represent the work to be done during an upgrade"""
 
     def __init__(
@@ -704,8 +721,11 @@
         revlogs_to_process,
         backup_store,
     ):
+        super().__init__(
+            new_requirements,
+            backup_store,
+        )
         self.ui = ui
-        self.new_requirements = new_requirements
         self.current_requirements = current_requirements
         # list of upgrade actions the operation will perform
         self.upgrade_actions = upgrade_actions
@@ -747,9 +767,6 @@
             b're-delta-multibase' in upgrade_actions_names
         )
 
-        # should this operation create a backup of the store
-        self.backup_store = backup_store
-
     @property
     def upgrade_actions_names(self):
         return set([a.name for a in self.upgrade_actions])



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220524/12a039a0/attachment-0002.html>


More information about the Mercurial-patches mailing list