[Updated] D9841: share-share: have the hint issue more consistently and point to the right doc
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Fri Jan 22 04:18:30 UTC 2021
Closed by commit rHG4a58561ace0f: share-share: have the hint issue more consistently and point to the right doc (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9841?vs=25197&id=25213
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9841/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9841
AFFECTED FILES
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
@@ -396,6 +396,7 @@
$ hg log -GT "{node}: {desc}\n" -R ../nss-share
abort: version mismatch: source uses share-safe functionality while the current share does not
+ (see `hg help config.format.use-share-safe` for more information)
[255]
@@ -481,6 +482,7 @@
$ hg log -GT "{node}: {desc}\n" -R ../ss-share
abort: share source does not support exp-sharesafe requirement
+ (see `hg help config.format.use-share-safe` for more information)
[255]
Testing automatic downgrade of shares when config is set
@@ -488,6 +490,7 @@
$ touch ../ss-share/.hg/wlock
$ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
abort: failed to downgrade share, got error: Lock held
+ (see `hg help config.format.use-share-safe` for more information)
[255]
$ rm ../ss-share/.hg/wlock
@@ -530,13 +533,14 @@
store
$ hg log -GT "{node}: {desc}\n" -R ../nss-share
abort: version mismatch: source uses share-safe functionality while the current share does not
+ (see `hg help config.format.use-share-safe` for more information)
[255]
Check that if lock is taken, upgrade fails but read operation are successful
$ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgra
abort: share-safe mismatch with source.
Unrecognized value 'upgra' of `share.safe-mismatch.source-safe` set.
- (run `hg help config.share.safe-mismatch.source-safe`)
+ (see `hg help config.format.use-share-safe` for more information)
[255]
$ touch ../nss-share/.hg/wlock
$ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow
@@ -554,6 +558,7 @@
$ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
abort: failed to upgrade share, got error: Lock held
+ (see `hg help config.format.use-share-safe` for more information)
[255]
$ rm ../nss-share/.hg/wlock
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -282,15 +282,20 @@
scmutil.writerequires(hgvfs, diffrequires)
ui.warn(_(b'repository upgraded to use share-safe mode\n'))
except error.LockError as e:
+ hint = _(
+ "see `hg help config.format.use-share-safe` for more information"
+ )
if mismatch_config == b'upgrade-abort':
raise error.Abort(
_(b'failed to upgrade share, got error: %s')
- % stringutil.forcebytestr(e.strerror)
+ % stringutil.forcebytestr(e.strerror),
+ hint=hint,
)
elif mismatch_warn:
ui.warn(
_(b'failed to upgrade share, got error: %s\n')
- % stringutil.forcebytestr(e.strerror)
+ % stringutil.forcebytestr(e.strerror),
+ hint=hint,
)
finally:
if wlock:
@@ -334,17 +339,22 @@
scmutil.writerequires(hgvfs, current_requirements)
ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
except error.LockError as e:
+ hint = _(
+ "see `hg help config.format.use-share-safe` for more information"
+ )
# If upgrade-abort is set, abort when upgrade fails, else let the
# process continue as `upgrade-allow` is set
if mismatch_config == b'downgrade-abort':
raise error.Abort(
_(b'failed to downgrade share, got error: %s')
- % stringutil.forcebytestr(e.strerror)
+ % stringutil.forcebytestr(e.strerror),
+ hint=hint,
)
elif mismatch_warn:
ui.warn(
_(b'failed to downgrade share, got error: %s\n')
- % stringutil.forcebytestr(e.strerror)
+ % stringutil.forcebytestr(e.strerror),
+ hint=hint,
)
finally:
if wlock:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -568,6 +568,7 @@
# repository was shared the old way. We check the share source .hg/requires
# for SHARESAFE_REQUIREMENT to detect whether the current repository needs
# to be reshared
+ hint = _("see `hg help config.format.use-share-safe` for more information")
if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
if (
@@ -601,12 +602,10 @@
raise error.Abort(
_(
b"share source does not support exp-sharesafe requirement"
- )
+ ),
+ hint=hint,
)
else:
- hint = _(
- "run `hg help config.share.safe-mismatch.source-not-safe`"
- )
raise error.Abort(
_(
b"share-safe mismatch with source.\nUnrecognized"
@@ -646,10 +645,10 @@
_(
b'version mismatch: source uses share-safe'
b' functionality while the current share does not'
- )
+ ),
+ hint=hint,
)
else:
- hint = _("run `hg help config.share.safe-mismatch.source-safe`")
raise error.Abort(
_(
b"share-safe mismatch with source.\nUnrecognized"
To: marmoute, #hg-reviewers, pulkit, mharbison72
Cc: pulkit, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210122/7c7e143e/attachment-0002.html>
More information about the Mercurial-patches
mailing list