diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -559,7 +559,7 @@ pass # try next encoding except LookupError as inst: # unknown encoding, maybe raise error.Abort( - inst, + pycompat.bytestr(inst), hint=_( b'check convert.cvsps.logencoding configuration' ), diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -207,7 +207,9 @@ # can't round-trip return u.encode(_sysstr(encoding), "replace") except LookupError as k: - raise error.Abort(k, hint=b"please check your locale settings") + raise error.Abort( + pycompat.bytestr(k), hint=b"please check your locale settings" + ) def fromlocal(s): diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1720,7 +1720,7 @@ repo = reporef() cm = _(b'accept incoming changes (yn)?$$ &Yes $$ &No') if repo.ui.promptchoice(cm): - raise error.Abort("user aborted") + raise error.Abort(b"user aborted") tr.addvalidator(b'900-pull-prompt', prompt) diff --git a/tests/failfilemerge.py b/tests/failfilemerge.py --- a/tests/failfilemerge.py +++ b/tests/failfilemerge.py @@ -12,7 +12,7 @@ def failfilemerge( filemergefn, premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None ): - raise error.Abort("^C") + raise error.Abort(b"^C") return filemergefn(premerge, repo, mynode, orig, fcd, fco, fca, labels) diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t --- a/tests/test-bundle2-format.t +++ b/tests/test-bundle2-format.t @@ -22,6 +22,7 @@ > from mercurial import changegroup > from mercurial import error > from mercurial import obsolete + > from mercurial import pycompat > from mercurial import registrar > from mercurial.utils import procutil > @@ -169,7 +170,7 @@ > for chunk in bundler.getchunks(): > file.write(chunk) > except RuntimeError as exc: - > raise error.Abort(exc) + > raise error.Abort(pycompat.bytestr(exc)) > finally: > file.flush() > diff --git a/tests/test-dirstate.t b/tests/test-dirstate.t --- a/tests/test-dirstate.t +++ b/tests/test-dirstate.t @@ -74,7 +74,7 @@ > ) > > def wraprecordupdates(*args): - > raise error.Abort("simulated error while recording dirstateupdates") + > raise error.Abort(b"simulated error while recording dirstateupdates") > > def reposetup(ui, repo): > extensions.wrapfunction(mergestatemod, 'recordupdates', diff --git a/tests/test-fncache.t b/tests/test-fncache.t --- a/tests/test-fncache.t +++ b/tests/test-fncache.t @@ -238,7 +238,7 @@ > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs): > def releasewrap(): > l.held = False # ensure __del__ is a noop - > raise error.Abort("forced lock failure") + > raise error.Abort(b"forced lock failure") > l = orig(vfs, lockname, wait, releasewrap, *args, **kwargs) > return l > diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t --- a/tests/test-histedit-edit.t +++ b/tests/test-histedit-edit.t @@ -311,7 +311,7 @@ > def reposetup(ui, repo): > class commitfailure(repo.__class__): > def commit(self, *args, **kwargs): - > raise error.Abort('emulating unexpected abort') + > raise error.Abort(b'emulating unexpected abort') > repo.__class__ = commitfailure > EOF $ cat >> .hg/hgrc < ) > def applyupdates(orig, *args, **kwargs): > orig(*args, **kwargs) - > raise error.Abort('intentional aborting') + > raise error.Abort(b'intentional aborting') > def extsetup(ui): > extensions.wrapfunction(merge, "applyupdates", applyupdates) > EOF diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t --- a/tests/test-mq-qfold.t +++ b/tests/test-mq-qfold.t @@ -153,7 +153,7 @@ > def reposetup(ui, repo): > class commitfailure(repo.__class__): > def commit(self, *args, **kwargs): - > raise error.Abort('emulating unexpected abort') + > raise error.Abort(b'emulating unexpected abort') > repo.__class__ = commitfailure > EOF diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t --- a/tests/test-mq-qnew.t +++ b/tests/test-mq-qnew.t @@ -256,7 +256,7 @@ > def reposetup(ui, repo): > class commitfailure(repo.__class__): > def commit(self, *args, **kwargs): - > raise error.Abort('emulating unexpected abort') + > raise error.Abort(b'emulating unexpected abort') > repo.__class__ = commitfailure > EOF $ cat >> .hg/hgrc < ) > def _pullbookmarks(orig, pullop): > orig(pullop) - > raise error.HookAbort('forced failure by extension') + > raise error.HookAbort(b'forced failure by extension') > def extsetup(ui): > extensions.wrapfunction(exchange, '_pullbookmarks', _pullbookmarks) > EOF diff --git a/tests/test-sparse-import.t b/tests/test-sparse-import.t --- a/tests/test-sparse-import.t +++ b/tests/test-sparse-import.t @@ -153,7 +153,7 @@ > from mercurial import error, sparse > def extsetup(ui): > def abort_refresh(*args, **kwargs): - > raise error.Abort('sparse._refresh called!') + > raise error.Abort(b'sparse._refresh called!') > sparse.refreshwdir = abort_refresh > EOF $ cat >> $HGRCPATH <