D4652: revlog: drop some more error aliases (API)

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sun Sep 23 06:13:20 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4a2466b2a434: revlog: drop some more error aliases (API) (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4652?vs=11186&id=11278

REVISION DETAIL
  https://phab.mercurial-scm.org/D4652

AFFECTED FILES
  mercurial/revlog.py
  mercurial/revlogutils/deltas.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -33,8 +33,6 @@
     mdiff,
 )
 
-CensoredNodeError = error.CensoredNodeError
-
 # maximum <delta-chain-data>/<revision-text-length> ratio
 LIMIT_DELTA2TEXT = 2
 
@@ -460,7 +458,7 @@
             revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2)
         if flags & REVIDX_ISCENSORED:
             raise error.RevlogError(_('node %s is not censored') % expectednode)
-    except CensoredNodeError:
+    except error.CensoredNodeError:
         # must pass the censored index flag to add censored revisions
         if not flags & REVIDX_ISCENSORED:
             raise
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -105,9 +105,6 @@
 _chunksize = 1048576
 
 LookupError = error.LookupError
-AmbiguousPrefixLookupError = error.AmbiguousPrefixLookupError
-CensoredNodeError = error.CensoredNodeError
-ProgrammingError = error.ProgrammingError
 
 # Store flag processors (cf. 'addflagprocessor()' to register)
 _flagprocessors = {
@@ -180,10 +177,10 @@
     """
     if not flag & REVIDX_KNOWN_FLAGS:
         msg = _("cannot register processor on unknown flag '%#x'.") % (flag)
-        raise ProgrammingError(msg)
+        raise error.ProgrammingError(msg)
     if flag not in REVIDX_FLAGS_ORDER:
         msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % (flag)
-        raise ProgrammingError(msg)
+        raise error.ProgrammingError(msg)
     if flag in _flagprocessors:
         msg = _("cannot register multiple processors on flag '%#x'.") % (flag)
         raise error.Abort(msg)
@@ -1279,8 +1276,8 @@
             # parsers.c radix tree lookup gave multiple matches
             # fast path: for unfiltered changelog, radix tree is accurate
             if not getattr(self, 'filteredrevs', None):
-                raise AmbiguousPrefixLookupError(id, self.indexfile,
-                                                 _('ambiguous identifier'))
+                raise error.AmbiguousPrefixLookupError(
+                    id, self.indexfile, _('ambiguous identifier'))
             # fall through to slow path that filters hidden revisions
         except (AttributeError, ValueError):
             # we are pure python, or key was too short to search radix tree
@@ -1303,8 +1300,8 @@
                     if len(nl) == 1 and not maybewdir:
                         self._pcache[id] = nl[0]
                         return nl[0]
-                    raise AmbiguousPrefixLookupError(id, self.indexfile,
-                                                     _('ambiguous identifier'))
+                    raise error.AmbiguousPrefixLookupError(
+                        id, self.indexfile, _('ambiguous identifier'))
                 if maybewdir:
                     raise error.WdirUnsupported
                 return None
@@ -1572,7 +1569,7 @@
     def snapshotdepth(self, rev):
         """number of snapshot in the chain before this one"""
         if not self.issnapshot(rev):
-            raise ProgrammingError('revision %d not a snapshot')
+            raise error.ProgrammingError('revision %d not a snapshot')
         return len(self._deltachain(rev)[0]) - 1
 
     def revdiff(self, rev1, rev2):
@@ -1696,7 +1693,8 @@
         if flags == 0:
             return text, True
         if not operation in ('read', 'write'):
-            raise ProgrammingError(_("invalid '%s' operation ") % (operation))
+            raise error.ProgrammingError(_("invalid '%s' operation") %
+                                         operation)
         # Check all flags are known.
         if flags & ~REVIDX_KNOWN_FLAGS:
             raise error.RevlogError(_("incompatible revision flag '%#x'") %



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list