diff mercurial/context.py @ 23017:dc25ed84bee8

changectx: issue a FilteredRepoLookupError when applicable We capture FilteredxxxError and issue a FilteredRepoLookupError instead with a sightly different messsge. The message will likely get more improvement in the future. error: filtered revision '4'
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 15 Oct 2014 20:37:44 -0700
parents b50ed6b9b513
children a4dd270a419c
line wrap: on
line diff
--- a/mercurial/context.py	Thu Oct 16 02:06:12 2014 -0700
+++ b/mercurial/context.py	Wed Oct 15 20:37:44 2014 -0700
@@ -400,6 +400,8 @@
                     self._node = changeid
                     self._rev = repo.changelog.rev(changeid)
                     return
+                except error.FilteredRepoLookupError:
+                    raise
                 except LookupError:
                     pass
 
@@ -415,6 +417,8 @@
                 self._rev = r
                 self._node = repo.changelog.node(r)
                 return
+            except error.FilteredIndexError:
+                raise
             except (ValueError, OverflowError, IndexError):
                 pass
 
@@ -423,6 +427,8 @@
                     self._node = bin(changeid)
                     self._rev = repo.changelog.rev(self._node)
                     return
+                except error.FilteredLookupError:
+                    raise
                 except (TypeError, LookupError):
                     pass
 
@@ -438,10 +444,12 @@
                 self._node = repo.branchtip(changeid)
                 self._rev = repo.changelog.rev(self._node)
                 return
+            except error.FilteredRepoLookupError:
+                raise
             except error.RepoLookupError:
                 pass
 
-            self._node = repo.changelog._partialmatch(changeid)
+            self._node = repo.unfiltered().changelog._partialmatch(changeid)
             if self._node is not None:
                 self._rev = repo.changelog.rev(self._node)
                 return
@@ -459,6 +467,10 @@
                     changeid = hex(changeid)
             except TypeError:
                 pass
+        except (error.FilteredIndexError, error.FilteredLookupError,
+                error.FilteredRepoLookupError):
+            raise error.FilteredRepoLookupError(_("filtered revision '%s'")
+                                                % changeid)
         except IndexError:
             pass
         raise error.RepoLookupError(