diff mercurial/cmdutil.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 205c47e30a93
children 6e6452bc441d
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Aug 30 14:04:55 2017 -0700
+++ b/mercurial/cmdutil.py	Tue Aug 22 20:03:07 2017 -0400
@@ -777,7 +777,7 @@
                 message = '\n'.join(util.readfile(logfile).splitlines())
         except IOError as inst:
             raise error.Abort(_("can't read commit message '%s': %s") %
-                             (logfile, inst.strerror))
+                             (logfile, encoding.strtolocal(inst.strerror)))
     return message
 
 def mergeeditform(ctxorbool, baseformname):
@@ -1099,7 +1099,7 @@
                     srcexists = False
                 else:
                     ui.warn(_('%s: cannot copy - %s\n') %
-                            (relsrc, inst.strerror))
+                            (relsrc, encoding.strtolocal(inst.strerror)))
                     return True # report a failure
 
         if ui.verbose or not exact: