Patchwork D9786: share: rename share-safe warning config

login
register
mail settings
Submitter phabricator
Date Jan. 15, 2021, 6:48 a.m.
Message ID <differential-rev-PHID-DREV-ewpa4773ciq5ddbowd2r-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48097/
State Superseded
Headers show

Comments

phabricator - Jan. 15, 2021, 6:48 a.m.
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




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

Patch

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,