diff --git a/mercurial/configitems.py b/mercurial/configitems.py index 9796cf108e4eac4f6853daaaad87521067750fcc_bWVyY3VyaWFsL2NvbmZpZ2l0ZW1zLnB5..d159d0fafa78eee8c7f6ac8a3693e9baa548ee4f_bWVyY3VyaWFsL2NvbmZpZ2l0ZW1zLnB5 100644 --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1084,6 +1084,11 @@ ) coreconfigitem( b'experimental', + b'sharesafe-auto-upgrade-fail-error', + default=False, +) +coreconfigitem( + b'experimental', b'sharesafe-warn-outdated-shares', default=True, ) diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py index 9796cf108e4eac4f6853daaaad87521067750fcc_bWVyY3VyaWFsL3VwZ3JhZGUucHk=..d159d0fafa78eee8c7f6ac8a3693e9baa548ee4f_bWVyY3VyaWFsL3VwZ3JhZGUucHk= 100644 --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -257,7 +257,12 @@ current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT) ui.warn(_(b'repository upgraded to use share-safe mode\n')) except error.LockError as e: - if ui.configbool(b'experimental', b'sharesafe-warn-outdated-shares'): + if ui.configbool(b'experimental', b'sharesafe-auto-upgrade-fail-error'): + raise error.Abort( + _(b'failed to upgrade share, got error: %s') + % stringutil.forcebytestr(e.strerror) + ) + elif ui.configbool(b'experimental', b'sharesafe-warn-outdated-shares'): ui.warn( _(b'failed to upgrade share, got error: %s\n') % stringutil.forcebytestr(e.strerror) diff --git a/tests/test-share-safe.t b/tests/test-share-safe.t index 9796cf108e4eac4f6853daaaad87521067750fcc_dGVzdHMvdGVzdC1zaGFyZS1zYWZlLnQ=..d159d0fafa78eee8c7f6ac8a3693e9baa548ee4f_dGVzdHMvdGVzdC1zaGFyZS1zYWZlLnQ= 100644 --- a/tests/test-share-safe.t +++ b/tests/test-share-safe.t @@ -557,6 +557,10 @@ o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo + $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true --config experimental.sharesafe-auto-upgrade-fail-error=true + abort: failed to upgrade share, got error: Lock held + [255] + $ 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