/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: Rory Yorke
  • Date: 2010-10-20 14:38:53 UTC
  • mto: This revision was merged to the branch mainline in revision 5519.
  • Revision ID: rory.yorke@gmail.com-20101020143853-9kfd2ldcjfroh8jw
Show missing files in bzr status (bug 134168).

"bzr status" will now show missing files, that is, those added with "bzr
add" and then removed by non bzr means (e.g., rm).

Blackbox tests were added for this case, and tests were also added to
test_delta, since the implementation change is in bzrlib.delta.

Might also affect bug 189709.

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 = True
 
683
    internal_error = False
684
684
 
685
685
    def __init__(self, path, base, extra=None):
686
686
        BzrError.__init__(self)
782
782
 
783
783
    _fmt = 'File "%(path)s" is not in branch %(branch_base)s.'
784
784
 
 
785
    # use PathNotChild instead
 
786
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 3, 0)))
785
787
    def __init__(self, branch, path):
786
788
        BzrError.__init__(self)
787
789
        self.branch = branch
947
949
    # original exception is available as e.original_error
948
950
    #
949
951
    # 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
 
952
    def __init__(self, msg):
 
953
        self.msg = msg
955
954
 
956
955
 
957
956
class LockActive(LockError):
1041
1040
class LockContention(LockError):
1042
1041
 
1043
1042
    _fmt = 'Could not acquire lock "%(lock)s": %(msg)s'
1044
 
    # TODO: show full url for lock, combining the transport and relative
1045
 
    # bits?
1046
1043
 
1047
1044
    internal_error = False
1048
1045
 
1075
1072
        self.target = target
1076
1073
 
1077
1074
 
 
1075
class LockCorrupt(LockError):
 
1076
 
 
1077
    _fmt = ("Lock is apparently held, but corrupted: %(corruption_info)s\n"
 
1078
            "Use 'bzr break-lock' to clear it")
 
1079
 
 
1080
    internal_error = False
 
1081
 
 
1082
    def __init__(self, corruption_info, file_data=None):
 
1083
        self.corruption_info = corruption_info
 
1084
        self.file_data = file_data
 
1085
 
 
1086
 
1078
1087
class LockNotHeld(LockError):
1079
1088
 
1080
1089
    _fmt = "Lock not held: %(lock)s"
1180
1189
class InvalidRevisionSpec(BzrError):
1181
1190
 
1182
1191
    _fmt = ("Requested revision: '%(spec)s' does not exist in branch:"
1183
 
            " %(branch)s%(extra)s")
 
1192
            " %(branch_url)s%(extra)s")
1184
1193
 
1185
1194
    def __init__(self, spec, branch, extra=None):
1186
1195
        BzrError.__init__(self, branch=branch, spec=spec)
 
1196
        self.branch_url = getattr(branch, 'user_url', str(branch))
1187
1197
        if extra:
1188
1198
            self.extra = '\n' + str(extra)
1189
1199
        else:
1380
1390
 
1381
1391
class WeaveParentMismatch(WeaveError):
1382
1392
 
1383
 
    _fmt = "Parents are mismatched between two revisions. %(message)s"
 
1393
    _fmt = "Parents are mismatched between two revisions. %(msg)s"
1384
1394
 
1385
1395
 
1386
1396
class WeaveInvalidChecksum(WeaveError):
1387
1397
 
1388
 
    _fmt = "Text did not match it's checksum: %(message)s"
 
1398
    _fmt = "Text did not match its checksum: %(msg)s"
1389
1399
 
1390
1400
 
1391
1401
class WeaveTextDiffers(WeaveError):
1439
1449
 
1440
1450
class VersionedFileInvalidChecksum(VersionedFileError):
1441
1451
 
1442
 
    _fmt = "Text did not match its checksum: %(message)s"
 
1452
    _fmt = "Text did not match its checksum: %(msg)s"
1443
1453
 
1444
1454
 
1445
1455
class KnitError(InternalBzrError):
1925
1935
    _fmt = "Moving the root directory is not supported at this time"
