diff mercurial/upgrade.py @ 46333:4f17773fc6b5

share: rename share-safe warning config Config introduced in previous patch was `share.source-safe-mismatch`. Let's rename the warn as `share.source-safe-mismatch.warn`. While we are here, made sure we have different configs for upgrade and downgrade. Differential Revision: https://phab.mercurial-scm.org/D9786
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 15 Jan 2021 12:08:07 +0530
parents 25be21ec6c65
children 4a58561ace0f 2e8a844d0ae0
line wrap: on
line diff
--- a/mercurial/upgrade.py	Mon Jan 18 21:37:20 2021 +0530
+++ b/mercurial/upgrade.py	Fri Jan 15 12:08:07 2021 +0530
@@ -242,7 +242,12 @@
 
 
 def upgrade_share_to_safe(
-    ui, hgvfs, storevfs, current_requirements, mismatch_config
+    ui,
+    hgvfs,
+    storevfs,
+    current_requirements,
+    mismatch_config,
+    mismatch_warn,
 ):
     """Upgrades a share to use share-safe mechanism"""
     wlock = None
@@ -282,7 +287,7 @@
                 _(b'failed to upgrade share, got error: %s')
                 % stringutil.forcebytestr(e.strerror)
             )
-        elif ui.configbool(b'experimental', b'sharesafe-warn-outdated-shares'):
+        elif mismatch_warn:
             ui.warn(
                 _(b'failed to upgrade share, got error: %s\n')
                 % stringutil.forcebytestr(e.strerror)
@@ -298,6 +303,7 @@
     sharedvfs,
     current_requirements,
     mismatch_config,
+    mismatch_warn,
 ):
     """Downgrades a share which use share-safe to not use it"""
     wlock = None
@@ -335,6 +341,11 @@
                 _(b'failed to downgrade share, got error: %s')
                 % stringutil.forcebytestr(e.strerror)
             )
+        elif mismatch_warn:
+            ui.warn(
+                _(b'failed to downgrade share, got error: %s\n')
+                % stringutil.forcebytestr(e.strerror)
+            )
     finally:
         if wlock:
             wlock.release()