comparison mercurial/context.py @ 23013:b50ed6b9b513

changectx: move `IndexError` handling in the top level try except This one can be handled by the top level catching.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 15 Oct 2014 16:14:50 -0700
parents bdb3349cf7ab
children dc25ed84bee8
comparison
equal deleted inserted replaced
23012:bdb3349cf7ab 23013:b50ed6b9b513
376 changeid = '.' 376 changeid = '.'
377 self._repo = repo 377 self._repo = repo
378 378
379 try: 379 try:
380 if isinstance(changeid, int): 380 if isinstance(changeid, int):
381 try: 381 self._node = repo.changelog.node(changeid)
382 self._node = repo.changelog.node(changeid)
383 except IndexError:
384 raise error.RepoLookupError(
385 _("unknown revision '%s'") % changeid)
386 self._rev = changeid 382 self._rev = changeid
387 return 383 return
388 if isinstance(changeid, long): 384 if isinstance(changeid, long):
389 changeid = str(changeid) 385 changeid = str(changeid)
390 if changeid == '.': 386 if changeid == '.':
461 try: 457 try:
462 if len(changeid) == 20: 458 if len(changeid) == 20:
463 changeid = hex(changeid) 459 changeid = hex(changeid)
464 except TypeError: 460 except TypeError:
465 pass 461 pass
466 except Exception: 462 except IndexError:
467 raise 463 pass
468 raise error.RepoLookupError( 464 raise error.RepoLookupError(
469 _("unknown revision '%s'") % changeid) 465 _("unknown revision '%s'") % changeid)
470 466
471 def __hash__(self): 467 def __hash__(self):
472 try: 468 try: