changeset 23046:c1aede895072

repoview: issue a special message when filtering hidden changesets Hidden changesets are by far the most common error case and is the only one[1] that can reach the user. We move to a friendlier message with a hint about how to access the data anyway. We should probably point to a help topic instead but we do not have such a topic yet. Example of the new output abort: hidden revision '4'! (use --hidden to access hidden revisions) [1] Actually, filtering from "served" can also reach the user during certain exchange operations.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 17 Oct 2014 15:25:32 -0700
parents a4dd270a419c
children f10019d2ee0a
files mercurial/context.py tests/test-log.t tests/test-obsolete.t
diffstat 3 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Oct 17 15:54:43 2014 -0700
+++ b/mercurial/context.py	Fri Oct 17 15:25:32 2014 -0700
@@ -469,6 +469,10 @@
                 pass
         except (error.FilteredIndexError, error.FilteredLookupError,
                 error.FilteredRepoLookupError):
+            if repo.filtername == 'visible':
+                msg = _("hidden revision '%s'") % changeid
+                hint = _('use --hidden to access hidden revisions')
+                raise error.FilteredRepoLookupError(msg, hint=hint)
             msg = _("filtered revision '%s' (not in '%s' subset)")
             msg %= (changeid, repo.filtername)
             raise error.FilteredRepoLookupError(msg)
--- a/tests/test-log.t	Fri Oct 17 15:54:43 2014 -0700
+++ b/tests/test-log.t	Fri Oct 17 15:25:32 2014 -0700
@@ -1393,7 +1393,8 @@
   1:a765632148dc55d38c35c4f247c618701886cb2f
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
   $ hg log -r a
-  abort: filtered revision 'a' (not in 'visible' subset)!
+  abort: hidden revision 'a'!
+  (use --hidden to access hidden revisions)
   [255]
 
 test that parent prevent a changeset to be hidden
--- a/tests/test-obsolete.t	Fri Oct 17 15:54:43 2014 -0700
+++ b/tests/test-obsolete.t	Fri Oct 17 15:25:32 2014 -0700
@@ -182,7 +182,8 @@
   abort: unknown revision '6'!
   [255]
   $ hg log -r 4
-  abort: filtered revision '4' (not in 'visible' subset)!
+  abort: hidden revision '4'!
+  (use --hidden to access hidden revisions)
   [255]
 
 Check that public changeset are not accounted as obsolete: