/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

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
680
680
 
681
681
    _fmt = 'Path "%(path)s" is not a child of path "%(base)s"%(extra)s'
682
682
 
683
 
    internal_error = False
 
683
    internal_error = True
684
684
 
685
685
    def __init__(self, path, base, extra=None):
686
686
        BzrError.__init__(self)
723
723
                    self.bzrdir.open_repository()
724
724
                except NoRepositoryPresent:
725
725
                    self.detail = ''
726
 
                except Exception:
727
 
                    # Just ignore unexpected errors.  Raising arbitrary errors
728
 
                    # during str(err) can provoke strange bugs.  Concretely
729
 
                    # Launchpad's codehosting managed to raise NotBranchError
730
 
                    # here, and then get stuck in an infinite loop/recursion
731
 
                    # trying to str() that error.  All this error really cares
732
 
                    # about that there's no working repository there, and if
733
 
                    # open_repository() fails, there probably isn't.
734
 
                    self.detail = ''
735
726
                else:
736
727
                    self.detail = ': location is a repository'
737
728
            else:
791
782
 
792
783
    _fmt = 'File "%(path)s" is not in branch %(branch_base)s.'
793
784
 
794
 
    # use PathNotChild instead
795
 
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 3, 0)))
796
785
    def __init__(self, branch, path):
797
786
        BzrError.__init__(self)
798
787
        self.branch = branch
958
947
    # original exception is available as e.original_error
959
948
    #
960
949
    # New code should prefer to raise specific subclasses
961
 
    def __init__(self, msg):
962
 
        self.msg = msg
 
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
963
955
 
964
956
 
965
957
class LockActive(LockError):
1049
1041
class LockContention(LockError):
1050
1042
 
1051
1043
    _fmt = 'Could not acquire lock "%(lock)s": %(msg)s'
 
1044
    # TODO: show full url for lock, combining the transport and relative
 
1045
    # bits?
1052
1046
 
1053
1047
    internal_error = False
1054
1048
 
1081
1075
        self.target = target
1082
1076
 
1083
1077
 
1084
 
class LockCorrupt(LockError):
1085
 
 
1086
 
    _fmt = ("Lock is apparently held, but corrupted: %(corruption_info)s\n"
1087
 
            "Use 'bzr break-lock' to clear it")
1088
 
 
1089
 
    internal_error = False
1090
 
 
1091
 
    def __init__(self, corruption_info, file_data=None):
1092
 
        self.corruption_info = corruption_info
1093
 
        self.file_data = file_data
1094
 
 
1095
 
 
1096
1078
class LockNotHeld(LockError):
1097
1079
 
1098
1080
    _fmt = "Lock not held: %(lock)s"
1198
1180
class InvalidRevisionSpec(BzrError):
1199
1181
 
1200
1182
    _fmt = ("Requested revision: '%(spec)s' does not exist in branch:"
1201
 
            " %(branch_url)s%(extra)s")
 
1183
            " %(branch)s%(extra)s")
1202
1184
 
1203
1185
    def __init__(self, spec, branch, extra=None):
1204
1186
        BzrError.__init__(self, branch=branch, spec=spec)
1205
 
        self.branch_url = getattr(branch, 'user_url', str(branch))
1206
1187
        if extra:
1207
1188
            self.extra = '\n' + str(extra)
1208
1189
        else:
1399
1380
 
1400
1381
class WeaveParentMismatch(WeaveError):
1401
1382
 
1402
 
    _fmt = "Parents are mismatched between two revisions. %(msg)s"
 
1383
    _fmt = "Parents are mismatched between two revisions. %(message)s"
1403
1384
 
1404
1385
 
1405
1386
class WeaveInvalidChecksum(WeaveError):
1406
1387
 
1407
 
    _fmt = "Text did not match its checksum: %(msg)s"
 
1388
    _fmt = "Text did not match it's checksum: %(message)s"
1408
1389
 
1409
1390
 
1410
1391
class WeaveTextDiffers(WeaveError):
1458
1439
 
