changectx: move `IndexError` handling in the top level try except
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 15 Oct 2014 16:14:50 -0700
changeset 23013 b50ed6b9b513
parent 23012 bdb3349cf7ab
child 23014 f00813325c5a
changectx: move `IndexError` handling in the top level try except This one can be handled by the top level catching.
mercurial/context.py
--- a/mercurial/context.py	Wed Oct 15 16:05:24 2014 -0700
+++ b/mercurial/context.py	Wed Oct 15 16:14:50 2014 -0700
@@ -378,11 +378,7 @@
 
         try:
             if isinstance(changeid, int):
-                try:
-                    self._node = repo.changelog.node(changeid)
-                except IndexError:
-                    raise error.RepoLookupError(
-                        _("unknown revision '%s'") % changeid)
+                self._node = repo.changelog.node(changeid)
                 self._rev = changeid
                 return
             if isinstance(changeid, long):
@@ -463,8 +459,8 @@
                     changeid = hex(changeid)
             except TypeError:
                 pass
-        except Exception:
-            raise
+        except IndexError:
+            pass
         raise error.RepoLookupError(
             _("unknown revision '%s'") % changeid)