##// END OF EJS Templates
changectx: wrap the `changeid` processing in a try/except...
Pierre-Yves David -
r23012:bdb3349c default
parent child Browse files
Show More
@@ -376,6 +376,7 b' class changectx(basectx):'
376 changeid = '.'
376 changeid = '.'
377 self._repo = repo
377 self._repo = repo
378
378
379 try:
379 if isinstance(changeid, int):
380 if isinstance(changeid, int):
380 try:
381 try:
381 self._node = repo.changelog.node(changeid)
382 self._node = repo.changelog.node(changeid)
@@ -452,16 +453,18 b' class changectx(basectx):'
452 # lookup failed
453 # lookup failed
453 # check if it might have come from damaged dirstate
454 # check if it might have come from damaged dirstate
454 #
455 #
455 # XXX we could avoid the unfiltered if we had a recognizable exception
456 # XXX we could avoid the unfiltered if we had a recognizable
456 # for filtered changeset access
457 # exception for filtered changeset access
457 if changeid in repo.unfiltered().dirstate.parents():
458 if changeid in repo.unfiltered().dirstate.parents():
458 raise error.Abort(_("working directory has unknown parent '%s'!")
459 msg = _("working directory has unknown parent '%s'!")
459 % short(changeid))
460 raise error.Abort(msg % short(changeid))
460 try:
461 try:
461 if len(changeid) == 20:
462 if len(changeid) == 20:
462 changeid = hex(changeid)
463 changeid = hex(changeid)
463 except TypeError:
464 except TypeError:
464 pass
465 pass
466 except Exception:
467 raise
465 raise error.RepoLookupError(
468 raise error.RepoLookupError(
466 _("unknown revision '%s'") % changeid)
469 _("unknown revision '%s'") % changeid)
467
470
General Comments 0
You need to be logged in to leave comments. Login now