# HG changeset patch # User Matt Harbison # Date 2023-01-06 05:05:14 # Node ID 5392bf258049dbd3961bf25211da43f2101df91e # Parent 5f006f789373d1ce340bf51a90b4ec8b2e13e9af hooklib: force an exception wrapped by errors.Abort to bytestr Flagged by PyCharm and pytype. diff --git a/hgext/hooklib/changeset_obsoleted.py b/hgext/hooklib/changeset_obsoleted.py --- a/hgext/hooklib/changeset_obsoleted.py +++ b/hgext/hooklib/changeset_obsoleted.py @@ -32,7 +32,10 @@ from mercurial import ( pycompat, registrar, ) -from mercurial.utils import dateutil +from mercurial.utils import ( + dateutil, + stringutil, +) from .. import notify configtable = {} @@ -98,7 +101,7 @@ def _report_commit(ui, repo, ctx): try: msg = mail.parsebytes(data) except emailerrors.MessageParseError as inst: - raise error.Abort(inst) + raise error.Abort(stringutil.forcebytestr(inst)) msg['In-reply-to'] = notify.messageid(ctx, domain, messageidseed) msg['Message-Id'] = notify.messageid( diff --git a/hgext/hooklib/changeset_published.py b/hgext/hooklib/changeset_published.py --- a/hgext/hooklib/changeset_published.py +++ b/hgext/hooklib/changeset_published.py @@ -31,7 +31,10 @@ from mercurial import ( pycompat, registrar, ) -from mercurial.utils import dateutil +from mercurial.utils import ( + dateutil, + stringutil, +) from .. import notify configtable = {} @@ -97,7 +100,7 @@ def _report_commit(ui, repo, ctx): try: msg = mail.parsebytes(data) except emailerrors.MessageParseError as inst: - raise error.Abort(inst) + raise error.Abort(stringutil.forcebytestr(inst)) msg['In-reply-to'] = notify.messageid(ctx, domain, messageidseed) msg['Message-Id'] = notify.messageid(