changeset 40284:46b55f279571

notify: adapt to new location of email module's errors Differential Revision: https://phab.mercurial-scm.org/D5099
author Augie Fackler <augie@google.com>
date Sun, 14 Oct 2018 05:28:01 -0400
parents c7a363ca04b9
children 96164fb9b913
files hgext/notify.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/notify.py	Sun Oct 14 04:33:47 2018 -0400
+++ b/hgext/notify.py	Sun Oct 14 05:28:01 2018 -0400
@@ -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