Patchwork D9784: localrepo: disallow share if there is a version mismatch by default

login
register
mail settings
Submitter phabricator
Date Jan. 15, 2021, 6:48 a.m.
Message ID <differential-rev-PHID-DREV-4mqfjw2g6cs3qcsioj64-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48095/
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
  Earlier we used to allow shares which don't use share-safe mechanism to access
  repository which uses share-safe mechanism. This defeats the purpose and is bad
  behavior. This patch disallows that.
  
  Next patch will introduce a config option to allow that and have clearer
  understanding around various options.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  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
@@ -390,20 +390,11 @@ 
   o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
   
 
-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
-  
+Make sure existing shares dont work with default config
 
   $ hg log -GT "{node}: {desc}\n" -R ../nss-share
-  warning: source repository supports share-safe functionality. Reshare to upgrade.
-  @  f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
-  |
-  o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
-  
+  abort: version mismatch: source use share-safe functionality while current share does not
+  [255]
 
 
 Create a safe share from upgrade one
@@ -536,11 +527,8 @@ 
   sparserevlog
   store
   $ hg log -GT "{node}: {desc}\n" -R ../nss-share
-  warning: source repository supports share-safe functionality. Reshare to upgrade.
-  @  f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
-  |
-  o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
-  
+  abort: version mismatch: source use share-safe functionality while current share does not
+  [255]
 
 Check that if lock is taken, upgrade fails but read operation are successful
   $ touch ../nss-share/.hg/wlock
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -607,13 +607,11 @@ 
                     storevfs,
                     requirements,
                 )
-            elif ui.configbool(
-                b'experimental', b'sharesafe-warn-outdated-shares'
-            ):
-                ui.warn(
+            else:
+                raise error.Abort(
                     _(
-                        b'warning: source repository supports share-safe functionality.'
-                        b' Reshare to upgrade.\n'
+                        b'version mismatch: source use share-safe'
+                        b' functionality while current share does not'
                     )
                 )