diff --git a/hgext/notify.py b/hgext/notify.py --- a/hgext/notify.py +++ b/hgext/notify.py @@ -153,6 +153,7 @@ logcmdutil, mail, patch, + pycompat, registrar, util, ) @@ -161,6 +162,11 @@ stringutil, ) +if pycompat.ispy3: + import email.errors as emailerrors +else: + emailerrors = email.Errors + # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should # be specifying the version(s) of Mercurial they are tested with, or @@ -362,7 +368,7 @@ p = emailparser.Parser() try: msg = p.parsestr(data) - except email.Errors.MessageParseError as inst: + except emailerrors.MessageParseError as inst: raise error.Abort(inst) # store sender and subject