Patchwork D9692: sharesafe: introduce config to disallow outdated shares from working

login
register
mail settings
Submitter phabricator
Date Jan. 8, 2021, 4:25 p.m.
Message ID <differential-rev-PHID-DREV-jgixnhrcyualxkuvglb3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48003/
State Superseded
Headers show

Comments

phabricator - Jan. 8, 2021, 4:25 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  After this patch, we have config option to control all aspects of shares
  when share source is upgraded or downgraded.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/localrepo.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
@@ -397,6 +397,9 @@ 
   |
   o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
   
+  $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-disallow-outdated-shares=true
+  abort: source repository uses share-safe while current share does not
+  [255]
 
   $ hg log -GT "{node}: {desc}\n" -R ../nss-share
   warning: source repository supports share-safe functionality. Reshare to upgrade.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -608,6 +608,15 @@ 
                     requirements,
                 )
             elif ui.configbool(
+                b'experimental', b'sharesafe-disallow-outdated-shares'
+            ):
+                raise error.Abort(
+                    _(
+                        b'source repository uses share-safe while'
+                        b' current share does not'
+                    )
+                )
+            elif ui.configbool(
                 b'experimental', b'sharesafe-warn-outdated-shares'
             ):
                 ui.warn(
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-disallow-outdated-shares',
+    default=False,
+)
+coreconfigitem(
+    b'experimental',
     b'sharesafe-warn-outdated-shares',
     default=True,
 )