1926
1936
 
1927
1937
 
 
1938
class TransformRenameFailed(BzrError):
 
1939
 
 
1940
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
 
1941
 
 
1942
    def __init__(self, from_path, to_path, why, errno):
 
1943
        self.from_path = from_path
 
1944
        self.to_path = to_path
 
1945
        self.why = why
 
1946
        self.errno = errno
 
1947
 
 
1948
 
1928
1949
class BzrMoveFailedError(BzrError):
1929
1950
 
1930
1951
    _fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1975
1996
        "Use --keep to not delete them, or --force to delete them regardless.")
1976
1997
 
1977
1998
    def __init__(self, tree_delta):
 
1999
        symbol_versioning.warn(symbol_versioning.deprecated_in((2, 3, 0)) %
 
2000
            "BzrRemoveChangedFilesError", DeprecationWarning, stacklevel=2)
1978
2001
        BzrError.__init__(self)
1979
2002
        self.changes_as_text = tree_delta.get_changes_as_text()
1980
2003
        #self.paths_as_string = '\n'.join(changed_files)
2834
2857
        else:
2835
2858
            more = ' ' + more
2836
2859
        import bzrlib.urlutils as urlutils
2837
 
        display_url = urlutils.unescape_for_display(
2838
 
            tree.user_url, 'ascii')
 
2860
        user_url = getattr(tree, "user_url", None)
 
2861
        if user_url is None:
 
2862
            display_url = str(tree)
 
2863
        else:
 
2864
            display_url = urlutils.unescape_for_display(user_url, 'ascii')
2839
2865
        BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2840
2866
 
2841
2867
 
 
2868
class ShelvedChanges(UncommittedChanges):
 
2869
 
 
2870
    _fmt = ('Working tree "%(display_url)s" has shelved changes'
 
2871
            ' (See bzr shelve --list).%(more)s')
 
2872
 
 
2873
 
2842
2874
class MissingTemplateVariable(BzrError):
2843
2875
 
2844
2876
    _fmt = 'Variable {%(name)s} is not available.'
2913
2945
        self.user_encoding = osutils.get_user_encoding()
2914
2946
 
2915
2947
 
 
2948
class NoSuchConfig(BzrError):
 
2949
 
 
2950
    _fmt = ('The "%(config_id)s" configuration does not exist.')
 
2951
 
 
2952
    def __init__(self, config_id):
 
2953
        BzrError.__init__(self, config_id=config_id)
 
2954
 
 
2955
 
 
2956
class NoSuchConfigOption(BzrError):
 
2957
 
 
2958
    _fmt = ('The "%(option_name)s" configuration option does not exist.')
 
2959
 
 
2960
    def __init__(self, option_name):
 
2961
        BzrError.__init__(self, option_name=option_name)
 
2962
 
 
2963
 
2916
2964
class NoSuchAlias(BzrError):
2917
2965
 
2918
2966
    _fmt = ('The alias "%(alias_name)s" does not exist.')
3134
3182
    def __init__(self, bzrdir):
3135
3183
        self.bzrdir = bzrdir
3136
3184
 
 
3185
 
 
3186
class NoWhoami(BzrError):
 
3187
 
 
3188
    _fmt = ('Unable to determine your name.\n'
 
3189
        "Please, set your name with the 'whoami' command.\n"
 
3190
        'E.g. bzr whoami "Your Name <name@example.com>"')
 
3191
 
 
3192
 
 
3193
class InvalidPattern(BzrError):
 
3194
 
 
3195
    _fmt = ('Invalid pattern(s) found. %(msg)s')
 
3196
 
 
3197
    def __init__(self, msg):
 
3198
        self.msg = msg
 
3199
 
 
3200
 
 
3201
class RecursiveBind(BzrError):
 
3202
 
 
3203
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
 
3204
        'Please use `bzr unbind` to fix.')
 
3205
 
 
3206
    def __init__(self, branch_url):
 
3207
        self.branch_url = branch_url
 
3208