Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.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 | 6e137da59ad9 |
children | 8b86acc7aa64 |
comparison
equal
deleted
inserted
replaced
37796:968ac00c4017 | 37797:43221a57e22f |
---|---|
495 try: | 495 try: |
496 if len(changeid) == 20 and nonascii(changeid): | 496 if len(changeid) == 20 and nonascii(changeid): |
497 changeid = hex(changeid) | 497 changeid = hex(changeid) |
498 except TypeError: | 498 except TypeError: |
499 pass | 499 pass |
500 except (error.FilteredIndexError, error.FilteredLookupError, | 500 except (error.FilteredIndexError, error.FilteredLookupError): |
501 error.FilteredRepoLookupError): | 501 raise error.FilteredRepoLookupError(_("filtered revision '%s'") |
502 % changeid) | |
503 except error.FilteredRepoLookupError: | |
502 raise | 504 raise |
503 except IndexError: | 505 except IndexError: |
504 pass | 506 pass |
505 raise error.RepoLookupError( | 507 raise error.RepoLookupError( |
506 _("unknown revision '%s'") % changeid) | 508 _("unknown revision '%s'") % changeid) |