Mercurial > hg-stable
diff mercurial/dispatch.py @ 34040: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 | cc047a733f69 |
children | 5361771f9714 |
line wrap: on
line diff
--- a/mercurial/dispatch.py Wed Aug 30 14:04:55 2017 -0700 +++ b/mercurial/dispatch.py Tue Aug 22 20:03:07 2017 -0400 @@ -88,7 +88,8 @@ status = -1 if util.safehasattr(req.ui, 'ferr'): if err is not None and err.errno != errno.EPIPE: - req.ui.ferr.write('abort: %s\n' % err.strerror) + req.ui.ferr.write('abort: %s\n' % + encoding.strtolocal(err.strerror)) req.ui.ferr.flush() sys.exit(status & 255) @@ -676,7 +677,7 @@ wd = pycompat.getcwd() except OSError as e: raise error.Abort(_("error getting current working directory: %s") % - e.strerror) + encoding.strtolocal(e.strerror)) path = cmdutil.findrepo(wd) or "" if not path: lui = ui