[Request] [+- ] D9841: share-share: have the hint issue more consistently and point to the right doc
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Wed Jan 20 11:53:53 UTC 2021
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This should help user in trouble to find solution in the documentation.
REPOSITORY
rHG Mercurial
BRANCH
default
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
@@ -575,6 +575,9 @@
and requirementsmod.SHARESAFE_REQUIREMENT
not in _readrequires(sharedvfs, True)
):
+ hint = _(
+ "see `hg help config.format.use-share-safe` for more information"
+ )
mismatch_warn = ui.configbool(
b'share', b'safe-mismatch.source-not-safe.warn'
)
@@ -601,12 +604,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"
@@ -620,6 +621,9 @@
requirements |= _readrequires(storevfs, False)
elif shared:
sourcerequires = _readrequires(sharedvfs, False)
+ hint = _(
+ "see `hg help config.format.use-share-safe` for more information"
+ )
if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires:
mismatch_config = ui.config(b'share', b'safe-mismatch.source-safe')
mismatch_warn = ui.configbool(
@@ -646,10 +650,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
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210120/c2bec0d9/attachment-0001.html>
More information about the Mercurial-patches
mailing list