changeset 36213:59affe7e01d4

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
author Augie Fackler <augie@google.com>
date Tue, 13 Feb 2018 18:46:47 -0500
parents b42c47b8c9d4
children 0836c70ba5fa
files hgext/histedit.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)