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