1459
1440
class VersionedFileInvalidChecksum(VersionedFileError):
1460
1441
 
1461
 
    _fmt = "Text did not match its checksum: %(msg)s"
 
1442
    _fmt = "Text did not match its checksum: %(message)s"
1462
1443
 
1463
1444
 
1464
1445
class KnitError(InternalBzrError):
1944
1925
    _fmt = "Moving the root directory is not supported at this time"
1945
1926
 
1946
1927
 
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
 
 
1958
1928
class BzrMoveFailedError(BzrError):
1959
1929
 
1960
1930
    _fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
2005
1975
        "Use --keep to not delete them, or --force to delete them regardless.")
2006
1976
 
2007
1977
    def __init__(self, tree_delta):
2008
 
        symbol_versioning.warn(symbol_versioning.deprecated_in((2, 3, 0)) %
2009
 
            "BzrRemoveChangedFilesError", DeprecationWarning, stacklevel=2)
2010
1978
        BzrError.__init__(self)
2011
1979
        self.changes_as_text = tree_delta.get_changes_as_text()
2012
1980
        #self.paths_as_string = '\n'.join(changed_files)
2866
2834
        else:
2867
2835
            more = ' ' + more
2868
2836
        import bzrlib.urlutils as urlutils
2869
 
        user_url = getattr(tree, "user_url", None)
2870
 
        if user_url is None:
2871
 
            display_url = str(tree)
2872
 
        else:
2873
 
            display_url = urlutils.unescape_for_display(user_url, 'ascii')
 
2837
        display_url = urlutils.unescape_for_display(
 
2838
            tree.user_url, 'ascii')
2874
2839
        BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2875
2840
 
2876
2841
 
2877
 
class ShelvedChanges(UncommittedChanges):
2878
 
 
2879
 
    _fmt = ('Working tree "%(display_url)s" has shelved changes'
2880
 
            ' (See bzr shelve --list).%(more)s')
2881
 
 
2882
 
 
2883
2842
class MissingTemplateVariable(BzrError):
2884
2843
 
2885
2844
    _fmt = 'Variable {%(name)s} is not available.'
2954
2913
        self.user_encoding = osutils.get_user_encoding()
2955
2914
 
2956
2915
 
2957
 
class NoSuchConfig(BzrError):
2958
 
 
2959
 
    _fmt = ('The "%(config_id)s" configuration does not exist.')
2960
 
 
2961
 
    def __init__(self, config_id):
2962
 
        BzrError.__init__(self, config_id=config_id)
2963
 
 
2964
 
 
2965
 
class NoSuchConfigOption(BzrError):
2966
 
 
2967
 
    _fmt = ('The "%(option_name)s" configuration option does not exist.')
2968
 
 
2969
 
    def __init__(self, option_name):
2970
 
        BzrError.__init__(self, option_name=option_name)
2971
 
 
2972
 
 
2973
2916
class NoSuchAlias(BzrError):
2974
2917
 
2975
2918
    _fmt = ('The alias "%(alias_name)s" does not exist.')
3191
3134
    def __init__(self, bzrdir):
3192
3135
        self.bzrdir = bzrdir
3193
3136
 
3194
 
 
3195
 
class NoWhoami(BzrError):
3196
 
 
3197
 
    _fmt = ('Unable to determine your name.\n'
3198
 
        "Please, set your name with the 'whoami' command.\n"
3199
 
        'E.g. bzr whoami "Your Name <name@example.com>"')
3200
 
 
3201
 
 
3202
 
class InvalidPattern(BzrError):
3203
 
 
3204
 
    _fmt = ('Invalid pattern(s) found. %(msg)s')
3205
 
 
3206
 
    def __init__(self, msg):
3207
 
        self.msg = msg
3208
 
 
3209
 
 
3210
 
class RecursiveBind(BzrError):
3211
 
 
3212
 
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
3213
 
        'Please use `bzr unbind` to fix.')
3214
 
 
3215
 
    def __init__(self, branch_url):
3216
 
        self.branch_url = branch_url
3217