diff mercurial/upgrade.py @ 46348:4a58561ace0f stable

share-share: have the hint issue more consistently and point to the right doc This should help user in trouble to find solution in the documentation. Differential Revision: https://phab.mercurial-scm.org/D9841
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 20 Jan 2021 12:23:40 +0100
parents 4f17773fc6b5
children 16c18d5e5dc8
line wrap: on
line diff
--- a/mercurial/upgrade.py	Wed Jan 20 12:13:17 2021 +0100
+++ b/mercurial/upgrade.py	Wed Jan 20 12:23:40 2021 +0100
@@ -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: