diff mercurial/subrepo.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 db83a1df03fe
children 6d21737c35bf
line wrap: on
line diff
--- a/mercurial/subrepo.py	Wed Aug 30 14:04:55 2017 -0700
+++ b/mercurial/subrepo.py	Tue Aug 22 20:03:07 2017 -0400
@@ -1346,7 +1346,8 @@
             genericerror = _("error executing git for subrepo '%s': %s")
             notfoundhint = _("check git is installed and in your PATH")
             if e.errno != errno.ENOENT:
-                raise error.Abort(genericerror % (self._path, e.strerror))
+                raise error.Abort(genericerror % (
+                    self._path, encoding.strtolocal(e.strerror)))
             elif pycompat.osname == 'nt':
                 try:
                     self._gitexecutable = 'git.cmd'
@@ -1358,7 +1359,7 @@
                             hint=notfoundhint)
                     else:
                         raise error.Abort(genericerror % (self._path,
-                            e2.strerror))
+                            encoding.strtolocal(e2.strerror)))
             else:
                 raise error.Abort(_("couldn't find git for subrepo '%s'")
                     % self._path, hint=notfoundhint)