##// END OF EJS Templates
revlog: drop some more error aliases (API)...
Gregory Szorc -
r39810:4a2466b2 default
parent child Browse files
Show More
@@ -105,9 +105,6 b" parsers = policy.importmod(r'parsers')"
105 _chunksize = 1048576
105 _chunksize = 1048576
106
106
107 LookupError = error.LookupError
107 LookupError = error.LookupError
108 AmbiguousPrefixLookupError = error.AmbiguousPrefixLookupError
109 CensoredNodeError = error.CensoredNodeError
110 ProgrammingError = error.ProgrammingError
111
108
112 # Store flag processors (cf. 'addflagprocessor()' to register)
109 # Store flag processors (cf. 'addflagprocessor()' to register)
113 _flagprocessors = {
110 _flagprocessors = {
@@ -180,10 +177,10 b' def addflagprocessor(flag, processor):'
180 """
177 """
181 if not flag & REVIDX_KNOWN_FLAGS:
178 if not flag & REVIDX_KNOWN_FLAGS:
182 msg = _("cannot register processor on unknown flag '%#x'.") % (flag)
179 msg = _("cannot register processor on unknown flag '%#x'.") % (flag)
183 raise ProgrammingError(msg)
180 raise error.ProgrammingError(msg)
184 if flag not in REVIDX_FLAGS_ORDER:
181 if flag not in REVIDX_FLAGS_ORDER:
185 msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % (flag)
182 msg = _("flag '%#x' undefined in REVIDX_FLAGS_ORDER.") % (flag)
186 raise ProgrammingError(msg)
183 raise error.ProgrammingError(msg)
187 if flag in _flagprocessors:
184 if flag in _flagprocessors:
188 msg = _("cannot register multiple processors on flag '%#x'.") % (flag)
185 msg = _("cannot register multiple processors on flag '%#x'.") % (flag)
189 raise error.Abort(msg)
186 raise error.Abort(msg)
@@ -1279,8 +1276,8 b' class revlog(object):'
1279 # parsers.c radix tree lookup gave multiple matches
1276 # parsers.c radix tree lookup gave multiple matches
1280 # fast path: for unfiltered changelog, radix tree is accurate
1277 # fast path: for unfiltered changelog, radix tree is accurate
1281 if not getattr(self, 'filteredrevs', None):
1278 if not getattr(self, 'filteredrevs', None):
1282 raise AmbiguousPrefixLookupError(id, self.indexfile,
1279 raise error.AmbiguousPrefixLookupError(
1283 _('ambiguous identifier'))
1280 id, self.indexfile, _('ambiguous identifier'))
1284 # fall through to slow path that filters hidden revisions
1281 # fall through to slow path that filters hidden revisions
1285 except (AttributeError, ValueError):
1282 except (AttributeError, ValueError):
1286 # we are pure python, or key was too short to search radix tree
1283 # we are pure python, or key was too short to search radix tree
@@ -1303,8 +1300,8 b' class revlog(object):'
1303 if len(nl) == 1 and not maybewdir:
1300 if len(nl) == 1 and not maybewdir:
1304 self._pcache[id] = nl[0]
1301 self._pcache[id] = nl[0]
1305 return nl[0]
1302 return nl[0]
1306 raise AmbiguousPrefixLookupError(id, self.indexfile,
1303 raise error.AmbiguousPrefixLookupError(
1307 _('ambiguous identifier'))
1304 id, self.indexfile, _('ambiguous identifier'))
1308 if maybewdir:
1305 if maybewdir:
1309 raise error.WdirUnsupported
1306 raise error.WdirUnsupported
1310 return None
1307 return None
@@ -1572,7 +1569,7 b' class revlog(object):'
1572 def snapshotdepth(self, rev):
1569 def snapshotdepth(self, rev):
1573 """number of snapshot in the chain before this one"""
1570 """number of snapshot in the chain before this one"""
1574 if not self.issnapshot(rev):
1571 if not self.issnapshot(rev):
1575 raise ProgrammingError('revision %d not a snapshot')
1572 raise error.ProgrammingError('revision %d not a snapshot')
1576 return len(self._deltachain(rev)[0]) - 1
1573 return len(self._deltachain(rev)[0]) - 1
1577
1574
1578 def revdiff(self, rev1, rev2):
1575 def revdiff(self, rev1, rev2):
@@ -1696,7 +1693,8 b' class revlog(object):'
1696 if flags == 0:
1693 if flags == 0:
1697 return text, True
1694 return text, True
1698 if not operation in ('read', 'write'):
1695 if not operation in ('read', 'write'):
1699 raise ProgrammingError(_("invalid '%s' operation ") % (operation))
1696 raise error.ProgrammingError(_("invalid '%s' operation") %
1697 operation)
1700 # Check all flags are known.
1698 # Check all flags are known.
1701 if flags & ~REVIDX_KNOWN_FLAGS:
1699 if flags & ~REVIDX_KNOWN_FLAGS:
1702 raise error.RevlogError(_("incompatible revision flag '%#x'") %
1700 raise error.RevlogError(_("incompatible revision flag '%#x'") %
@@ -33,8 +33,6 b' from .. import ('
33 mdiff,
33 mdiff,
34 )
34 )
35
35
36 CensoredNodeError = error.CensoredNodeError
37
38 # maximum <delta-chain-data>/<revision-text-length> ratio
36 # maximum <delta-chain-data>/<revision-text-length> ratio
39 LIMIT_DELTA2TEXT = 2
37 LIMIT_DELTA2TEXT = 2
40
38
@@ -460,7 +458,7 b' def _textfromdelta(fh, revlog, baserev, '
460 revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2)
458 revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2)
461 if flags & REVIDX_ISCENSORED:
459 if flags & REVIDX_ISCENSORED:
462 raise error.RevlogError(_('node %s is not censored') % expectednode)
460 raise error.RevlogError(_('node %s is not censored') % expectednode)
463 except CensoredNodeError:
461 except error.CensoredNodeError:
464 # must pass the censored index flag to add censored revisions
462 # must pass the censored index flag to add censored revisions
465 if not flags & REVIDX_ISCENSORED:
463 if not flags & REVIDX_ISCENSORED:
466 raise
464 raise
General Comments 0
You need to be logged in to leave comments. Login now