downgrade: if a compression is removed, consider that too
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 08 Jan 2021 23:06:38 +0530
changeset 46230 1fcab88ab85c
parent 46229 52abb1af2995
child 46231 d3113c4cf52c
downgrade: if a compression is removed, consider that too For compression format variant, the result of `fromrepo()` and `fromconfig()` is not a boolean and we have to actually equate those to find change. Differential Revision: https://phab.mercurial-scm.org/D9693
mercurial/upgrade_utils/actions.py
--- a/mercurial/upgrade_utils/actions.py	Thu Dec 31 14:28:00 2020 +0530
+++ b/mercurial/upgrade_utils/actions.py	Fri Jan 08 23:06:38 2021 +0530
@@ -467,6 +467,13 @@
     downgrades = []
 
     for fv in allformatvariant:
+        if fv.name == b'compression':
+            # If there is a compression change between repository
+            # and config, destination repository compression will change
+            # and current compression will be removed.
+            if fv.fromrepo(repo) != fv.fromconfig(repo):
+                downgrades.append(fv)
+            continue
         # format variant exist in repo but does not exist in new repository
         # config
         if fv.fromrepo(repo) and not fv.fromconfig(repo):