changectx: issue a FilteredRepoLookupError when applicable
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 15 Oct 2014 20:37:44 -0700
changeset 23017 dc25ed84bee8
parent 23016 2bd51e61c65e
child 23018 73d9d5548dfe
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'
mercurial/context.py
tests/test-hgweb-commands.t
tests/test-log.t
tests/test-obsolete.t
--- 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(
--- a/tests/test-hgweb-commands.t	Thu Oct 16 02:06:12 2014 -0700
+++ b/tests/test-hgweb-commands.t	Wed Oct 15 20:37:44 2014 -0700
@@ -2175,7 +2175,7 @@
   Content-Type: text/plain; charset=ascii\r (esc)
   \r (esc)
   
-  error: unknown revision '5'
+  error: filtered revision '5'
 
 
 
@@ -2189,7 +2189,7 @@
   Content-Type: text/plain; charset=ascii\r (esc)
   \r (esc)
   
-  error: unknown revision '4'
+  error: filtered revision '4'
 
 filtered '0' changeset
 
--- a/tests/test-log.t	Thu Oct 16 02:06:12 2014 -0700
+++ b/tests/test-log.t	Wed Oct 15 20:37:44 2014 -0700
@@ -1393,7 +1393,7 @@
   1:a765632148dc55d38c35c4f247c618701886cb2f
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
   $ hg log -r a
-  abort: unknown revision 'a'!
+  abort: filtered revision 'a'!
   [255]
 
 test that parent prevent a changeset to be hidden
--- a/tests/test-obsolete.t	Thu Oct 16 02:06:12 2014 -0700
+++ b/tests/test-obsolete.t	Wed Oct 15 20:37:44 2014 -0700
@@ -182,7 +182,7 @@
   abort: unknown revision '6'!
   [255]
   $ hg log -r 4
-  abort: unknown revision '4'!
+  abort: filtered revision '4'!
   [255]
 
 Check that public changeset are not accounted as obsolete: