[PATCH 4 of 6] repoview: add a FilteredLookupError class

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Oct 16 04:30:09 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1413450306 25200
#      Thu Oct 16 02:05:06 2014 -0700
# Node ID b1c281d9e3f520f013736d74f6f1e239d0dd94d1
# Parent  2dabd90d3490e271f164a8992b86550dc3e0dfd3
repoview: add a FilteredLookupError class

This exception is a more precise LookupError that will allow us to issue special
message when we end up accessing a filtered revision.

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -188,11 +188,12 @@ class changelog(revlog.revlog):
 
     def rev(self, node):
         """filtered version of revlog.rev"""
         r = super(changelog, self).rev(node)
         if r in self.filteredrevs:
-            raise error.LookupError(hex(node), self.indexfile, _('no node'))
+            raise error.FilteredLookupError(hex(node), self.indexfile,
+                                            _('filtered node'))
         return r
 
     def node(self, rev):
         """filtered version of revlog.node"""
         if rev in self.filteredrevs:
diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -28,10 +28,13 @@ class LookupError(RevlogError, KeyError)
         RevlogError.__init__(self, '%s@%s: %s' % (index, name, message))
 
     def __str__(self):
         return RevlogError.__str__(self)
 
+class FilteredLookupError(LookupError):
+    pass
+
 class ManifestLookupError(LookupError):
     pass
 
 class CommandError(Exception):
     """Exception raised on errors in parsing the command line."""


More information about the Mercurial-devel mailing list