changeset 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 968ac00c4017
children 8fa3396a832d
files mercurial/context.py mercurial/localrepo.py
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Thu Apr 19 20:22:33 2018 +0900
+++ b/mercurial/context.py	Thu Apr 19 19:55:51 2018 +0900
@@ -497,8 +497,10 @@
                     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
--- a/mercurial/localrepo.py	Thu Apr 19 20:22:33 2018 +0900
+++ b/mercurial/localrepo.py	Thu Apr 19 19:55:51 2018 +0900
@@ -850,8 +850,7 @@
         try:
             self[changeid]
             return True
-        except (error.RepoLookupError, error.FilteredIndexError,
-                error.FilteredLookupError):
+        except error.RepoLookupError:
             return False
 
     def __nonzero__(self):