diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3899,7 +3899,7 @@ try: return hg.updatetotally(ui, repo, checkout, brev) except error.UpdateAbort as inst: - msg = _("not updating: %s") % str(inst) + msg = _("not updating: %s") % util.forcebytestr(inst) hint = inst.hint raise error.UpdateAbort(msg, hint=hint) if modheads > 1: diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -2149,7 +2149,8 @@ continue except error.UnsupportedBundleSpecification as e: repo.ui.debug('filtering %s because unsupported bundle ' - 'spec: %s\n' % (entry['URL'], str(e))) + 'spec: %s\n' % ( + entry['URL'], util.forcebytestr(e))) continue # If we don't have a spec and requested a stream clone, we don't know # what the entry is so don't attempt to apply it. @@ -2254,7 +2255,8 @@ bundle2.applybundle(repo, cg, tr, 'clonebundles', url) return True except urlerr.httperror as e: - ui.warn(_('HTTP error fetching bundle: %s\n') % str(e)) + ui.warn(_('HTTP error fetching bundle: %s\n') % + util.forcebytestr(e)) except urlerr.urlerror as e: ui.warn(_('error fetching bundle: %s\n') % e.reason) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -259,7 +259,8 @@ bundle2.processbundle(self._repo, b) raise except error.PushRaced as exc: - raise error.ResponseError(_('push failed:'), str(exc)) + raise error.ResponseError(_('push failed:'), + util.forcebytestr(exc)) # End of _basewirecommands interface. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -208,7 +208,7 @@ ui.warn(_("(%s)\n") % inst.hint) except ImportError as inst: ui.warn(_("abort: %s!\n") % inst) - m = str(inst).split()[-1] + m = util.forcebytestr(inst).split()[-1] if m in "mpatch bdiff".split(): ui.warn(_("(did you forget to compile extensions?)\n")) elif m in "zlib".split(): diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -366,7 +366,7 @@ except error.ConfigError as inst: if trusted: raise - self.warn(_("ignored: %s\n") % str(inst)) + self.warn(_("ignored: %s\n") % util.forcebytestr(inst)) if self.plain(): for k in ('debug', 'fallbackencoding', 'quiet', 'slash', diff --git a/mercurial/url.py b/mercurial/url.py --- a/mercurial/url.py +++ b/mercurial/url.py @@ -449,7 +449,7 @@ self.cookiejar = cookiejar except util.cookielib.LoadError as e: ui.warn(_('(error loading cookie file %s: %s; continuing without ' - 'cookies)\n') % (cookiefile, str(e))) + 'cookies)\n') % (cookiefile, util.forcebytestr(e))) def http_request(self, request): if self.cookiejar: diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -3634,7 +3634,7 @@ return zlib.decompress(data) except zlib.error as e: raise error.RevlogError(_('revlog decompress error: %s') % - str(e)) + forcebytestr(e)) def revlogcompressor(self, opts=None): return self.zlibrevlogcompressor() @@ -3860,7 +3860,7 @@ return ''.join(chunks) except Exception as e: raise error.RevlogError(_('revlog decompress error: %s') % - str(e)) + forcebytestr(e)) def revlogcompressor(self, opts=None): opts = opts or {}