Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 37797:43221a57e22f stable
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 19 Apr 2018 19:55:51 +0900 |
parents | 0664be4f0c1f |
children | 856f381ad74b |
comparison
equal
deleted
inserted
replaced
37796:968ac00c4017 | 37797:43221a57e22f |
---|---|
848 error.LookupError is raised if an ambiguous node specified. | 848 error.LookupError is raised if an ambiguous node specified. |
849 """ | 849 """ |
850 try: | 850 try: |
851 self[changeid] | 851 self[changeid] |
852 return True | 852 return True |
853 except (error.RepoLookupError, error.FilteredIndexError, | 853 except error.RepoLookupError: |
854 error.FilteredLookupError): | |
855 return False | 854 return False |
856 | 855 |
857 def __nonzero__(self): | 856 def __nonzero__(self): |
858 return True | 857 return True |
859 | 858 |