changeset 36094:142ce66a4118

narrowrevlog: replace AssertionError with ProgrammingError Differential Revision: https://phab.mercurial-scm.org/D2186
author Augie Fackler <augie@google.com>
date Mon, 12 Feb 2018 14:00:02 -0500
parents ed4e68efebfe
children 59adb3051718
files hgext/narrow/narrowrevlog.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowrevlog.py	Mon Feb 12 13:54:41 2018 -0500
+++ b/hgext/narrow/narrowrevlog.py	Mon Feb 12 14:00:02 2018 -0500
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 from mercurial import (
+   error,
    manifest,
    revlog,
    util,
@@ -67,8 +68,8 @@
         return excludeddir(self._dir, self._node)
 
     def write(self, *args):
-        raise AssertionError('Attempt to write manifest from excluded dir %s' %
-                             self._dir)
+        raise error.ProgrammingError(
+            'attempt to write manifest from excluded dir %s' % self._dir)
 
 class excludedmanifestrevlog(manifest.manifestrevlog):
     """Stand-in for excluded treemanifest revlogs.
@@ -84,20 +85,20 @@
         self._dir = dir
 
     def __len__(self):
-        raise AssertionError('Attempt to get length of excluded dir %s' %
-                             self._dir)
+        raise error.ProgrammingError(
+            'attempt to get length of excluded dir %s' % self._dir)
 
     def rev(self, node):
-        raise AssertionError('Attempt to get rev from excluded dir %s' %
-                             self._dir)
+        raise error.ProgrammingError(
+            'attempt to get rev from excluded dir %s' % self._dir)
 
     def linkrev(self, node):
-        raise AssertionError('Attempt to get linkrev from excluded dir %s' %
-                             self._dir)
+        raise error.ProgrammingError(
+            'attempt to get linkrev from excluded dir %s' % self._dir)
 
     def node(self, rev):
-        raise AssertionError('Attempt to get node from excluded dir %s' %
-                             self._dir)
+        raise error.ProgrammingError(
+            'attempt to get node from excluded dir %s' % self._dir)
 
     def add(self, *args, **kwargs):
         # We should never write entries in dirlogs outside the narrow clone.