diff hgext/mq.py @ 34022:d5b2beca16c0

python3: wrap all uses of <exception>.strerror with strtolocal Our string literals are bytes, and we mostly want to %-format a strerror into a one of those literals, so this fixes a ton of issues.
author Augie Fackler <raf@durin42.com>
date Tue, 22 Aug 2017 20:03:07 -0400
parents 870560c759ed
children 08346a8fa65f
line wrap: on
line diff
--- a/hgext/mq.py	Wed Aug 30 14:04:55 2017 -0700
+++ b/hgext/mq.py	Tue Aug 22 20:03:07 2017 -0400
@@ -80,6 +80,7 @@
     cmdutil,
     commands,
     dirstateguard,
+    encoding,
     error,
     extensions,
     hg,
@@ -1206,7 +1207,7 @@
                 p = self.opener(patchfn, "w")
             except IOError as e:
                 raise error.Abort(_('cannot write patch "%s": %s')
-                                 % (patchfn, e.strerror))
+                                 % (patchfn, encoding.strtolocal(e.strerror)))
             try:
                 defaultmsg = "[mq]: %s" % patchfn
                 editor = cmdutil.getcommiteditor(editform=editform)