Patchwork [1,of,2] py3: use forcebytestr() to stringify hook exception

login
register
mail settings
Submitter Yuya Nishihara
Date Dec. 16, 2018, 9:02 a.m.
Message ID <8c8fcb385c46890e1dc5.1544950935@mimosa>
Download mbox | patch
Permalink /patch/37210/
State Accepted
Headers show

Comments

Yuya Nishihara - Dec. 16, 2018, 9:02 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1544950397 -32400
#      Sun Dec 16 17:53:17 2018 +0900
# Node ID 8c8fcb385c46890e1dc5d00ce3ced360974cecef
# Parent  7654291091cf35aade1d8e628def25a2fc3b567a
py3: use forcebytestr() to stringify hook exception

This fixes test-narrow-exchange.t.
Pulkit Goyal - Dec. 16, 2018, 1:17 p.m.
On Sun, Dec 16, 2018 at 12:03 PM Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1544950397 -32400
> #      Sun Dec 16 17:53:17 2018 +0900
> # Node ID 8c8fcb385c46890e1dc5d00ce3ced360974cecef
> # Parent  7654291091cf35aade1d8e628def25a2fc3b567a
> py3: use forcebytestr() to stringify hook exception
>
> This fixes test-narrow-exchange.t.
>

Queued the series, many many thanks!

Patch

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -102,7 +102,7 @@  def pythonhook(ui, repo, htype, hname, f
                          (hname, exc.args[0]))
         else:
             ui.warn(_('error: %s hook raised an exception: '
-                      '%s\n') % (hname, encoding.strtolocal(str(exc))))
+                      '%s\n') % (hname, stringutil.forcebytestr(exc)))
         if throw:
             raise
         if not ui.tracebackflag: