[Updated] [+- ] D9691: sharesafe: make warning about outdated share configurable

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Jan 13 11:31:43 UTC 2021


pulkit updated this revision to Diff 24778.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9691?vs=24696&id=24778

BRANCH
  default

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

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

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
@@ -392,6 +392,12 @@
 
 Make sure existing shares still works
 
+  $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-warn-outdated-shares=false
+  @  f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
+  |
+  o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
+  
+
   $ hg log -GT "{node}: {desc}\n" -R ../nss-share
   warning: source repository supports share-safe functionality. Reshare to upgrade.
   @  f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
@@ -544,6 +550,13 @@
   |
   o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
   
+
+  $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true --config experimental.sharesafe-warn-outdated-shares=false
+  @  f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
+  |
+  o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
+  
+
   $ rm ../nss-share/.hg/wlock
   $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true
   repository upgraded to use share-safe mode
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -254,10 +254,11 @@
         current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
         ui.warn(_(b'repository upgraded to use share-safe mode\n'))
     except error.LockError as e:
-        ui.warn(
-            _(b'failed to upgrade share, got error: %s\n')
-            % stringutil.forcebytestr(e.strerror)
-        )
+        if ui.configbool(b'experimental', b'sharesafe-warn-outdated-shares'):
+            ui.warn(
+                _(b'failed to upgrade 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
@@ -607,7 +607,9 @@
                     storevfs,
                     requirements,
                 )
-            else:
+            elif ui.configbool(
+                b'experimental', b'sharesafe-warn-outdated-shares'
+            ):
                 ui.warn(
                     _(
                         b'warning: source repository supports share-safe functionality.'
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1084,6 +1084,11 @@
 )
 coreconfigitem(
     b'experimental',
+    b'sharesafe-warn-outdated-shares',
+    default=True,
+)
+coreconfigitem(
+    b'experimental',
     b'single-head-per-branch',
     default=False,
 )



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


More information about the Mercurial-patches mailing list