Patchwork D9582: upgrade: rename deficiences to format_upgrades

login
register
mail settings
Submitter phabricator
Date Dec. 14, 2020, 10:52 a.m.
Message ID <differential-rev-PHID-DREV-lbrt3qjrnvjy2hnrr3mo-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47880/
State Superseded
Headers show

Comments

phabricator - Dec. 14, 2020, 10:52 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It was not obvious what does deficieny means and every format upgrade can't be a
  deficiency. There are some format upgrades like compression levels, share-safe
  which can't be understood at deficiencies.
  
  This patch renames to make it more clearer. The ui message also improved
  which is a good thing.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade.py
  mercurial/upgrade_utils/actions.py
  tests/test-upgrade-repo.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -173,7 +173,7 @@ 
    }
   ]
   $ hg debugupgraderepo
-  (no feature deficiencies found in existing repository)
+  (no format upgrades found in existing repository)
   performing an upgrade with "--run" will make the following changes:
   
   requirements
@@ -212,7 +212,7 @@ 
 --optimize can be used to add optimizations
 
   $ hg debugupgrade --optimize redeltaparent
-  (no feature deficiencies found in existing repository)
+  (no format upgrades found in existing repository)
   performing an upgrade with "--run" will make the following changes:
   
   requirements
@@ -243,7 +243,7 @@ 
 modern form of the option
 
   $ hg debugupgrade --optimize re-delta-parent
-  (no feature deficiencies found in existing repository)
+  (no format upgrades found in existing repository)
   performing an upgrade with "--run" will make the following changes:
   
   requirements
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
@@ -28,7 +28,7 @@ 
     return set()
 
 
-DEFICIENCY = b'deficiency'
+FORMAT_UPGRADE = b'deficiency'
 OPTIMISATION = b'optimization'
 
 
@@ -42,13 +42,15 @@ 
        will be mapped to an action later in the upgrade process.
 
     type
-       Either ``DEFICIENCY`` or ``OPTIMISATION``. A deficiency is an obvious
-       problem. An optimization is an action (sometimes optional) that
+       Either ``FORMAT_UPGRADE`` or ``OPTIMISATION``.
+       A format upgrade is where we can upgrade the storage format. Not
+       all storage formats upgrades are deficiencies.
+       An optimization is an action (sometimes optional) that
        can be taken to further improve the state of the repository.
 
     description
        Message intended for humans explaining the improvement in more detail,
-       including the implications of it. For ``DEFICIENCY`` types, should be
+       including the implications of it. For ``FORMAT_UPGRADE`` types, should be
        worded in the present tense. For ``OPTIMISATION`` types, should be
        worded in the future tense.
 
@@ -87,7 +89,7 @@ 
 class formatvariant(improvement):
     """an improvement subclass dedicated to repository format"""
 
-    type = DEFICIENCY
+    type = FORMAT_UPGRADE
     ### The following attributes should be defined for each class:
 
     # machine-readable string uniquely identifying this improvement. it will be
@@ -95,7 +97,8 @@ 
     name = None
 
     # message intended for humans explaining the improvement in more detail,
-    # including the implications of it ``DEFICIENCY`` types, should be worded
+    # including the implications of it ``FORMAT_UPGRADE`` types, should be
+    # worded
     # in the present tense.
     description = None
 
@@ -410,9 +413,9 @@ 
         return bytes(level)
 
 
-def finddeficiencies(repo):
-    """returns a list of deficiencies that the repo suffer from"""
-    deficiencies = []
+def find_format_upgrades(repo):
+    """returns a list of format upgrades which can be perform on the repo"""
+    upgrades = []
 
     # We could detect lack of revlogv1 and store here, but they were added
     # in 0.9.2 and we don't support upgrading repos without these
@@ -420,9 +423,9 @@ 
 
     for fv in allformatvariant:
         if not fv.fromrepo(repo):
-            deficiencies.append(fv)
+            upgrades.append(fv)
 
-    return deficiencies
+    return upgrades
 
 
 ALL_OPTIMISATIONS = []
@@ -523,10 +526,10 @@ 
     return list(ALL_OPTIMISATIONS)
 
 
-def determineactions(repo, deficiencies, sourcereqs, destreqs):
+def determineactions(repo, format_upgrades, sourcereqs, destreqs):
     """Determine upgrade actions that will be performed.
 
-    Given a list of improvements as returned by ``finddeficiencies`` and
+    Given a list of improvements as returned by ``find_format_upgrades`` and
     ``findoptimizations``, determine the list of upgrade actions that
     will be performed.
 
@@ -538,7 +541,7 @@ 
     """
     newactions = []
 
-    for d in deficiencies:
+    for d in format_upgrades:
         name = d._requirement
 
         # If the action is a requirement that doesn't show up in the
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -97,9 +97,9 @@ 
             hint=_(b'run without arguments to see valid optimizations'),
         )
 
-    deficiencies = upgrade_actions.finddeficiencies(repo)
+    format_upgrades = upgrade_actions.find_format_upgrades(repo)
     actions = upgrade_actions.determineactions(
-        repo, deficiencies, repo.requirements, newreqs
+        repo, format_upgrades, repo.requirements, newreqs
     )
     actions.extend(
         o
@@ -136,7 +136,7 @@ 
         fromconfig = []
         onlydefault = []
 
-        for d in deficiencies:
+        for d in format_upgrades:
             if d.fromconfig(repo):
                 fromconfig.append(d)
             elif d.default:
@@ -167,10 +167,7 @@ 
             ui.status(b'\n')
         else:
             ui.status(
-                _(
-                    b'(no feature deficiencies found in existing '
-                    b'repository)\n'
-                )
+                _(b'(no format upgrades found in existing ' b'repository)\n')
             )
 
         ui.status(