[Updated] D9786: share: rename share-safe warning config

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue Jan 19 02:13:19 UTC 2021


Closed by commit rHG2eb5fe13461b: share: rename share-safe warning config (authored by pulkit).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D9786?vs=25129&id=25149#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9786?vs=25129&id=25149

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9786/new/

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/helptext/config.txt
  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
@@ -546,7 +546,7 @@
   o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
   
 
-  $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow --config experimental.sharesafe-warn-outdated-shares=false
+  $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow --config share.safe-mismatch.source-safe.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
@@ -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()
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -575,6 +575,9 @@
             and requirementsmod.SHARESAFE_REQUIREMENT
             not in _readrequires(sharedvfs, True)
         ):
+            mismatch_warn = ui.configbool(
+                b'share', b'safe-mismatch.source-not-safe.warn'
+            )
             mismatch_config = ui.config(
                 b'share', b'safe-mismatch.source-not-safe'
             )
@@ -592,6 +595,7 @@
                     sharedvfs,
                     requirements,
                     mismatch_config,
+                    mismatch_warn,
                 )
             elif mismatch_config == b'abort':
                 raise error.Abort(
@@ -618,6 +622,9 @@
         sourcerequires = _readrequires(sharedvfs, False)
         if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires:
             mismatch_config = ui.config(b'share', b'safe-mismatch.source-safe')
+            mismatch_warn = ui.configbool(
+                b'share', b'safe-mismatch.source-safe.warn'
+            )
             if mismatch_config in (
                 b'upgrade-allow',
                 b'allow',
@@ -632,6 +639,7 @@
                     storevfs,
                     requirements,
                     mismatch_config,
+                    mismatch_warn,
                 )
             elif mismatch_config == b'abort':
                 raise error.Abort(
diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -1965,6 +1965,16 @@
                            source setting
 
 
+``safe-mismatch.source-safe.warn``
+    Shows a warning on operations if the shared repository does not use
+    share-safe, but the source repository does.
+    (default: True)
+
+``safe-mismatch.source-not-safe.warn``
+    Shows a warning on operations if the shared repository uses share-safe,
+    but the source repository does not.
+    (default: True)
+
 ``storage``
 -----------
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1098,11 +1098,6 @@
 )
 coreconfigitem(
     b'experimental',
-    b'sharesafe-warn-outdated-shares',
-    default=True,
-)
-coreconfigitem(
-    b'experimental',
     b'single-head-per-branch',
     default=False,
 )
@@ -1921,6 +1916,16 @@
     default=b'abort',
 )
 coreconfigitem(
+    b'share',
+    b'safe-mismatch.source-not-safe.warn',
+    default=True,
+)
+coreconfigitem(
+    b'share',
+    b'safe-mismatch.source-safe.warn',
+    default=True,
+)
+coreconfigitem(
     b'shelve',
     b'maxbackups',
     default=10,



To: pulkit, #hg-reviewers, marmoute, mharbison72
Cc: marmoute, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210119/ce66961d/attachment-0002.html>


More information about the Mercurial-patches mailing list