comparison hgext/histedit.py @ 27547:1cbfeb1dc5aa

histedit: handle exceptions from node.bin in fromrule
author timeless <timeless@mozdev.org>
date Wed, 23 Dec 2015 23:51:29 +0000
parents c00924c54607
children cfb26146a8cd
comparison
equal deleted inserted replaced
27546:c00924c54607 27547:1cbfeb1dc5aa
354 @classmethod 354 @classmethod
355 def fromrule(cls, state, rule): 355 def fromrule(cls, state, rule):
356 """Parses the given rule, returning an instance of the histeditaction. 356 """Parses the given rule, returning an instance of the histeditaction.
357 """ 357 """
358 rulehash = rule.strip().split(' ', 1)[0] 358 rulehash = rule.strip().split(' ', 1)[0]
359 return cls(state, node.bin(rulehash)) 359 try:
360 rev = node.bin(rulehash)
361 except TypeError:
362 raise error.ParseError("invalid changeset %s" % rulehash)
363 return cls(state, rev)
360 364
361 def verify(self, prev): 365 def verify(self, prev):
362 """ Verifies semantic correctness of the rule""" 366 """ Verifies semantic correctness of the rule"""
363 repo = self.repo 367 repo = self.repo
364 ha = node.hex(self.node) 368 ha = node.hex(self.node)