histedit: binascii.unhexlify (aka node.bin) throws new exception type on py3
authorAugie Fackler <augie@google.com>
Tue, 13 Feb 2018 18:46:47 -0500
changeset 36213 59affe7e01d4
parent 36212 b42c47b8c9d4
child 36214 0836c70ba5fa
histedit: binascii.unhexlify (aka node.bin) throws new exception type on py3 Lucky for us, the exception type exists on 2.7, so we can include it in the except block without any extra work. Differential Revision: https://phab.mercurial-scm.org/D2244
hgext/histedit.py
--- a/hgext/histedit.py	Tue Feb 13 13:23:18 2018 -0800
+++ b/hgext/histedit.py	Tue Feb 13 18:46:47 2018 -0500
@@ -183,6 +183,7 @@
 
 from __future__ import absolute_import
 
+import binascii
 import errno
 import os
 
@@ -425,7 +426,7 @@
         rulehash = rule.strip().split(' ', 1)[0]
         try:
             rev = node.bin(rulehash)
-        except TypeError:
+        except (TypeError, binascii.Error):
             raise error.ParseError("invalid changeset %s" % rulehash)
         return cls(state, rev)