##// END OF EJS Templates
revlog: drop RevlogError alias (API)...
Gregory Szorc -
r39809:2cd93a8d default
parent child Browse files
Show More
@@ -104,7 +104,6 b" parsers = policy.importmod(r'parsers')"
104 104 _maxinline = 131072
105 105 _chunksize = 1048576
106 106
107 RevlogError = error.RevlogError
108 107 LookupError = error.LookupError
109 108 AmbiguousPrefixLookupError = error.AmbiguousPrefixLookupError
110 109 CensoredNodeError = error.CensoredNodeError
@@ -303,7 +302,8 b' class revlogoldio(object):'
303 302
304 303 def packentry(self, entry, node, version, rev):
305 304 if gettype(entry[0]):
306 raise RevlogError(_('index entry flags need revlog version 1'))
305 raise error.RevlogError(_('index entry flags need revlog '
306 'version 1'))
307 307 e2 = (getoffset(entry[0]), entry[1], entry[3], entry[4],
308 308 node(entry[5]), node(entry[6]), entry[7])
309 309 return indexformatv0_pack(*e2)
@@ -456,11 +456,11 b' class revlog(object):'
456 456 self._flagprocessors[REVIDX_ELLIPSIS] = ellipsisprocessor
457 457
458 458 if self._chunkcachesize <= 0:
459 raise RevlogError(_('revlog chunk cache size %r is not greater '
460 'than 0') % self._chunkcachesize)
459 raise error.RevlogError(_('revlog chunk cache size %r is not '
460 'greater than 0') % self._chunkcachesize)
461 461 elif self._chunkcachesize & (self._chunkcachesize - 1):
462 raise RevlogError(_('revlog chunk cache size %r is not a power '
463 'of 2') % self._chunkcachesize)
462 raise error.RevlogError(_('revlog chunk cache size %r is not a '
463 'power of 2') % self._chunkcachesize)
464 464
465 465 indexdata = ''
466 466 self._initempty = True
@@ -485,21 +485,21 b' class revlog(object):'
485 485 fmt = v & 0xFFFF
486 486 if fmt == REVLOGV0:
487 487 if flags:
488 raise RevlogError(_('unknown flags (%#04x) in version %d '
488 raise error.RevlogError(_('unknown flags (%#04x) in version %d '
489 489 'revlog %s') %
490 490 (flags >> 16, fmt, self.indexfile))
491 491 elif fmt == REVLOGV1:
492 492 if flags & ~REVLOGV1_FLAGS:
493 raise RevlogError(_('unknown flags (%#04x) in version %d '
493 raise error.RevlogError(_('unknown flags (%#04x) in version %d '
494 494 'revlog %s') %
495 495 (flags >> 16, fmt, self.indexfile))
496 496 elif fmt == REVLOGV2:
497 497 if flags & ~REVLOGV2_FLAGS:
498 raise RevlogError(_('unknown flags (%#04x) in version %d '
498 raise error.RevlogError(_('unknown flags (%#04x) in version %d '
499 499 'revlog %s') %
500 500 (flags >> 16, fmt, self.indexfile))
501 501 else:
502 raise RevlogError(_('unknown version (%d) in revlog %s') %
502 raise error.RevlogError(_('unknown version (%d) in revlog %s') %
503 503 (fmt, self.indexfile))
504 504
505 505 self._storedeltachains = True
@@ -510,7 +510,8 b' class revlog(object):'
510 510 try:
511 511 d = self._io.parseindex(indexdata, self._inline)
512 512 except (ValueError, IndexError):
513 raise RevlogError(_("index %s is corrupted") % (self.indexfile))
513 raise error.RevlogError(_("index %s is corrupted") %
514 self.indexfile)
514 515 self.index, nodemap, self._chunkcache = d
515 516 if nodemap is not None:
516 517 self.nodemap = self._nodecache = nodemap
@@ -617,7 +618,7 b' class revlog(object):'
617 618 return self._nodecache[node]
618 619 except TypeError:
619 620 raise
620 except RevlogError:
621 except error.RevlogError:
621 622 # parsers.c radix tree lookup failed
622 623 if node == wdirid or node in wdirfilenodeids:
623 624 raise error.WdirUnsupported
@@ -1268,13 +1269,13 b' class revlog(object):'
1268 1269 if partial and self.hasnode(partial):
1269 1270 if maybewdir:
1270 1271 # single 'ff...' match in radix tree, ambiguous with wdir
1271 raise RevlogError
1272 raise error.RevlogError
1272 1273 return partial
1273 1274 if maybewdir:
1274 1275 # no 'ff...' match in radix tree, wdir identified
1275 1276 raise error.WdirUnsupported
1276 1277 return None
1277 except RevlogError:
1278 except error.RevlogError:
1278 1279 # parsers.c radix tree lookup gave multiple matches
1279 1280 # fast path: for unfiltered changelog, radix tree is accurate
1280 1281 if not getattr(self, 'filteredrevs', None):
@@ -1354,7 +1355,7 b' class revlog(object):'
1354 1355 try:
1355 1356 length = max(self.index.shortest(node), minlength)
1356 1357 return disambiguate(hexnode, length)
1357 except RevlogError:
1358 except error.RevlogError:
1358 1359 if node != wdirid:
1359 1360 raise LookupError(node, self.indexfile, _('no node'))
1360 1361 except AttributeError:
@@ -1698,7 +1699,7 b' class revlog(object):'
1698 1699 raise ProgrammingError(_("invalid '%s' operation ") % (operation))
1699 1700 # Check all flags are known.
1700 1701 if flags & ~REVIDX_KNOWN_FLAGS:
1701 raise RevlogError(_("incompatible revision flag '%#x'") %
1702 raise error.RevlogError(_("incompatible revision flag '%#x'") %
1702 1703 (flags & ~REVIDX_KNOWN_FLAGS))
1703 1704 validatehash = True
1704 1705 # Depending on the operation (read or write), the order might be
@@ -1715,7 +1716,7 b' class revlog(object):'
1715 1716
1716 1717 if flag not in self._flagprocessors:
1717 1718 message = _("missing processor for flag '%#x'") % (flag)
1718 raise RevlogError(message)
1719 raise error.RevlogError(message)
1719 1720
1720 1721 processor = self._flagprocessors[flag]
1721 1722 if processor is not None:
@@ -1744,9 +1745,9 b' class revlog(object):'
1744 1745 revornode = rev
1745 1746 if revornode is None:
1746 1747 revornode = templatefilters.short(hex(node))
1747 raise RevlogError(_("integrity check failed on %s:%s")
1748 raise error.RevlogError(_("integrity check failed on %s:%s")
1748 1749 % (self.indexfile, pycompat.bytestr(revornode)))
1749 except RevlogError:
1750 except error.RevlogError:
1750 1751 if self._censorable and _censoredtext(text):
1751 1752 raise error.CensoredNodeError(self.indexfile, node, text)
1752 1753 raise
@@ -1765,7 +1766,7 b' class revlog(object):'
1765 1766
1766 1767 trinfo = tr.find(self.indexfile)
1767 1768 if trinfo is None:
1768 raise RevlogError(_("%s not found in the transaction")
1769 raise error.RevlogError(_("%s not found in the transaction")
1769 1770 % self.indexfile)
1770 1771
1771 1772 trindex = trinfo[2]
@@ -1817,7 +1818,7 b' class revlog(object):'
1817 1818 multiple calls
1818 1819 """
1819 1820 if link == nullrev:
1820 raise RevlogError(_("attempted to add linkrev -1 to %s")
1821 raise error.RevlogError(_("attempted to add linkrev -1 to %s")
1821 1822 % self.indexfile)
1822 1823
1823 1824 if flags:
@@ -1831,7 +1832,7 b' class revlog(object):'
1831 1832 cachedelta = None
1832 1833
1833 1834 if len(rawtext) > _maxentrysize:
1834 raise RevlogError(
1835 raise error.RevlogError(
1835 1836 _("%s: size of %d bytes exceeds maximum revlog storage of 2GiB")
1836 1837 % (self.indexfile, len(rawtext)))
1837 1838
@@ -1916,7 +1917,7 b' class revlog(object):'
1916 1917 try:
1917 1918 return _zlibdecompress(data)
1918 1919 except zlib.error as e:
1919 raise RevlogError(_('revlog decompress error: %s') %
1920 raise error.RevlogError(_('revlog decompress error: %s') %
1920 1921 stringutil.forcebytestr(e))
1921 1922 # '\0' is more common than 'u' so it goes first.
1922 1923 elif t == '\0':
@@ -1932,7 +1933,7 b' class revlog(object):'
1932 1933 compressor = engine.revlogcompressor()
1933 1934 self._decompressors[t] = compressor
1934 1935 except KeyError:
1935 raise RevlogError(_('unknown compression type %r') % t)
1936 raise error.RevlogError(_('unknown compression type %r') % t)
1936 1937
1937 1938 return compressor.decompress(data)
1938 1939
@@ -1953,11 +1954,11 b' class revlog(object):'
1953 1954 if both are set, they must correspond to each other.
1954 1955 """
1955 1956 if node == nullid:
1956 raise RevlogError(_("%s: attempt to add null revision") %
1957 (self.indexfile))
1957 raise error.RevlogError(_("%s: attempt to add null revision") %
1958 self.indexfile)
1958 1959 if node == wdirid or node in wdirfilenodeids:
1959 raise RevlogError(_("%s: attempt to add wdir revision") %
1960 (self.indexfile))
1960 raise error.RevlogError(_("%s: attempt to add wdir revision") %
1961 self.indexfile)
1961 1962
1962 1963 if self._inline:
1963 1964 fh = ifh
@@ -33,7 +33,6 b' from .. import ('
33 33 mdiff,
34 34 )
35 35
36 RevlogError = error.RevlogError
37 36 CensoredNodeError = error.CensoredNodeError
38 37
39 38 # maximum <delta-chain-data>/<revision-text-length> ratio
@@ -460,7 +459,7 b' def _textfromdelta(fh, revlog, baserev, '
460 459 if validatehash:
461 460 revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2)
462 461 if flags & REVIDX_ISCENSORED:
463 raise RevlogError(_('node %s is not censored') % expectednode)
462 raise error.RevlogError(_('node %s is not censored') % expectednode)
464 463 except CensoredNodeError:
465 464 # must pass the censored index flag to add censored revisions
466 465 if not flags & REVIDX_ISCENSORED:
@@ -279,7 +279,7 b' class filestorage(object):'
279 279
280 280 if flag not in revlog._flagprocessors:
281 281 message = _("missing processor for flag '%#x'") % (flag)
282 raise revlog.RevlogError(message)
282 raise error.RevlogError(message)
283 283
284 284 processor = revlog._flagprocessors[flag]
285 285 if processor is not None:
General Comments 0
You need to be logged in to leave comments. Login now