# HG changeset patch # User Yuya Nishihara # Date 2018-04-19 10:55:51 # Node ID 43221a57e22fd6d1f3d86576c057a331386fd2b9 # Parent 968ac00c4017a9316f7d7381133de4d8a01c48d3 context: translate FilteredIndex/LookupError at repo[changeid] (API) This partially backs out ecd3f6909184. It seems layering violation for repo[changeid] to raise storage-level exceptions transparently. Otherwise, we would have to rewrite callers to catch all of them. try: repo[rev_or_node] except (error.RepoLookupError, error.FilteredIndexError, error.FilteredLookupError): pass This would also fix filectx._changectx(), which catches FilteredRepoLookupError to fall back to the unfiltered path. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -497,8 +497,10 @@ class changectx(basectx): changeid = hex(changeid) except TypeError: pass - except (error.FilteredIndexError, error.FilteredLookupError, - error.FilteredRepoLookupError): + except (error.FilteredIndexError, error.FilteredLookupError): + raise error.FilteredRepoLookupError(_("filtered revision '%s'") + % changeid) + except error.FilteredRepoLookupError: raise except IndexError: pass diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -850,8 +850,7 @@ class localrepository(object): try: self[changeid] return True - except (error.RepoLookupError, error.FilteredIndexError, - error.FilteredLookupError): + except error.RepoLookupError: return False def __nonzero__(self):