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

Yuya Nishihara yuya at tcha.org
Sun Dec 16 09:02:15 UTC 2018


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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:


More information about the Mercurial-devel mailing list