Mercurial > hg
view mercurial/error.py @ 46149:294d5aca4ff5
copies: iterate over children directly (instead of parents)
Before this change we would gather all parent → child edges and iterate on
all parent, gathering copy information for children and aggregating them from
there.
They are not strict requirement for edges to be processed in that specific
order. We could also simply iterate over all "children" revision and aggregate
data from both parents at the same time. This patch does that.
It make various things simpler:
* since both parents are processed at the same time, we no longer need to
cache data for merge (see next changeset for details),
* we no longer need nested loop to process data,
* we no longer need to store partial merge data for a rev from distinct loop
interaction to another when processing merges,
* we no longer need to build a full parent -> children mapping (we only rely on
a simpler "parent -> number of children" map (for memory efficiency),
* the data access pattern is now simpler (from lower revisions to higher
revisions) and entirely predicable. That predictability open the way to
prefetching and parallel processing.
So that new iterations order requires simpler code and open the way to
interesting optimisation.
The effect on performance is quite good. In the worse case, we don't see any
significant negative impact. And in the best case, the reduction of roundtrip
to Python provide us with a significant speed. Some example below:
Repo Case Source-Rev Dest-Rev # of revisions old time new time Difference Factor time per rev
---------------------------------------------------------------------------------------------------------------------------------------------------------------
mozilla-try x00000_revs_x00000_added_0_copies dc8a3ca7010e d16fde900c9c : 34414 revs, 0.962867 s, 0.502584 s, -0.460283 s, × 0.5220, 14 µs/rev
mozilla-try x0000_revs_xx000_added_x_copies 156f6e2674f2 4d0f2c178e66 : 8598 revs, 0.110717 s, 0.076323 s, -0.034394 s, × 0.6894, 8 µs/rev
# full comparison between the previous changeset and this one
Repo Case Source-Rev Dest-Rev # of revisions old time new time Difference Factor time per rev
---------------------------------------------------------------------------------------------------------------------------------------------------------------
mercurial x_revs_x_added_0_copies ad6b123de1c7 39cfcef4f463 : 1 revs, 0.000048 s, 0.000041 s, -0.000007 s, × 0.8542, 41 µs/rev
mercurial x_revs_x_added_x_copies 2b1c78674230 0c1d10351869 : 6 revs, 0.000153 s, 0.000102 s, -0.000051 s, × 0.6667, 17 µs/rev
mercurial x000_revs_x000_added_x_copies 81f8ff2a9bf2 dd3267698d84 : 1032 revs, 0.004209 s, 0.004254 s, +0.000045 s, × 1.0107, 4 µs/rev
pypy x_revs_x_added_0_copies aed021ee8ae8 099ed31b181b : 9 revs, 0.000203 s, 0.000282 s, +0.000079 s, × 1.3892, 31 µs/rev
pypy x_revs_x000_added_0_copies 4aa4e1f8e19a 359343b9ac0e : 1 revs, 0.000059 s, 0.000048 s, -0.000011 s, × 0.8136, 48 µs/rev
pypy x_revs_x_added_x_copies ac52eb7bbbb0 72e022663155 : 7 revs, 0.000194 s, 0.000211 s, +0.000017 s, × 1.0876, 30 µs/rev
pypy x_revs_x00_added_x_copies c3b14617fbd7 ace7255d9a26 : 1 revs, 0.000380 s, 0.000375 s, -0.000005 s, × 0.9868, 375 µs/rev
pypy x_revs_x000_added_x000_copies df6f7a526b60 a83dc6a2d56f : 6 revs, 0.010588 s, 0.010574 s, -0.000014 s, × 0.9987, 1762 µs/rev
pypy x000_revs_xx00_added_0_copies 89a76aede314 2f22446ff07e : 4785 revs, 0.048961 s, 0.049974 s, +0.001013 s, × 1.0207, 10 µs/rev
pypy x000_revs_x000_added_x_copies 8a3b5bfd266e 2c68e87c3efe : 6780 revs, 0.083612 s, 0.084300 s, +0.000688 s, × 1.0082, 12 µs/rev
pypy x000_revs_x000_added_x000_copies 89a76aede314 7b3dda341c84 : 5441 revs, 0.058579 s, 0.060128 s, +0.001549 s, × 1.0264, 11 µs/rev
pypy x0000_revs_x_added_0_copies d1defd0dc478 c9cb1334cc78 : 43645 revs, 0.736783 s, 0.686542 s, -0.050241 s, × 0.9318, 15 µs/rev
pypy x0000_revs_xx000_added_0_copies bf2c629d0071 4ffed77c095c : 2 revs, 0.022050 s, 0.009277 s, -0.012773 s, × 0.4207, 4638 µs/rev
pypy x0000_revs_xx000_added_x000_copies 08ea3258278e d9fa043f30c0 : 11316 revs, 0.120800 s, 0.114733 s, -0.006067 s, × 0.9498, 10 µs/rev
netbeans x_revs_x_added_0_copies fb0955ffcbcd a01e9239f9e7 : 2 revs, 0.000140 s, 0.000081 s, -0.000059 s, × 0.5786, 40 µs/rev
netbeans x_revs_x000_added_0_copies 6f360122949f 20eb231cc7d0 : 2 revs, 0.000114 s, 0.000107 s, -0.000007 s, × 0.9386, 53 µs/rev
netbeans x_revs_x_added_x_copies 1ada3faf6fb6 5a39d12eecf4 : 3 revs, 0.000224 s, 0.000173 s, -0.000051 s, × 0.7723, 57 µs/rev
netbeans x_revs_x00_added_x_copies 35be93ba1e2c 9eec5e90c05f : 9 revs, 0.000723 s, 0.000698 s, -0.000025 s, × 0.9654, 77 µs/rev
netbeans x000_revs_xx00_added_0_copies eac3045b4fdd 51d4ae7f1290 : 1421 revs, 0.009665 s, 0.009248 s, -0.000417 s, × 0.9569, 6 µs/rev
netbeans x000_revs_x000_added_x_copies e2063d266acd 6081d72689dc : 1533 revs, 0.014820 s, 0.015446 s, +0.000626 s, × 1.0422, 10 µs/rev
netbeans x000_revs_x000_added_x000_copies ff453e9fee32 411350406ec2 : 5750 revs, 0.076049 s, 0.074373 s, -0.001676 s, × 0.9780, 12 µs/rev
netbeans x0000_revs_xx000_added_x000_copies 588c2d1ced70 1aad62e59ddd : 66949 revs, 0.683603 s, 0.639870 s, -0.043733 s, × 0.9360, 9 µs/rev
mozilla-central x_revs_x_added_0_copies 3697f962bb7b 7015fcdd43a2 : 2 revs, 0.000161 s, 0.000088 s, -0.000073 s, × 0.5466, 44 µs/rev
mozilla-central x_revs_x000_added_0_copies dd390860c6c9 40d0c5bed75d : 8 revs, 0.000234 s, 0.000199 s, -0.000035 s, × 0.8504, 24 µs/rev
mozilla-central x_revs_x_added_x_copies 8d198483ae3b 14207ffc2b2f : 9 revs, 0.000247 s, 0.000171 s, -0.000076 s, × 0.6923, 19 µs/rev
mozilla-central x_revs_x00_added_x_copies 98cbc58cc6bc 446a150332c3 : 7 revs, 0.000630 s, 0.000592 s, -0.000038 s, × 0.9397, 84 µs/rev
mozilla-central x_revs_x000_added_x000_copies 3c684b4b8f68 0a5e72d1b479 : 3 revs, 0.003286 s, 0.003151 s, -0.000135 s, × 0.9589, 1050 µs/rev
mozilla-central x_revs_x0000_added_x0000_copies effb563bb7e5 c07a39dc4e80 : 6 revs, 0.062441 s, 0.061612 s, -0.000829 s, × 0.9867, 10268 µs/rev
mozilla-central x000_revs_xx00_added_0_copies 6100d773079a 04a55431795e : 1593 revs, 0.005423 s, 0.005381 s, -0.000042 s, × 0.9923, 3 µs/rev
mozilla-central x000_revs_x000_added_x_copies 9f17a6fc04f9 2d37b966abed : 41 revs, 0.005919 s, 0.003742 s, -0.002177 s, × 0.6322, 91 µs/rev
mozilla-central x000_revs_x000_added_x000_copies 7c97034feb78 4407bd0c6330 : 7839 revs, 0.062597 s, 0.061983 s, -0.000614 s, × 0.9902, 7 µs/rev
mozilla-central x0000_revs_xx000_added_0_copies 9eec5917337d 67118cc6dcad : 615 revs, 0.043551 s, 0.019861 s, -0.023690 s, × 0.4560, 32 µs/rev
mozilla-central x0000_revs_xx000_added_x000_copies f78c615a656c 96a38b690156 : 30263 revs, 0.192475 s, 0.188101 s, -0.004374 s, × 0.9773, 6 µs/rev
mozilla-central x00000_revs_x0000_added_x0000_copies 6832ae71433c 4c222a1d9a00 : 153721 revs, 1.955575 s, 1.806696 s, -0.148879 s, × 0.9239, 11 µs/rev
mozilla-central x00000_revs_x00000_added_x000_copies 76caed42cf7c 1daa622bbe42 : 204976 revs, 2.886501 s, 2.682987 s, -0.203514 s, × 0.9295, 13 µs/rev
mozilla-try x_revs_x_added_0_copies aaf6dde0deb8 9790f499805a : 2 revs, 0.001181 s, 0.000852 s, -0.000329 s, × 0.7214, 426 µs/rev
mozilla-try x_revs_x000_added_0_copies d8d0222927b4 5bb8ce8c7450 : 2 revs, 0.001189 s, 0.000859 s, -0.000330 s, × 0.7225, 429 µs/rev
mozilla-try x_revs_x_added_x_copies 092fcca11bdb 936255a0384a : 4 revs, 0.000563 s, 0.000150 s, -0.000413 s, × 0.2664, 37 µs/rev
mozilla-try x_revs_x00_added_x_copies b53d2fadbdb5 017afae788ec : 2 revs, 0.001548 s, 0.001158 s, -0.000390 s, × 0.7481, 579 µs/rev
mozilla-try x_revs_x000_added_x000_copies 20408ad61ce5 6f0ee96e21ad : 1 revs, 0.027782 s, 0.027240 s, -0.000542 s, × 0.9805, 27240 µs/rev
mozilla-try x_revs_x0000_added_x0000_copies effb563bb7e5 c07a39dc4e80 : 6 revs, 0.062781 s, 0.062824 s, +0.000043 s, × 1.0007, 10470 µs/rev
mozilla-try x000_revs_xx00_added_0_copies 6100d773079a 04a55431795e : 1593 revs, 0.005778 s, 0.005463 s, -0.000315 s, × 0.9455, 3 µs/rev
mozilla-try x000_revs_x000_added_x_copies 9f17a6fc04f9 2d37b966abed : 41 revs, 0.006192 s, 0.004238 s, -0.001954 s, × 0.6844, 103 µs/rev
mozilla-try x000_revs_x000_added_x000_copies 1346fd0130e4 4c65cbdabc1f : 6657 revs, 0.065391 s, 0.064113 s, -0.001278 s, × 0.9805, 9 µs/rev
mozilla-try x0000_revs_x_added_0_copies 63519bfd42ee a36a2a865d92 : 40314 revs, 0.317216 s, 0.294063 s, -0.023153 s, × 0.9270, 7 µs/rev
mozilla-try x0000_revs_x_added_x_copies 9fe69ff0762d bcabf2a78927 : 38690 revs, 0.303119 s, 0.281493 s, -0.021626 s, × 0.9287, 7 µs/rev
mozilla-try x0000_revs_xx000_added_x_copies 156f6e2674f2 4d0f2c178e66 : 8598 revs, 0.110717 s, 0.076323 s, -0.034394 s, × 0.6894, 8 µs/rev
mozilla-try x0000_revs_xx000_added_0_copies 9eec5917337d 67118cc6dcad : 615 revs, 0.045739 s, 0.020390 s, -0.025349 s, × 0.4458, 33 µs/rev
mozilla-try x0000_revs_xx000_added_x000_copies 89294cd501d9 7ccb2fc7ccb5 : 97052 revs, 3.098021 s, 3.023879 s, -0.074142 s, × 0.9761, 31 µs/rev
mozilla-try x0000_revs_x0000_added_x0000_copies e928c65095ed e951f4ad123a : 52031 revs, 0.771480 s, 0.735549 s, -0.035931 s, × 0.9534, 14 µs/rev
mozilla-try x00000_revs_x_added_0_copies 6a320851d377 1ebb79acd503 : 363753 revs, 18.813422 s, 18.568900 s, -0.244522 s, × 0.9870, 51 µs/rev
mozilla-try x00000_revs_x00000_added_0_copies dc8a3ca7010e d16fde900c9c : 34414 revs, 0.962867 s, 0.502584 s, -0.460283 s, × 0.5220, 14 µs/rev
mozilla-try x00000_revs_x_added_x_copies 5173c4b6f97c 95d83ee7242d : 362229 revs, 18.684923 s, 18.356645 s, -0.328278 s, × 0.9824, 50 µs/rev
mozilla-try x00000_revs_x000_added_x_copies 9126823d0e9c ca82787bb23c : 359344 revs, 18.296305 s, 18.250393 s, -0.045912 s, × 0.9975, 50 µs/rev
mozilla-try x00000_revs_x0000_added_x0000_copies 8d3fafa80d4b eb884023b810 : 192665 revs, 3.061887 s, 2.792459 s, -0.269428 s, × 0.9120, 14 µs/rev
mozilla-try x00000_revs_x00000_added_x0000_copies 1b661134e2ca 1ae03d022d6d : 228985 revs, 103.869641 s, 107.697264 s, +3.827623 s, × 1.0369, 470 µs/rev
mozilla-try x00000_revs_x00000_added_x000_copies 9b2a99adc05e 8e29777b48e6 : 382065 revs, 64.262957 s, 63.961040 s, -0.301917 s, × 0.9953, 167 µs/rev
Differential Revision: https://phab.mercurial-scm.org/D9422
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 14 Dec 2020 11:32:24 +0100 |
parents | 89a2afe31e82 |
children | 3941fe53670d ae62ab82a345 |
line wrap: on
line source
# error.py - Mercurial exceptions # # Copyright 2005-2008 Matt Mackall <mpm@selenic.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. """Mercurial exceptions. This allows us to catch exceptions at higher levels without forcing imports. """ from __future__ import absolute_import import difflib # Do not import anything but pycompat here, please from . import pycompat def _tobytes(exc): """Byte-stringify exception in the same way as BaseException_str()""" if not exc.args: return b'' if len(exc.args) == 1: return pycompat.bytestr(exc.args[0]) return b'(%s)' % b', '.join(b"'%s'" % pycompat.bytestr(a) for a in exc.args) class Hint(object): """Mix-in to provide a hint of an error This should come first in the inheritance list to consume a hint and pass remaining arguments to the exception class. """ def __init__(self, *args, **kw): self.hint = kw.pop('hint', None) super(Hint, self).__init__(*args, **kw) class StorageError(Hint, Exception): """Raised when an error occurs in a storage layer. Usually subclassed by a storage-specific exception. """ __bytes__ = _tobytes class RevlogError(StorageError): pass class SidedataHashError(RevlogError): def __init__(self, key, expected, got): self.sidedatakey = key self.expecteddigest = expected self.actualdigest = got class FilteredIndexError(IndexError): __bytes__ = _tobytes class LookupError(RevlogError, KeyError): def __init__(self, name, index, message): self.name = name self.index = index # this can't be called 'message' because at least some installs of # Python 2.6+ complain about the 'message' property being deprecated self.lookupmessage = message if isinstance(name, bytes) and len(name) == 20: from .node import short name = short(name) # if name is a binary node, it can be None RevlogError.__init__( self, b'%s@%s: %s' % (index, pycompat.bytestr(name), message) ) def __bytes__(self): return RevlogError.__bytes__(self) def __str__(self): return RevlogError.__str__(self) class AmbiguousPrefixLookupError(LookupError): pass class FilteredLookupError(LookupError): pass class ManifestLookupError(LookupError): pass class CommandError(Exception): """Exception raised on errors in parsing the command line.""" def __init__(self, command, message): self.command = command self.message = message super(CommandError, self).__init__() __bytes__ = _tobytes class UnknownCommand(Exception): """Exception raised if command is not in the command table.""" def __init__(self, command, all_commands=None): self.command = command self.all_commands = all_commands super(UnknownCommand, self).__init__() __bytes__ = _tobytes class AmbiguousCommand(Exception): """Exception raised if command shortcut matches more than one command.""" def __init__(self, prefix, matches): self.prefix = prefix self.matches = matches super(AmbiguousCommand, self).__init__() __bytes__ = _tobytes class WorkerError(Exception): """Exception raised when a worker process dies.""" def __init__(self, status_code): self.status_code = status_code # Pass status code to superclass just so it becomes part of __bytes__ super(WorkerError, self).__init__(status_code) __bytes__ = _tobytes class InterventionRequired(Hint, Exception): """Exception raised when a command requires human intervention.""" __bytes__ = _tobytes class ConflictResolutionRequired(InterventionRequired): """Exception raised when a continuable command required merge conflict resolution.""" def __init__(self, opname): from .i18n import _ self.opname = opname InterventionRequired.__init__( self, _( b"unresolved conflicts (see 'hg resolve', then 'hg %s --continue')" ) % opname, ) class Abort(Hint, Exception): """Raised if a command needs to print an error and exit.""" def __init__(self, message, hint=None): self.message = message self.hint = hint # Pass the message into the Exception constructor to help extensions # that look for exc.args[0]. Exception.__init__(self, message) def __bytes__(self): return self.message if pycompat.ispy3: def __str__(self): # the output would be unreadable if the message was translated, # but do not replace it with encoding.strfromlocal(), which # may raise another exception. return pycompat.sysstr(self.__bytes__()) def format(self): from .i18n import _ message = _(b"abort: %s\n") % self.message if self.hint: message += _(b"(%s)\n") % self.hint return message class InputError(Abort): """Indicates that the user made an error in their input. Examples: Invalid command, invalid flags, invalid revision. """ class StateError(Abort): """Indicates that the operation might work if retried in a different state. Examples: Unresolved merge conflicts, unfinished operations. """ class CanceledError(Abort): """Indicates that the user canceled the operation. Examples: Close commit editor with error status, quit chistedit. """ class SecurityError(Abort): """Indicates that some aspect of security failed. Examples: Bad server credentials, expired local credentials for network filesystem, mismatched GPG signature, DoS protection. """ class HookLoadError(Abort): """raised when loading a hook fails, aborting an operation Exists to allow more specialized catching.""" class HookAbort(Abort): """raised when a validation hook fails, aborting an operation Exists to allow more specialized catching.""" class ConfigError(Abort): """Exception raised when parsing config files""" def __init__(self, message, location=None, hint=None): super(ConfigError, self).__init__(message, hint=hint) self.location = location def format(self): from .i18n import _ if self.location is not None: message = _(b"config error at %s: %s\n") % ( pycompat.bytestr(self.location), self.message, ) else: message = _(b"config error: %s\n") % self.message if self.hint: message += _(b"(%s)\n") % self.hint return message class UpdateAbort(Abort): """Raised when an update is aborted for destination issue""" class MergeDestAbort(Abort): """Raised when an update is aborted for destination issues""" class NoMergeDestAbort(MergeDestAbort): """Raised when an update is aborted because there is nothing to merge""" class ManyMergeDestAbort(MergeDestAbort): """Raised when an update is aborted because destination is ambiguous""" class ResponseExpected(Abort): """Raised when an EOF is received for a prompt""" def __init__(self): from .i18n import _ Abort.__init__(self, _(b'response expected')) class OutOfBandError(Hint, Exception): """Exception raised when a remote repo reports failure""" __bytes__ = _tobytes class ParseError(Abort): """Raised when parsing config files and {rev,file}sets (msg[, pos])""" def __init__(self, message, location=None, hint=None): super(ParseError, self).__init__(message, hint=hint) self.location = location def format(self): from .i18n import _ if self.location is not None: message = _(b"hg: parse error at %s: %s\n") % ( pycompat.bytestr(self.location), self.message, ) else: message = _(b"hg: parse error: %s\n") % self.message if self.hint: message += _(b"(%s)\n") % self.hint return message class PatchError(Exception): __bytes__ = _tobytes def getsimilar(symbols, value): sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio() # The cutoff for similarity here is pretty arbitrary. It should # probably be investigated and tweaked. return [s for s in symbols if sim(s) > 0.6] def similarity_hint(similar): from .i18n import _ if len(similar) == 1: return _(b"did you mean %s?") % similar[0] elif similar: ss = b", ".join(sorted(similar)) return _(b"did you mean one of %s?") % ss else: return None class UnknownIdentifier(ParseError): """Exception raised when a {rev,file}set references an unknown identifier""" def __init__(self, function, symbols): from .i18n import _ similar = getsimilar(symbols, function) hint = similarity_hint(similar) ParseError.__init__( self, _(b"unknown identifier: %s") % function, hint=hint ) class RepoError(Hint, Exception): __bytes__ = _tobytes class RepoLookupError(RepoError): pass class FilteredRepoLookupError(RepoLookupError): pass class CapabilityError(RepoError): pass class RequirementError(RepoError): """Exception raised if .hg/requires has an unknown entry.""" class StdioError(IOError): """Raised if I/O to stdout or stderr fails""" def __init__(self, err): IOError.__init__(self, err.errno, err.strerror) # no __bytes__() because error message is derived from the standard IOError class UnsupportedMergeRecords(Abort): def __init__(self, recordtypes): from .i18n import _ self.recordtypes = sorted(recordtypes) s = b' '.join(self.recordtypes) Abort.__init__( self, _(b'unsupported merge state records: %s') % s, hint=_( b'see https://mercurial-scm.org/wiki/MergeStateRecords for ' b'more information' ), ) class UnknownVersion(Abort): """generic exception for aborting from an encounter with an unknown version""" def __init__(self, msg, hint=None, version=None): self.version = version super(UnknownVersion, self).__init__(msg, hint=hint) class LockError(IOError): def __init__(self, errno, strerror, filename, desc): IOError.__init__(self, errno, strerror, filename) self.desc = desc # no __bytes__() because error message is derived from the standard IOError class LockHeld(LockError): def __init__(self, errno, filename, desc, locker): LockError.__init__(self, errno, b'Lock held', filename, desc) self.locker = locker class LockUnavailable(LockError): pass # LockError is for errors while acquiring the lock -- this is unrelated class LockInheritanceContractViolation(RuntimeError): __bytes__ = _tobytes class ResponseError(Exception): """Raised to print an error with part of output and exit.""" __bytes__ = _tobytes # derived from KeyboardInterrupt to simplify some breakout code class SignalInterrupt(KeyboardInterrupt): """Exception raised on SIGTERM and SIGHUP.""" class SignatureError(Exception): __bytes__ = _tobytes class PushRaced(RuntimeError): """An exception raised during unbundling that indicate a push race""" __bytes__ = _tobytes class ProgrammingError(Hint, RuntimeError): """Raised if a mercurial (core or extension) developer made a mistake""" def __init__(self, msg, *args, **kwargs): # On Python 3, turn the message back into a string since this is # an internal-only error that won't be printed except in a # stack traces. msg = pycompat.sysstr(msg) super(ProgrammingError, self).__init__(msg, *args, **kwargs) __bytes__ = _tobytes class WdirUnsupported(Exception): """An exception which is raised when 'wdir()' is not supported""" __bytes__ = _tobytes # bundle2 related errors class BundleValueError(ValueError): """error raised when bundle2 cannot be processed""" __bytes__ = _tobytes class BundleUnknownFeatureError(BundleValueError): def __init__(self, parttype=None, params=(), values=()): self.parttype = parttype self.params = params self.values = values if self.parttype is None: msg = b'Stream Parameter' else: msg = parttype entries = self.params if self.params and self.values: assert len(self.params) == len(self.values) entries = [] for idx, par in enumerate(self.params): val = self.values[idx] if val is None: entries.append(val) else: entries.append(b"%s=%r" % (par, pycompat.maybebytestr(val))) if entries: msg = b'%s - %s' % (msg, b', '.join(entries)) ValueError.__init__(self, msg) class ReadOnlyPartError(RuntimeError): """error raised when code tries to alter a part being generated""" __bytes__ = _tobytes class PushkeyFailed(Abort): """error raised when a pushkey part failed to update a value""" def __init__( self, partid, namespace=None, key=None, new=None, old=None, ret=None ): self.partid = partid self.namespace = namespace self.key = key self.new = new self.old = old self.ret = ret # no i18n expected to be processed into a better message Abort.__init__( self, b'failed to update value for "%s/%s"' % (namespace, key) ) class CensoredNodeError(StorageError): """error raised when content verification fails on a censored node Also contains the tombstone data substituted for the uncensored data. """ def __init__(self, filename, node, tombstone): from .node import short StorageError.__init__(self, b'%s:%s' % (filename, short(node))) self.tombstone = tombstone class CensoredBaseError(StorageError): """error raised when a delta is rejected because its base is censored A delta based on a censored revision must be formed as single patch operation which replaces the entire base with new content. This ensures the delta may be applied by clones which have not censored the base. """ class InvalidBundleSpecification(Exception): """error raised when a bundle specification is invalid. This is used for syntax errors as opposed to support errors. """ __bytes__ = _tobytes class UnsupportedBundleSpecification(Exception): """error raised when a bundle specification is not supported.""" __bytes__ = _tobytes class CorruptedState(Exception): """error raised when a command is not able to read its state from file""" __bytes__ = _tobytes class PeerTransportError(Abort): """Transport-level I/O error when communicating with a peer repo.""" class InMemoryMergeConflictsError(Exception): """Exception raised when merge conflicts arose during an in-memory merge.""" __bytes__ = _tobytes class WireprotoCommandError(Exception): """Represents an error during execution of a wire protocol command. Should only be thrown by wire protocol version 2 commands. The error is a formatter string and an optional iterable of arguments. """ def __init__(self, message, args=None): self.message = message self.messageargs = args