[PATCH 1 of 2] repoview: include the filter name in filtered revision error message

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Oct 17 18:07:48 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1413586483 25200
#      Fri Oct 17 15:54:43 2014 -0700
# Node ID eee5d61eb2fcc6dc71105ebc641be69ddbc67173
# Parent  149fc8a44184fbeddd9d9602e3860455e92c1301
repoview: include the filter name in filtered revision error message

This will help user to debug. A more precise message will be issue for the most
common case ("visible" filter) in the next changesets.

example output:

  -  abort: filtered revision '4'!
  +  abort: filtered revision '4' (not in 'visible' subset)!

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -467,12 +467,13 @@ class changectx(basectx):
                     changeid = hex(changeid)
             except TypeError:
                 pass
         except (error.FilteredIndexError, error.FilteredLookupError,
                 error.FilteredRepoLookupError):
-            raise error.FilteredRepoLookupError(_("filtered revision '%s'")
-                                                % changeid)
+            msg = _("filtered revision '%s' (not in '%s' subset)")
+            msg %= (changeid, repo.filtername)
+            raise error.FilteredRepoLookupError(msg)
         except IndexError:
             pass
         raise error.RepoLookupError(
             _("unknown revision '%s'") % changeid)
 
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -2173,11 +2173,11 @@ proper status for filtered revision
   Status: 404 Not Found\r (esc)
   ETag: *\r (glob) (esc)
   Content-Type: text/plain; charset=ascii\r (esc)
   \r (esc)
   
-  error: filtered revision '5'
+  error: filtered revision '5' (not in 'served' subset)
 
 
 
 (filtered rev)
 
@@ -2187,11 +2187,11 @@ proper status for filtered revision
   Status: 404 Not Found\r (esc)
   ETag: *\r (glob) (esc)
   Content-Type: text/plain; charset=ascii\r (esc)
   \r (esc)
   
-  error: filtered revision '4'
+  error: filtered revision '4' (not in 'served' subset)
 
 filtered '0' changeset
 
 (create new root)
   $ hg up null
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1391,11 +1391,11 @@ enable obsolete to test hidden feature
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
   $ hg log --template='{rev}:{node}\n' --hidden
   1:a765632148dc55d38c35c4f247c618701886cb2f
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
   $ hg log -r a
-  abort: filtered revision 'a'!
+  abort: filtered revision 'a' (not in 'visible' subset)!
   [255]
 
 test that parent prevent a changeset to be hidden
 
   $ hg up 1 -q --hidden
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -180,11 +180,11 @@ check that various commands work well wi
   5:5601fb93a350 (draft) [tip ] add new_3_c
   $ hg log -r 6
   abort: unknown revision '6'!
   [255]
   $ hg log -r 4
-  abort: filtered revision '4'!
+  abort: filtered revision '4' (not in 'visible' subset)!
   [255]
 
 Check that public changeset are not accounted as obsolete:
 
   $ hg --hidden phase --public 2


More information about the Mercurial-devel mailing list