clfilter: ensure context raise RepoLookupError when the revision is filtered
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 17 Dec 2012 18:09:41 +0100
changeset 18084 ee3b5fb648c7
parent 18083 717c692fa449
child 18085 4c53f015564f
clfilter: ensure context raise RepoLookupError when the revision is filtered Currently the code path of `changectx(filteredrepo, rev)` call `filteredrepo.changelog.node(rev)`. When `rev` is filtered this raise an unhandled `IndexError`. This case now raise a `RepoLookupError` as other error case do.
mercurial/context.py
--- a/mercurial/context.py	Mon Dec 17 15:08:37 2012 -0800
+++ b/mercurial/context.py	Mon Dec 17 18:09:41 2012 +0100
@@ -25,8 +25,12 @@
         self._repo = repo
 
         if isinstance(changeid, int):
+            try:
+                self._node = repo.changelog.node(changeid)
+            except IndexError:
+                raise error.RepoLookupError(
+                    _("unknown revision '%s'") % changeid)
             self._rev = changeid
-            self._node = repo.changelog.node(changeid)
             return
         if isinstance(changeid, long):
             changeid = str(changeid)