[PATCH 1 of 5 filtering part 2] clfilter: ensure context raise RepoLookupError when the revision is filtered
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Dec 4 00:26:54 UTC 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1354489919 -3600
# Node ID 9ccccb02c2771df1b554c4424d144de5a4dd2e47
# Parent 9b05b31b413c55d750ca8be41330ff65fa9ed8c1
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.
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -23,10 +23,15 @@ class changectx(object):
if changeid == '':
changeid = '.'
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)
More information about the Mercurial-devel
mailing list