/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

comment about the change in the bundled copy of configobj

Show diffs side-by-side

added added

removed removed

Lines of Context:
713
713
       self.bzrdir = bzrdir
714
714
       PathError.__init__(self, path=path)
715
715
 
 
716
    def __repr__(self):
 
717
        return '<%s %r>' % (self.__class__.__name__, self.__dict__)
 
718
 
716
719
    def _format(self):
717
720
        # XXX: Ideally self.detail would be a property, but Exceptions in
718
721
        # Python 2.4 have to be old-style classes so properties don't work.
723
726
                    self.bzrdir.open_repository()
724
727
                except NoRepositoryPresent:
725
728
                    self.detail = ''
 
729
                except Exception:
 
730
                    # Just ignore unexpected errors.  Raising arbitrary errors
 
731
                    # during str(err) can provoke strange bugs.  Concretely
 
732
                    # Launchpad's codehosting managed to raise NotBranchError
 
733
                    # here, and then get stuck in an infinite loop/recursion
 
734
                    # trying to str() that error.  All this error really cares
 
735
                    # about that there's no working repository there, and if
 
736
                    # open_repository() fails, there probably isn't.
 
737
                    self.detail = ''
726
738
                else:
727
739
                    self.detail = ': location is a repository'
728
740
            else:
947
959
    # original exception is available as e.original_error
948
960
    #
949
961
    # New code should prefer to raise specific subclasses
950
 
    def __init__(self, message):
951
 
        # Python 2.5 uses a slot for StandardError.message,
952
 
        # so use a different variable name.  We now work around this in
953
 
        # BzrError.__str__, but this member name is kept for compatability.
954
 
        self.msg = message
 
962
    def __init__(self, msg):
 
963
        self.msg = msg
955
964
 
956
965
 
957
966
class LockActive(LockError):
1041
1050
class LockContention(LockError):
1042
1051
 
1043
1052
    _fmt = 'Could not acquire lock "%(lock)s": %(msg)s'
1044
 
    # TODO: show full url for lock, combining the transport and relative
1045
 
    # bits?
1046
1053
 
1047
1054
    internal_error = False
1048
1055
 
1075
1082
        self.target = target
1076
1083
 
1077
1084
 
 
1085
class LockCorrupt(LockError):
 
1086
 
 
1087
    _fmt = ("Lock is apparently held, but corrupted: %(corruption_info)s\n"
 
1088
            "Use 'bzr break-lock' to clear it")
 
1089
 
 
1090
    internal_error = False
 
1091
 
 
1092
    def __init__(self, corruption_info, file_data=None):
 
1093
        self.corruption_info = corruption_info
 
1094
        self.file_data = file_data
 
1095
 
 
1096
 
1078
1097
class LockNotHeld(LockError):
1079
1098
 
1080
1099
    _fmt = "Lock not held: %(lock)s"
1380
1399
 
1381
1400
class WeaveParentMismatch(WeaveError):
1382
1401
 
1383
 
    _fmt = "Parents are mismatched between two revisions. %(message)s"
 
1402
    _fmt = "Parents are mismatched between two revisions. %(msg)s"
1384
1403
 
1385
1404
 
1386
1405
class WeaveInvalidChecksum(WeaveError):
1387
1406
 
1388
 
    _fmt = "Text did not match it's checksum: %(message)s"
 
1407
    _fmt = "Text did not match it's checksum: %(msg)s"
1389
1408
 
1390
1409
 
1391
1410
class WeaveTextDiffers(WeaveError):
1439
1458
 
1440
1459
class VersionedFileInvalidChecksum(VersionedFileError):
1441
1460
 
1442
 
    _fmt = "Text did not match its checksum: %(message)s"
 
1461
    _fmt = "Text did not match its checksum: %(msg)s"
1443
1462
 
1444
1463
 
1445
1464
class KnitError(InternalBzrError):
1925
1944
    _fmt = "Moving the root directory is not supported at this time"
1926
1945
 
1927
1946
 
 
1947
class TransformRenameFailed(BzrError):
 
1948
 
 
1949
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
 
1950
 
 
1951
    def __init__(self, from_path, to_path, why, errno):
 
1952
        self.from_path = from_path
 
1953
        self.to_path = to_path
 
1954
        self.why = why
 
1955
        self.errno = errno
 
1956
 
 
1957
 
1928
1958
class BzrMoveFailedError(BzrError):
1929
1959
 
1930
1960
    _fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
2839
2869
        BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2840
2870
 
2841
2871
 
 
2872
class ShelvedChanges(UncommittedChanges):
 
2873
 
 
2874
    _fmt = ('Working tree "%(display_url)s" has shelved changes'
 
2875
            ' (See bzr shelve --list).%(more)s')
 
2876
 
 
2877
 
2842
2878
class MissingTemplateVariable(BzrError):
2843
2879
 
2844
2880
    _fmt = 'Variable {%(name)s} is not available.'
3134
3170
    def __init__(self, bzrdir):
3135
3171
        self.bzrdir = bzrdir
3136
3172
 
 
3173
 
 
3174
class NoWhoami(BzrError):
 
3175
 
 
3176
    _fmt = ('Unable to determine your name.\n'
 
3177
        "Please, set your name with the 'whoami' command.\n"
 
3178
        'E.g. bzr whoami "Your Name <name@example.com>"')
 
3179
 
 
3180
 
 
3181
class InvalidPattern(BzrError):
 
3182
 
 
3183
    _fmt = ('Invalid pattern(s) found. %(msg)s')
 
3184
 
 
3185
    def __init__(self, msg):
 
3186
        self.msg = msg
 
3187
 
 
3188
 
 
3189
class RecursiveBind(BzrError):
 
3190
 
 
3191
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
 
3192
        'Please use `bzr unbind` to fix.')
 
3193
 
 
3194
    def __init__(self, branch_url):
 
3195
        self.branch_url = branch_url
 
3196