Patchwork [1,of,5] scmutil: display the optional hint when handling StorageError in catchall()

login
register
mail settings
Submitter Matt Harbison
Date Nov. 16, 2018, 2:53 a.m.
Message ID <932374eda2e70124e381.1542336830@Envy>
Download mbox | patch
Permalink /patch/36618/
State Accepted
Headers show

Comments

Matt Harbison - Nov. 16, 2018, 2:53 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1542322214 18000
#      Thu Nov 15 17:50:14 2018 -0500
# Node ID 932374eda2e70124e381b258495489c66a676557
# Parent  85372dc0cca34f5232c3d29161e1f09e797cd8ec
scmutil: display the optional hint when handling StorageError in catchall()

Other than CensoredNodeError (which is also a StorageError), it looks like all
exceptions with a hint display them.  I'm not sure that it makes sense to have a
hint for censored nodes, so I'm not bothering with that.

It looks like nobody is using this yet, as the tests don't change.
Yuya Nishihara - Nov. 17, 2018, 4:29 a.m.
On Thu, 15 Nov 2018 21:53:50 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1542322214 18000
> #      Thu Nov 15 17:50:14 2018 -0500
> # Node ID 932374eda2e70124e381b258495489c66a676557
> # Parent  85372dc0cca34f5232c3d29161e1f09e797cd8ec
> scmutil: display the optional hint when handling StorageError in catchall()

Queued, thanks.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -212,6 +212,8 @@  def callcatch(ui, func):
         ui.error(_("abort: file censored %s!\n") % inst)
     except error.StorageError as inst:
         ui.error(_("abort: %s!\n") % inst)
+        if inst.hint:
+            ui.error(_("(%s)\n") % inst.hint)
     except error.InterventionRequired as inst:
         ui.error("%s\n" % inst)
         if inst.hint: