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

REVISION SUMMARY
  Config introduced in previous patch was `share.source-safe-mismatch`. Let's
  rename the warn as `share.source-safe-mismatch.warn`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/localrepo.py
  mercurial/upgrade.py
  tests/test-share-safe.t

CHANGE DETAILS

diff --git a/tests/test-share-safe.t b/tests/test-share-safe.t
--- a/tests/test-share-safe.t
+++ b/tests/test-share-safe.t
@@ -539,7 +539,7 @@
   o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
   
 
-  $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config 
share.source-safe-mismatch=upgrade-allow --config 
experimental.sharesafe-warn-outdated-shares=false
+  $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config 
share.source-safe-mismatch=upgrade-allow --config 
share.source-safe-mismatch.warn=False
   @  f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
   |
   o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -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
@@ -268,7 +273,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)
@@ -284,6 +289,7 @@
     sharedvfs,
     current_requirements,
     mismatch_config,
+    mismatch_warn,
 ):
     """Downgrades a share which use share-safe to not use it"""
     wlock = None
@@ -311,6 +317,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()
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -568,6 +568,7 @@
     # for SHARESAFE_REQUIREMENT to detect whether the current repository needs
     # to be reshared
     mismatch_config = ui.config(b'share', b'source-safe-mismatch')
+    mismatch_warn = ui.configbool(b'share', b'source-safe-mismatch.warn')
     if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
 
         if (
@@ -589,6 +590,7 @@
                     sharedvfs,
                     requirements,
                     mismatch_config,
+                    mismatch_warn,
                 )
             elif mismatch_config == b'abort':
                 raise error.Abort(
@@ -622,6 +624,7 @@
                     storevfs,
                     requirements,
                     mismatch_config,
+                    mismatch_warn,
                 )
             elif mismatch_config == b'abort':
                 raise error.Abort(
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1074,11 +1074,6 @@
 )
 coreconfigitem(
     b'experimental',
-    b'sharesafe-warn-outdated-shares',
-    default=True,
-)
-coreconfigitem(
-    b'experimental',
     b'single-head-per-branch',
     default=False,
 )
@@ -1888,6 +1883,11 @@
     default=b'abort',
 )
 coreconfigitem(
+    b'share',
+    b'source-safe-mismatch.warn',
+    default=True,
+)
+coreconfigitem(
     b'shelve',
     b'maxbackups',
     default=10,



To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to