changeset 42873:7907008a0bb5

flagutil: make the error class used by the mixin configurable One of the code duplication use a different error class. So let's make it possible to do so. Differential Revision: https://phab.mercurial-scm.org/D6798
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Aug 2019 01:15:44 +0200
parents a5c088966d6c
children 705428da231f
files mercurial/revlogutils/flagutil.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/flagutil.py	Sat Sep 07 09:56:45 2019 -0700
+++ b/mercurial/revlogutils/flagutil.py	Thu Aug 08 01:15:44 2019 +0200
@@ -87,6 +87,8 @@
     See the documentation of the ``_processflags`` method for details.
     """
 
+    _flagserrorclass = error.RevlogError
+
     def _processflags(self, text, flags, operation, raw=False):
         """Inspect revision data flags and applies transforms defined by
         registered flag processors.
@@ -117,8 +119,8 @@
                                          operation)
         # Check all flags are known.
         if flags & ~REVIDX_KNOWN_FLAGS:
-            raise error.RevlogError(_("incompatible revision flag '%#x'") %
-                                    (flags & ~REVIDX_KNOWN_FLAGS))
+            raise self._flagserrorclass(_("incompatible revision flag '%#x'") %
+                                        (flags & ~REVIDX_KNOWN_FLAGS))
         validatehash = True
         # Depending on the operation (read or write), the order might be
         # reversed due to non-commutative transforms.
@@ -134,7 +136,7 @@
 
                 if flag not in self._flagprocessors:
                     message = _("missing processor for flag '%#x'") % (flag)
-                    raise error.RevlogError(message)
+                    raise self._flagserrorclass(message)
 
                 processor = self._flagprocessors[flag]
                 if processor is not None: