[Request] [+ ] D9618: actions: introduce function to calculate downgrades

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Dec 16 10:15:08 UTC 2020


pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  An ugrade operation can also downgrade/remove some format variants. Before this
  patch there was no clean way to find out all such variants which will be
  removed. This patch adds a function for that.
  
  It will be used in next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -428,6 +428,21 @@
     return upgrades
 
 
+def find_format_downgrades(repo):
+    """returns a list of format downgrades which will be performed on the repo
+    because of disabled config option for them"""
+
+    downgrades = []
+
+    for fv in allformatvariant:
+        # format variant exist in repo but does not exist in new repository
+        # config
+        if fv.fromrepo(repo) and not fv.fromconfig(repo):
+            downgrades.append(fv)
+
+    return downgrades
+
+
 ALL_OPTIMISATIONS = []
 
 



To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20201216/27513ade/attachment.html>


More information about the Mercurial-patches mailing list