D2244: histedit: binascii.unhexlify (aka node.bin) throws new exception type on py3

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Feb 14 00:13:29 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Lucky for us, the exception type exists on 2.7, so we can include it
  in the except block without any extra work.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2244

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -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)
 



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list