/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 breezy/errors.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Exceptions for bzr, and reporting of them.
18
18
"""
19
19
 
 
20
from __future__ import absolute_import
 
21
 
 
22
from .sixish import (
 
23
    PY3,
 
24
    )
20
25
 
21
26
# TODO: is there any value in providing the .args field used by standard
22
27
# python exceptions?   A list of values with no names seems less useful
103
108
               getattr(self, '_fmt', None),
104
109
               err)
105
110
 
106
 
    __str__ = _format
 
111
    if PY3:
 
112
        __str__ = _format
 
113
    else:
 
114
        def __str__(self):
 
115
            return self._format().encode('utf-8')
 
116
 
 
117
        __unicode__ = _format
107
118
 
108
119
    def __repr__(self):
109
120
        return '%s(%s)' % (self.__class__.__name__, str(self))
113
124
        fmt = getattr(self, '_fmt', None)
114
125
        if fmt is not None:
115
126
            from breezy.i18n import gettext
116
 
            return gettext(fmt)  # _fmt strings should be ascii
 
127
            return gettext(fmt) # _fmt strings should be ascii
117
128
 
118
129
    def __eq__(self, other):
119
130
        if self.__class__ is not other.__class__:
135
146
    internal_error = True
136
147
 
137
148
 
 
149
class AlreadyBuilding(BzrError):
 
150
 
 
151
    _fmt = "The tree builder is already building a tree."
 
152
 
 
153
 
138
154
class BranchError(BzrError):
139
155
    """Base class for concrete 'errors about a branch'."""
140
156
 
151
167
        self.msg = msg
152
168
 
153
169
 
 
170
class DirstateCorrupt(BzrError):
 
171
 
 
172
    _fmt = "The dirstate file (%(state)s) appears to be corrupt: %(msg)s"
 
173
 
 
174
    def __init__(self, state, msg):
 
175
        BzrError.__init__(self)
 
176
        self.state = state
 
177
        self.msg = msg
 
178
 
 
179
 
 
180
class DisabledMethod(InternalBzrError):
 
181
 
 
182
    _fmt = "The smart server method '%(class_name)s' is disabled."
 
183
 
 
184
    def __init__(self, class_name):
 
185
        BzrError.__init__(self)
 
186
        self.class_name = class_name
 
187
 
 
188
 
154
189
class IncompatibleVersion(BzrError):
155
190
 
156
191
    _fmt = 'API %(api)s is not compatible; one of versions %(wanted)r '\
171
206
        self.transport = transport
172
207
 
173
208
 
 
209
class InvalidEntryName(InternalBzrError):
 
210
 
 
211
    _fmt = "Invalid entry name: %(name)s"
 
212
 
 
213
    def __init__(self, name):
 
214
        BzrError.__init__(self)
 
215
        self.name = name
 
216
 
 
217
 
174
218
class InvalidRevisionNumber(BzrError):
175
219
 
176
220
    _fmt = "Invalid revision number %(revno)s"
202
246
class RootMissing(InternalBzrError):
203
247
 
204
248
    _fmt = ("The root entry of a tree must be the first entry supplied to "
205
 
            "the commit builder.")
 
249
        "the commit builder.")
206
250
 
207
251
 
208
252
class NoPublicBranch(BzrError):
225
269
        self.tree = tree
226
270
 
227
271
 
 
272
class NoSuchIdInRepository(NoSuchId):
 
273
 
 
274
    _fmt = ('The file id "%(file_id)s" is not present in the repository'
 
275
            ' %(repository)r')
 
276
 
 
277
    def __init__(self, repository, file_id):
 
278
        BzrError.__init__(self, repository=repository, file_id=file_id)
 
279
 
 
280
 
228
281
class NotStacked(BranchError):
229
282
 
230
283
    _fmt = "The branch '%(branch)s' is not stacked."
231
284
 
232
285
 
 
286
class InventoryModified(InternalBzrError):
 
287
 
 
288
    _fmt = ("The current inventory for the tree %(tree)r has been modified,"
 
289
            " so a clean inventory cannot be read without data loss.")
 
290
 
 
291
    def __init__(self, tree):
 
292
        self.tree = tree
 
293
 
 
294
 
233
295
class NoWorkingTree(BzrError):
234
296
 
235
297
    _fmt = 'No WorkingTree exists for "%(base)s".'
239
301
        self.base = base
240
302
 
241
303
 
 
304
class NotBuilding(BzrError):
 
305
 
 
306
    _fmt = "Not currently building a tree."
 
307
 
 
308
 
242
309
class NotLocalUrl(BzrError):
243
310
 
244
311
    _fmt = "%(url)s is not a local path."
255
322
        self.base = base
256
323
 
257
324
 
258
 
class NoWhoami(BzrError):
259
 
 
260
 
    _fmt = ('Unable to determine your name.\n'
261
 
            "Please, set your name with the 'whoami' command.\n"
262
 
            'E.g. brz whoami "Your Name <name@example.com>"')
263
 
 
264
 
 
265
 
class CommandError(BzrError):
 
325
class BzrCommandError(BzrError):
266
326
    """Error from user command"""
267
327
 
268
328
    # Error from malformed user command; please avoid raising this as a
270
330
    #
271
331
    # I think it's a waste of effort to differentiate between errors that
272
332
    # are not intended to be caught anyway.  UI code need not subclass
273
 
    # CommandError, and non-UI code should not throw a subclass of
274
 
    # CommandError.  ADHB 20051211
275
 
 
276
 
 
277
 
# Provide the old name as backup, for the moment.
278
 
BzrCommandError = CommandError
 
333
    # BzrCommandError, and non-UI code should not throw a subclass of
 
334
    # BzrCommandError.  ADHB 20051211
279
335
 
280
336
 
281
337
class NotWriteLocked(BzrError):
286
342
        self.not_locked = not_locked
287
343
 
288
344
 
 
345
class BadIndexFormatSignature(BzrError):
 
346
 
 
347
    _fmt = "%(value)s is not an index of type %(_type)s."
 
348
 
 
349
    def __init__(self, value, _type):
 
350
        BzrError.__init__(self)
 
351
        self.value = value
 
352
        self._type = _type
 
353
 
 
354
 
 
355
class BadIndexData(BzrError):
 
356
 
 
357
    _fmt = "Error in data for index %(value)s."
 
358
 
 
359
    def __init__(self, value):
 
360
        BzrError.__init__(self)
 
361
        self.value = value
 
362
 
 
363
 
 
364
class BadIndexDuplicateKey(BzrError):
 
365
 
 
366
    _fmt = "The key '%(key)s' is already in index '%(index)s'."
 
367
 
 
368
    def __init__(self, key, index):
 
369
        BzrError.__init__(self)
 
370
        self.key = key
 
371
        self.index = index
 
372
 
 
373
 
 
374
class BadIndexKey(BzrError):
 
375
 
 
376
    _fmt = "The key '%(key)s' is not a valid key."
 
377
 
 
378
    def __init__(self, key):
 
379
        BzrError.__init__(self)
 
380
        self.key = key
 
381
 
 
382
 
 
383
class BadIndexOptions(BzrError):
 
384
 
 
385
    _fmt = "Could not parse options for index %(value)s."
 
386
 
 
387
    def __init__(self, value):
 
388
        BzrError.__init__(self)
 
389
        self.value = value
 
390
 
 
391
 
 
392
class BadIndexValue(BzrError):
 
393
 
 
394
    _fmt = "The value '%(value)s' is not a valid value."
 
395
 
 
396
    def __init__(self, value):
 
397
        BzrError.__init__(self)
 
398
        self.value = value
 
399
 
 
400
 
289
401
class StrictCommitFailed(BzrError):
290
402
 
291
403
    _fmt = "Commit refused because there are unknown files in the tree"
377
489
    _fmt = 'Permission denied: "%(path)s"%(extra)s'
378
490
 
379
491
 
 
492
class UnavailableRepresentation(InternalBzrError):
 
493
 
 
494
    _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
 
495
        "is encoded as '%(native)s'.")
 
496
 
 
497
    def __init__(self, key, wanted, native):
 
498
        InternalBzrError.__init__(self)
 
499
        self.wanted = wanted
 
500
        self.native = native
 
501
        self.key = key
 
502
 
 
503
 
 
504
class UnknownHook(BzrError):
 
505
 
 
506
    _fmt = "The %(type)s hook '%(hook)s' is unknown in this version of breezy."
 
507
 
 
508
    def __init__(self, hook_type, hook_name):
 
509
        BzrError.__init__(self)
 
510
        self.type = hook_type
 
511
        self.hook = hook_name
 
512
 
 
513
 
380
514
class UnsupportedProtocol(PathError):
381
515
 
382
516
    _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s'
385
519
        PathError.__init__(self, url, extra=extra)
386
520
 
387
521
 
 
522
class UnstackableBranchFormat(BzrError):
 
523
 
 
524
    _fmt = ("The branch '%(url)s'(%(format)s) is not a stackable format. "
 
525
        "You will need to upgrade the branch to permit branch stacking.")
 
526
 
 
527
    def __init__(self, format, url):
 
528
        BzrError.__init__(self)
 
529
        self.format = format
 
530
        self.url = url
 
531
 
 
532
 
388
533
class UnstackableLocationError(BzrError):
389
534
 
390
535
    _fmt = "The branch '%(branch_url)s' cannot be stacked on '%(target_url)s'."
398
543
class UnstackableRepositoryFormat(BzrError):
399
544
 
400
545
    _fmt = ("The repository '%(url)s'(%(format)s) is not a stackable format. "
401
 
            "You will need to upgrade the repository to permit branch stacking.")
 
546
        "You will need to upgrade the repository to permit branch stacking.")
402
547
 
403
548
    def __init__(self, format, url):
404
549
        BzrError.__init__(self)
454
599
    _fmt = 'Not a branch: "%(path)s"%(detail)s.'
455
600
 
456
601
    def __init__(self, path, detail=None, controldir=None):
457
 
        from . import urlutils
458
 
        path = urlutils.unescape_for_display(path, 'ascii')
459
 
        if detail is not None:
460
 
            detail = ': ' + detail
461
 
        self.detail = detail
462
 
        self.controldir = controldir
463
 
        PathError.__init__(self, path=path)
 
602
       from . import urlutils
 
603
       path = urlutils.unescape_for_display(path, 'ascii')
 
604
       if detail is not None:
 
605
           detail = ': ' + detail
 
606
       self.detail = detail
 
607
       self.controldir = controldir
 
608
       PathError.__init__(self, path=path)
464
609
 
465
610
    def __repr__(self):
466
611
        return '<%s %r>' % (self.__class__.__name__, self.__dict__)
468
613
    def _get_format_string(self):
469
614
        # GZ 2017-06-08: Not the best place to lazy fill detail in.
470
615
        if self.detail is None:
471
 
            self.detail = self._get_detail()
 
616
           self.detail = self._get_detail()
472
617
        return super(NotBranchError, self)._get_format_string()
473
618
 
474
619
    def _get_detail(self):
496
641
    _fmt = 'No submit branch available for branch "%(path)s"'
497
642
 
498
643
    def __init__(self, branch):
499
 
        from . import urlutils
500
 
        self.path = urlutils.unescape_for_display(branch.base, 'ascii')
 
644
       from . import urlutils
 
645
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
501
646
 
502
647
 
503
648
class AlreadyControlDirError(PathError):
530
675
(use brz checkout if you wish to build a working tree): "%(path)s"'
531
676
 
532
677
 
 
678
class AtomicFileAlreadyClosed(PathError):
 
679
 
 
680
    _fmt = ('"%(function)s" called on an AtomicFile after it was closed:'
 
681
            ' "%(path)s"')
 
682
 
 
683
    def __init__(self, path, function):
 
684
        PathError.__init__(self, path=path, extra=None)
 
685
        self.function = function
 
686
 
 
687
 
533
688
class InaccessibleParent(PathError):
534
689
 
535
690
    _fmt = ('Parent not accessible given base "%(base)s" and'
543
698
class NoRepositoryPresent(BzrError):
544
699
 
545
700
    _fmt = 'No repository present: "%(path)s"'
546
 
 
547
701
    def __init__(self, controldir):
548
702
        BzrError.__init__(self)
549
703
        self.path = controldir.transport.clone('..').base
594
748
    """
595
749
 
596
750
    _fmt = "%(target)s\n" \
597
 
        "is not compatible with\n" \
598
 
        "%(source)s\n" \
599
 
        "%(details)s"
 
751
            "is not compatible with\n" \
 
752
            "%(source)s\n" \
 
753
            "%(details)s"
600
754
 
601
755
    def __init__(self, source, target, details=None):
602
756
        if details is None:
883
1037
        self.lock_token = lock_token
884
1038
 
885
1039
 
 
1040
class PointlessCommit(BzrError):
 
1041
 
 
1042
    _fmt = "No changes to commit"
 
1043
 
 
1044
 
 
1045
class CannotCommitSelectedFileMerge(BzrError):
 
1046
 
 
1047
    _fmt = 'Selected-file commit of merges is not supported yet:'\
 
1048
        ' files %(files_str)s'
 
1049
 
 
1050
    def __init__(self, files):
 
1051
        files_str = ', '.join(files)
 
1052
        BzrError.__init__(self, files=files, files_str=files_str)
 
1053
 
 
1054
 
 
1055
class ExcludesUnsupported(BzrError):
 
1056
 
 
1057
    _fmt = ('Excluding paths during commit is not supported by '
 
1058
            'repository at %(repository)r.')
 
1059
 
 
1060
    def __init__(self, repository):
 
1061
        BzrError.__init__(self, repository=repository)
 
1062
 
 
1063
 
 
1064
class BadCommitMessageEncoding(BzrError):
 
1065
 
 
1066
    _fmt = 'The specified commit message contains characters unsupported by '\
 
1067
        'the current encoding.'
 
1068
 
 
1069
 
886
1070
class UpgradeReadonly(BzrError):
887
1071
 
888
1072
    _fmt = "Upgrade URL cannot work with readonly URLs."
897
1081
        self.format = format
898
1082
 
899
1083
 
 
1084
class StrictCommitFailed(Exception):
 
1085
 
 
1086
    _fmt = "Commit refused because there are unknowns in the tree."
 
1087
 
 
1088
 
900
1089
class NoSuchRevision(InternalBzrError):
901
1090
 
902
1091
    _fmt = "%(branch)s has no revision %(revision)s"
930
1119
        self.revision_id = revision_id
931
1120
 
932
1121
 
 
1122
class InvalidRevisionSpec(BzrError):
 
1123
 
 
1124
    _fmt = ("Requested revision: '%(spec)s' does not exist in branch:"
 
1125
            " %(branch_url)s%(extra)s")
 
1126
 
 
1127
    def __init__(self, spec, branch, extra=None):
 
1128
        BzrError.__init__(self, branch=branch, spec=spec)
 
1129
        self.branch_url = getattr(branch, 'user_url', str(branch))
 
1130
        if extra:
 
1131
            self.extra = '\n' + str(extra)
 
1132
        else:
 
1133
            self.extra = ''
 
1134
 
 
1135
 
933
1136
class AppendRevisionsOnlyViolation(BzrError):
934
1137
 
935
1138
    _fmt = ('Operation denied because it would change the main history,'
936
 
            ' which is not permitted by the append_revisions_only setting on'
937
 
            ' branch "%(location)s".')
 
1139
           ' which is not permitted by the append_revisions_only setting on'
 
1140
           ' branch "%(location)s".')
938
1141
 
939
1142
    def __init__(self, location):
940
 
        import breezy.urlutils as urlutils
941
 
        location = urlutils.unescape_for_display(location, 'ascii')
942
 
        BzrError.__init__(self, location=location)
 
1143
       import breezy.urlutils as urlutils
 
1144
       location = urlutils.unescape_for_display(location, 'ascii')
 
1145
       BzrError.__init__(self, location=location)
943
1146
 
944
1147
 
945
1148
class DivergedBranches(BzrError):
985
1188
class NoCommonRoot(BzrError):
986
1189
 
987
1190
    _fmt = ("Revisions are not derived from the same root: "
988
 
            "%(revision_a)s %(revision_b)s.")
 
1191
           "%(revision_a)s %(revision_b)s.")
989
1192
 
990
1193
    def __init__(self, revision_a, revision_b):
991
1194
        BzrError.__init__(self, revision_a=revision_a, revision_b=revision_b)
997
1200
 
998
1201
    def __init__(self, rev_id, not_ancestor_id):
999
1202
        BzrError.__init__(self, rev_id=rev_id,
1000
 
                          not_ancestor_id=not_ancestor_id)
 
1203
            not_ancestor_id=not_ancestor_id)
1001
1204
 
1002
1205
 
1003
1206
class NoCommits(BranchError):
1011
1214
        BzrError.__init__(self, "Store %s is not listable" % store)
1012
1215
 
1013
1216
 
 
1217
 
1014
1218
class UnlistableBranch(BzrError):
1015
1219
 
1016
1220
    def __init__(self, br):
1092
1296
    _fmt = "Text did not match its checksum: %(msg)s"
1093
1297
 
1094
1298
 
 
1299
class KnitError(InternalBzrError):
 
1300
 
 
1301
    _fmt = "Knit error"
 
1302
 
 
1303
 
 
1304
class KnitCorrupt(KnitError):
 
1305
 
 
1306
    _fmt = "Knit %(filename)s corrupt: %(how)s"
 
1307
 
 
1308
    def __init__(self, filename, how):
 
1309
        KnitError.__init__(self)
 
1310
        self.filename = filename
 
1311
        self.how = how
 
1312
 
 
1313
 
 
1314
class SHA1KnitCorrupt(KnitCorrupt):
 
1315
 
 
1316
    _fmt = ("Knit %(filename)s corrupt: sha-1 of reconstructed text does not "
 
1317
        "match expected sha-1. key %(key)s expected sha %(expected)s actual "
 
1318
        "sha %(actual)s")
 
1319
 
 
1320
    def __init__(self, filename, actual, expected, key, content):
 
1321
        KnitError.__init__(self)
 
1322
        self.filename = filename
 
1323
        self.actual = actual
 
1324
        self.expected = expected
 
1325
        self.key = key
 
1326
        self.content = content
 
1327
 
 
1328
 
 
1329
class KnitDataStreamIncompatible(KnitError):
 
1330
    # Not raised anymore, as we can convert data streams.  In future we may
 
1331
    # need it again for more exotic cases, so we're keeping it around for now.
 
1332
 
 
1333
    _fmt = "Cannot insert knit data stream of format \"%(stream_format)s\" into knit of format \"%(target_format)s\"."
 
1334
 
 
1335
    def __init__(self, stream_format, target_format):
 
1336
        self.stream_format = stream_format
 
1337
        self.target_format = target_format
 
1338
 
 
1339
 
 
1340
class KnitDataStreamUnknown(KnitError):
 
1341
    # Indicates a data stream we don't know how to handle.
 
1342
 
 
1343
    _fmt = "Cannot parse knit data stream of format \"%(stream_format)s\"."
 
1344
 
 
1345
    def __init__(self, stream_format):
 
1346
        self.stream_format = stream_format
 
1347
 
 
1348
 
 
1349
class KnitHeaderError(KnitError):
 
1350
 
 
1351
    _fmt = 'Knit header error: %(badline)r unexpected for file "%(filename)s".'
 
1352
 
 
1353
    def __init__(self, badline, filename):
 
1354
        KnitError.__init__(self)
 
1355
        self.badline = badline
 
1356
        self.filename = filename
 
1357
 
 
1358
class KnitIndexUnknownMethod(KnitError):
 
1359
    """Raised when we don't understand the storage method.
 
1360
 
 
1361
    Currently only 'fulltext' and 'line-delta' are supported.
 
1362
    """
 
1363
 
 
1364
    _fmt = ("Knit index %(filename)s does not have a known method"
 
1365
            " in options: %(options)r")
 
1366
 
 
1367
    def __init__(self, filename, options):
 
1368
        KnitError.__init__(self)
 
1369
        self.filename = filename
 
1370
        self.options = options
 
1371
 
 
1372
 
1095
1373
class RetryWithNewPacks(BzrError):
1096
1374
    """Raised when we realize that the packs on disk have changed.
1097
1375
 
1158
1436
        if orig_error is None:
1159
1437
            orig_error = ''
1160
1438
        if msg is None:
1161
 
            msg = ''
 
1439
            msg =  ''
1162
1440
        self.msg = msg
1163
1441
        self.orig_error = orig_error
1164
1442
        BzrError.__init__(self)
1209
1487
        self.exc_type, self.exc_value, self.exc_tb = exc_info
1210
1488
        self.exc_info = exc_info
1211
1489
        traceback_strings = traceback.format_exception(
1212
 
            self.exc_type, self.exc_value, self.exc_tb)
 
1490
                self.exc_type, self.exc_value, self.exc_tb)
1213
1491
        self.traceback_text = ''.join(traceback_strings)
1214
1492
 
1215
1493
 
1280
1558
        TransportError.__init__(self, msg, orig_error=orig_error)
1281
1559
 
1282
1560
 
1283
 
class UnexpectedHttpStatus(InvalidHttpResponse):
1284
 
 
1285
 
    _fmt = "Unexpected HTTP status %(code)d for %(path)s: %(extra)s"
1286
 
 
1287
 
    def __init__(self, path, code, extra=None):
1288
 
        self.path = path
1289
 
        self.code = code
1290
 
        self.extra = extra or ''
1291
 
        full_msg = 'status code %d unexpected' % code
1292
 
        if extra is not None:
1293
 
            full_msg += ': ' + extra
1294
 
        InvalidHttpResponse.__init__(
1295
 
            self, path, full_msg)
1296
 
 
1297
 
 
1298
 
class BadHttpRequest(UnexpectedHttpStatus):
1299
 
 
1300
 
    _fmt = "Bad http request for %(path)s: %(reason)s"
1301
 
 
1302
 
    def __init__(self, path, reason):
1303
 
        self.path = path
1304
 
        self.reason = reason
1305
 
        TransportError.__init__(self, reason)
1306
 
 
1307
 
 
1308
1561
class InvalidHttpRange(InvalidHttpResponse):
1309
1562
 
1310
1563
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
1378
1631
        BzrError.__init__(self, basedir=tree.basedir)
1379
1632
 
1380
1633
 
 
1634
class CantReprocessAndShowBase(BzrError):
 
1635
 
 
1636
    _fmt = ("Can't reprocess and show base, because reprocessing obscures "
 
1637
           "the relationship of conflicting lines to the base")
 
1638
 
 
1639
 
1381
1640
class GraphCycleError(BzrError):
1382
1641
 
1383
1642
    _fmt = "Cycle in graph %(graph)r"
1460
1719
        self.file_id = file_id
1461
1720
 
1462
1721
 
 
1722
class DuplicateFileId(BzrError):
 
1723
 
 
1724
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
 
1725
 
 
1726
    def __init__(self, file_id, entry):
 
1727
        BzrError.__init__(self)
 
1728
        self.file_id = file_id
 
1729
        self.entry = entry
 
1730
 
 
1731
 
1463
1732
class DuplicateKey(BzrError):
1464
1733
 
1465
1734
    _fmt = "Key %(key)s is already present in map"
1473
1742
        self.prefix = prefix
1474
1743
 
1475
1744
 
 
1745
class MalformedTransform(InternalBzrError):
 
1746
 
 
1747
    _fmt = "Tree transform is malformed %(conflicts)r"
 
1748
 
 
1749
 
 
1750
class NoFinalPath(BzrError):
 
1751
 
 
1752
    _fmt = ("No final name for trans_id %(trans_id)r\n"
 
1753
            "file-id: %(file_id)r\n"
 
1754
            "root trans-id: %(root_trans_id)r\n")
 
1755
 
 
1756
    def __init__(self, trans_id, transform):
 
1757
        self.trans_id = trans_id
 
1758
        self.file_id = transform.final_file_id(trans_id)
 
1759
        self.root_trans_id = transform.root
 
1760
 
 
1761
 
1476
1762
class BzrBadParameter(InternalBzrError):
1477
1763
 
1478
1764
    _fmt = "Bad parameter: %(param)r"
1490
1776
    _fmt = "Parameter %(param)s is neither unicode nor utf8."
1491
1777
 
1492
1778
 
 
1779
class ReusingTransform(BzrError):
 
1780
 
 
1781
    _fmt = "Attempt to reuse a transform that has already been applied."
 
1782
 
 
1783
 
 
1784
class CantMoveRoot(BzrError):
 
1785
 
 
1786
    _fmt = "Moving the root directory is not supported at this time"
 
1787
 
 
1788
 
 
1789
class TransformRenameFailed(BzrError):
 
1790
 
 
1791
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
 
1792
 
 
1793
    def __init__(self, from_path, to_path, why, errno):
 
1794
        self.from_path = from_path
 
1795
        self.to_path = to_path
 
1796
        self.why = why
 
1797
        self.errno = errno
 
1798
 
 
1799
 
1493
1800
class BzrMoveFailedError(BzrError):
1494
1801
 
1495
1802
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1496
 
            "%(_has_extra)s%(extra)s")
 
1803
        "%(_has_extra)s%(extra)s")
1497
1804
 
1498
1805
    def __init__(self, from_path='', to_path='', extra=None):
1499
1806
        from breezy.osutils import splitpath
1529
1836
class BzrRenameFailedError(BzrMoveFailedError):
1530
1837
 
1531
1838
    _fmt = ("Could not rename %(from_path)s%(operator)s %(to_path)s"
1532
 
            "%(_has_extra)s%(extra)s")
 
1839
        "%(_has_extra)s%(extra)s")
1533
1840
 
1534
1841
    def __init__(self, from_path, to_path, extra=None):
1535
1842
        BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1581
1888
class BadConversionTarget(BzrError):
1582
1889
 
1583
1890
    _fmt = "Cannot convert from format %(from_format)s to format %(format)s." \
1584
 
        "    %(problem)s"
 
1891
            "    %(problem)s"
1585
1892
 
1586
1893
    def __init__(self, problem, format, from_format=None):
1587
1894
        BzrError.__init__(self)
1619
1926
    _fmt = "Diff3 is not installed on this machine."
1620
1927
 
1621
1928
 
 
1929
class ExistingContent(BzrError):
 
1930
    # Added in breezy 0.92, used by VersionedFile.add_lines.
 
1931
 
 
1932
    _fmt = "The content being inserted is already present."
 
1933
 
 
1934
 
1622
1935
class ExistingLimbo(BzrError):
1623
1936
 
1624
1937
    _fmt = """This tree contains left-over files from a failed operation.
1626
1939
    keep, and delete it when you are done."""
1627
1940
 
1628
1941
    def __init__(self, limbo_dir):
1629
 
        BzrError.__init__(self)
1630
 
        self.limbo_dir = limbo_dir
 
1942
       BzrError.__init__(self)
 
1943
       self.limbo_dir = limbo_dir
1631
1944
 
1632
1945
 
1633
1946
class ExistingPendingDeletion(BzrError):
1637
1950
    wish to keep, and delete it when you are done."""
1638
1951
 
1639
1952
    def __init__(self, pending_deletion):
1640
 
        BzrError.__init__(self, pending_deletion=pending_deletion)
 
1953
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1954
 
 
1955
 
 
1956
class ImmortalLimbo(BzrError):
 
1957
 
 
1958
    _fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
 
1959
    Please examine %(limbo_dir)s to see if it contains any files you wish to
 
1960
    keep, and delete it when you are done."""
 
1961
 
 
1962
    def __init__(self, limbo_dir):
 
1963
       BzrError.__init__(self)
 
1964
       self.limbo_dir = limbo_dir
1641
1965
 
1642
1966
 
1643
1967
class ImmortalPendingDeletion(BzrError):
1644
1968
 
1645
1969
    _fmt = ("Unable to delete transform temporary directory "
1646
 
            "%(pending_deletion)s.  Please examine %(pending_deletion)s to see if it "
1647
 
            "contains any files you wish to keep, and delete it when you are done.")
 
1970
    "%(pending_deletion)s.  Please examine %(pending_deletion)s to see if it "
 
1971
    "contains any files you wish to keep, and delete it when you are done.")
1648
1972
 
1649
1973
    def __init__(self, pending_deletion):
1650
 
        BzrError.__init__(self, pending_deletion=pending_deletion)
 
1974
       BzrError.__init__(self, pending_deletion=pending_deletion)
1651
1975
 
1652
1976
 
1653
1977
class OutOfDateTree(BzrError):
1687
2011
    _fmt = "Format error in conflict listings"
1688
2012
 
1689
2013
 
 
2014
class CorruptDirstate(BzrError):
 
2015
 
 
2016
    _fmt = ("Inconsistency in dirstate file %(dirstate_path)s.\n"
 
2017
            "Error: %(description)s")
 
2018
 
 
2019
    def __init__(self, dirstate_path, description):
 
2020
        BzrError.__init__(self)
 
2021
        self.dirstate_path = dirstate_path
 
2022
        self.description = description
 
2023
 
 
2024
 
1690
2025
class CorruptRepository(BzrError):
1691
2026
 
1692
2027
    _fmt = ("An error has been detected in the repository %(repo_path)s.\n"
1739
2074
class RichRootUpgradeRequired(UpgradeRequired):
1740
2075
 
1741
2076
    _fmt = ("To use this feature you must upgrade your branch at %(path)s to"
1742
 
            " a format which supports rich roots.")
 
2077
           " a format which supports rich roots.")
1743
2078
 
1744
2079
 
1745
2080
class LocalRequiresBoundBranch(BzrError):
1758
2093
        self.tname = type(method_self).__name__
1759
2094
 
1760
2095
 
1761
 
class FetchLimitUnsupported(UnsupportedOperation):
1762
 
 
1763
 
    fmt = ("InterBranch %(interbranch)r does not support fetching limits.")
1764
 
 
1765
 
    def __init__(self, interbranch):
1766
 
        BzrError.__init__(self, interbranch=interbranch)
 
2096
class CannotSetRevisionId(UnsupportedOperation):
 
2097
    """Raised when a commit is attempting to set a revision id but cant."""
1767
2098
 
1768
2099
 
1769
2100
class NonAsciiRevisionId(UnsupportedOperation):
1772
2103
    """
1773
2104
 
1774
2105
 
1775
 
class SharedRepositoriesUnsupported(UnsupportedOperation):
1776
 
    _fmt = "Shared repositories are not supported by %(format)r."
1777
 
 
1778
 
    def __init__(self, format):
1779
 
        BzrError.__init__(self, format=format)
1780
 
 
1781
 
 
1782
2106
class GhostTagsNotSupported(BzrError):
1783
2107
 
1784
2108
    _fmt = "Ghost tags not supported by format %(format)r."
1866
2190
        self.other = other
1867
2191
 
1868
2192
 
 
2193
class BadInventoryFormat(BzrError):
 
2194
 
 
2195
    _fmt = "Root class for inventory serialization errors"
 
2196
 
 
2197
 
 
2198
class UnexpectedInventoryFormat(BadInventoryFormat):
 
2199
 
 
2200
    _fmt = "The inventory was not in the expected format:\n %(msg)s"
 
2201
 
 
2202
    def __init__(self, msg):
 
2203
        BadInventoryFormat.__init__(self, msg=msg)
 
2204
 
 
2205
 
1869
2206
class RootNotRich(BzrError):
1870
2207
 
1871
2208
    _fmt = """This operation requires rich root data storage"""
1914
2251
        self.revision_id = revision_id
1915
2252
 
1916
2253
 
 
2254
class IllegalUseOfScopeReplacer(InternalBzrError):
 
2255
 
 
2256
    _fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
 
2257
            " %(msg)s%(extra)s")
 
2258
 
 
2259
    def __init__(self, name, msg, extra=None):
 
2260
        BzrError.__init__(self)
 
2261
        self.name = name
 
2262
        self.msg = msg
 
2263
        if extra:
 
2264
            self.extra = ': ' + str(extra)
 
2265
        else:
 
2266
            self.extra = ''
 
2267
 
 
2268
 
 
2269
class InvalidImportLine(InternalBzrError):
 
2270
 
 
2271
    _fmt = "Not a valid import statement: %(msg)\n%(text)s"
 
2272
 
 
2273
    def __init__(self, text, msg):
 
2274
        BzrError.__init__(self)
 
2275
        self.text = text
 
2276
        self.msg = msg
 
2277
 
 
2278
 
 
2279
class ImportNameCollision(InternalBzrError):
 
2280
 
 
2281
    _fmt = ("Tried to import an object to the same name as"
 
2282
            " an existing object. %(name)s")
 
2283
 
 
2284
    def __init__(self, name):
 
2285
        BzrError.__init__(self)
 
2286
        self.name = name
 
2287
 
 
2288
 
1917
2289
class NotAMergeDirective(BzrError):
1918
2290
    """File starting with %(firstline)r is not a merge directive"""
1919
 
 
1920
2291
    def __init__(self, firstline):
1921
2292
        BzrError.__init__(self, firstline=firstline)
1922
2293
 
1928
2299
        " branch location."
1929
2300
 
1930
2301
 
 
2302
class IllegalMergeDirectivePayload(BzrError):
 
2303
    """A merge directive contained something other than a patch or bundle"""
 
2304
 
 
2305
    _fmt = "Bad merge directive payload %(start)r"
 
2306
 
 
2307
    def __init__(self, start):
 
2308
        BzrError(self)
 
2309
        self.start = start
 
2310
 
 
2311
 
1931
2312
class PatchVerificationFailed(BzrError):
1932
2313
    """A patch from a merge directive could not be verified"""
1933
2314
 
1957
2338
        self.location = location
1958
2339
 
1959
2340
 
 
2341
class UnsupportedInventoryKind(BzrError):
 
2342
 
 
2343
    _fmt = """Unsupported entry kind %(kind)s"""
 
2344
 
 
2345
    def __init__(self, kind):
 
2346
        self.kind = kind
 
2347
 
 
2348
 
1960
2349
class BadSubsumeSource(BzrError):
1961
2350
 
1962
2351
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
1975
2364
        self.other_tree = other_tree
1976
2365
 
1977
2366
 
 
2367
class BadReferenceTarget(InternalBzrError):
 
2368
 
 
2369
    _fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
 
2370
           "%(reason)s"
 
2371
 
 
2372
    def __init__(self, tree, other_tree, reason):
 
2373
        self.tree = tree
 
2374
        self.other_tree = other_tree
 
2375
        self.reason = reason
 
2376
 
 
2377
 
1978
2378
class NoSuchTag(BzrError):
1979
2379
 
1980
2380
    _fmt = "No such tag: %(tag_name)s"
1986
2386
class TagsNotSupported(BzrError):
1987
2387
 
1988
2388
    _fmt = ("Tags not supported by %(branch)s;"
1989
 
            " you may be able to use 'brz upgrade %(branch_url)s'.")
 
2389
            " you may be able to use brz upgrade.")
1990
2390
 
1991
2391
    def __init__(self, branch):
1992
2392
        self.branch = branch
1993
 
        self.branch_url = branch.user_url
1994
2393
 
1995
2394
 
1996
2395
class TagAlreadyExists(BzrError):
2104
2503
        self.name = name.decode("utf-8")
2105
2504
 
2106
2505
 
 
2506
class NoDestinationAddress(InternalBzrError):
 
2507
 
 
2508
    _fmt = "Message does not have a destination address."
 
2509
 
 
2510
 
2107
2511
class RepositoryDataStreamError(BzrError):
2108
2512
 
2109
2513
    _fmt = "Corrupt or incompatible data stream: %(reason)s"
2112
2516
        self.reason = reason
2113
2517
 
2114
2518
 
 
2519
class SMTPError(BzrError):
 
2520
 
 
2521
    _fmt = "SMTP error: %(error)s"
 
2522
 
 
2523
    def __init__(self, error):
 
2524
        self.error = error
 
2525
 
 
2526
 
 
2527
class NoMessageSupplied(BzrError):
 
2528
 
 
2529
    _fmt = "No message supplied."
 
2530
 
 
2531
 
 
2532
class NoMailAddressSpecified(BzrError):
 
2533
 
 
2534
    _fmt = "No mail-to address (--mail-to) or output (-o) specified."
 
2535
 
 
2536
 
 
2537
class MailClientNotFound(BzrError):
 
2538
 
 
2539
    _fmt = "Unable to find mail client with the following names:"\
 
2540
        " %(mail_command_list_string)s"
 
2541
 
 
2542
    def __init__(self, mail_command_list):
 
2543
        mail_command_list_string = ', '.join(mail_command_list)
 
2544
        BzrError.__init__(self, mail_command_list=mail_command_list,
 
2545
                          mail_command_list_string=mail_command_list_string)
 
2546
 
 
2547
class SMTPConnectionRefused(SMTPError):
 
2548
 
 
2549
    _fmt = "SMTP connection to %(host)s refused"
 
2550
 
 
2551
    def __init__(self, error, host):
 
2552
        self.error = error
 
2553
        self.host = host
 
2554
 
 
2555
 
 
2556
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
 
2557
 
 
2558
    _fmt = "Please specify smtp_server.  No server at default %(host)s."
 
2559
 
 
2560
 
 
2561
class BzrDirError(BzrError):
 
2562
 
 
2563
    def __init__(self, controldir):
 
2564
        from . import urlutils
 
2565
        display_url = urlutils.unescape_for_display(controldir.user_url,
 
2566
                                                    'ascii')
 
2567
        BzrError.__init__(self, controldir=controldir, display_url=display_url)
 
2568
 
 
2569
 
 
2570
class UnsyncedBranches(BzrDirError):
 
2571
 
 
2572
    _fmt = ("'%(display_url)s' is not in sync with %(target_url)s.  See"
 
2573
            " brz help sync-for-reconfigure.")
 
2574
 
 
2575
    def __init__(self, controldir, target_branch):
 
2576
        BzrError.__init__(self, controldir)
 
2577
        from . import urlutils
 
2578
        self.target_url = urlutils.unescape_for_display(target_branch.base,
 
2579
                                                        'ascii')
 
2580
 
 
2581
 
 
2582
class AlreadyBranch(BzrDirError):
 
2583
 
 
2584
    _fmt = "'%(display_url)s' is already a branch."
 
2585
 
 
2586
 
 
2587
class AlreadyTree(BzrDirError):
 
2588
 
 
2589
    _fmt = "'%(display_url)s' is already a tree."
 
2590
 
 
2591
 
 
2592
class AlreadyCheckout(BzrDirError):
 
2593
 
 
2594
    _fmt = "'%(display_url)s' is already a checkout."
 
2595
 
 
2596
 
 
2597
class AlreadyLightweightCheckout(BzrDirError):
 
2598
 
 
2599
    _fmt = "'%(display_url)s' is already a lightweight checkout."
 
2600
 
 
2601
 
 
2602
class AlreadyUsingShared(BzrDirError):
 
2603
 
 
2604
    _fmt = "'%(display_url)s' is already using a shared repository."
 
2605
 
 
2606
 
 
2607
class AlreadyStandalone(BzrDirError):
 
2608
 
 
2609
    _fmt = "'%(display_url)s' is already standalone."
 
2610
 
 
2611
 
 
2612
class AlreadyWithTrees(BzrDirError):
 
2613
 
 
2614
    _fmt = ("Shared repository '%(display_url)s' already creates "
 
2615
            "working trees.")
 
2616
 
 
2617
 
 
2618
class AlreadyWithNoTrees(BzrDirError):
 
2619
 
 
2620
    _fmt = ("Shared repository '%(display_url)s' already doesn't create "
 
2621
            "working trees.")
 
2622
 
 
2623
 
 
2624
class ReconfigurationNotSupported(BzrDirError):
 
2625
 
 
2626
    _fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
 
2627
 
 
2628
 
 
2629
class NoBindLocation(BzrDirError):
 
2630
 
 
2631
    _fmt = "No location could be found to bind to at %(display_url)s."
 
2632
 
 
2633
 
2115
2634
class UncommittedChanges(BzrError):
2116
2635
 
2117
2636
    _fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2152
2671
            ' (See brz shelve --list).%(more)s')
2153
2672
 
2154
2673
 
 
2674
class MissingTemplateVariable(BzrError):
 
2675
 
 
2676
    _fmt = 'Variable {%(name)s} is not available.'
 
2677
 
 
2678
    def __init__(self, name):
 
2679
        self.name = name
 
2680
 
 
2681
 
 
2682
class NoTemplate(BzrError):
 
2683
 
 
2684
    _fmt = 'No template specified.'
 
2685
 
 
2686
 
 
2687
class UnableCreateSymlink(BzrError):
 
2688
 
 
2689
    _fmt = 'Unable to create symlink %(path_str)son this platform'
 
2690
 
 
2691
    def __init__(self, path=None):
 
2692
        path_str = ''
 
2693
        if path:
 
2694
            try:
 
2695
                path_str = repr(str(path))
 
2696
            except UnicodeEncodeError:
 
2697
                path_str = repr(path)
 
2698
            path_str += ' '
 
2699
        self.path_str = path_str
 
2700
 
 
2701
 
 
2702
class UnsupportedTimezoneFormat(BzrError):
 
2703
 
 
2704
    _fmt = ('Unsupported timezone format "%(timezone)s", '
 
2705
            'options are "utc", "original", "local".')
 
2706
 
 
2707
    def __init__(self, timezone):
 
2708
        self.timezone = timezone
 
2709
 
 
2710
 
 
2711
class CommandAvailableInPlugin(Exception):
 
2712
 
 
2713
    internal_error = False
 
2714
 
 
2715
    def __init__(self, cmd_name, plugin_metadata, provider):
 
2716
 
 
2717
        self.plugin_metadata = plugin_metadata
 
2718
        self.cmd_name = cmd_name
 
2719
        self.provider = provider
 
2720
 
 
2721
    def __str__(self):
 
2722
 
 
2723
        _fmt = ('"%s" is not a standard brz command. \n'
 
2724
                'However, the following official plugin provides this command: %s\n'
 
2725
                'You can install it by going to: %s'
 
2726
                % (self.cmd_name, self.plugin_metadata['name'],
 
2727
                    self.plugin_metadata['url']))
 
2728
 
 
2729
        return _fmt
 
2730
 
 
2731
 
 
2732
class NoPluginAvailable(BzrError):
 
2733
    pass
 
2734
 
 
2735
 
2155
2736
class UnableEncodePath(BzrError):
2156
2737
 
2157
2738
    _fmt = ('Unable to encode %(kind)s path %(path)r in '
2172
2753
        BzrError.__init__(self, alias_name=alias_name)
2173
2754
 
2174
2755
 
 
2756
class DirectoryLookupFailure(BzrError):
 
2757
    """Base type for lookup errors."""
 
2758
 
 
2759
    pass
 
2760
 
 
2761
 
 
2762
class InvalidLocationAlias(DirectoryLookupFailure):
 
2763
 
 
2764
    _fmt = '"%(alias_name)s" is not a valid location alias.'
 
2765
 
 
2766
    def __init__(self, alias_name):
 
2767
        DirectoryLookupFailure.__init__(self, alias_name=alias_name)
 
2768
 
 
2769
 
 
2770
class UnsetLocationAlias(DirectoryLookupFailure):
 
2771
 
 
2772
    _fmt = 'No %(alias_name)s location assigned.'
 
2773
 
 
2774
    def __init__(self, alias_name):
 
2775
        DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
 
2776
 
 
2777
 
2175
2778
class CannotBindAddress(BzrError):
2176
2779
 
2177
2780
    _fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2179
2782
    def __init__(self, host, port, orig_error):
2180
2783
        # nb: in python2.4 socket.error doesn't have a useful repr
2181
2784
        BzrError.__init__(self, host=host, port=port,
2182
 
                          orig_error=repr(orig_error.args))
 
2785
            orig_error=repr(orig_error.args))
 
2786
 
 
2787
 
 
2788
class UnknownRules(BzrError):
 
2789
 
 
2790
    _fmt = ('Unknown rules detected: %(unknowns_str)s.')
 
2791
 
 
2792
    def __init__(self, unknowns):
 
2793
        BzrError.__init__(self, unknowns_str=", ".join(unknowns))
2183
2794
 
2184
2795
 
2185
2796
class TipChangeRejected(BzrError):
2193
2804
        self.msg = msg
2194
2805
 
2195
2806
 
 
2807
class ShelfCorrupt(BzrError):
 
2808
 
 
2809
    _fmt = "Shelf corrupt."
 
2810
 
 
2811
 
 
2812
class DecompressCorruption(BzrError):
 
2813
 
 
2814
    _fmt = "Corruption while decompressing repository file%(orig_error)s"
 
2815
 
 
2816
    def __init__(self, orig_error=None):
 
2817
        if orig_error is not None:
 
2818
            self.orig_error = ", %s" % (orig_error,)
 
2819
        else:
 
2820
            self.orig_error = ""
 
2821
        BzrError.__init__(self)
 
2822
 
 
2823
 
 
2824
class NoSuchShelfId(BzrError):
 
2825
 
 
2826
    _fmt = 'No changes are shelved with id "%(shelf_id)d".'
 
2827
 
 
2828
    def __init__(self, shelf_id):
 
2829
        BzrError.__init__(self, shelf_id=shelf_id)
 
2830
 
 
2831
 
 
2832
class InvalidShelfId(BzrError):
 
2833
 
 
2834
    _fmt = '"%(invalid_id)s" is not a valid shelf id, try a number instead.'
 
2835
 
 
2836
    def __init__(self, invalid_id):
 
2837
        BzrError.__init__(self, invalid_id=invalid_id)
 
2838
 
 
2839
 
2196
2840
class JailBreak(BzrError):
2197
2841
 
2198
2842
    _fmt = "An attempt to access a url outside the server jail was made: '%(url)s'."
2206
2850
    _fmt = 'The user aborted the operation.'
2207
2851
 
2208
2852
 
 
2853
class MustHaveWorkingTree(BzrError):
 
2854
 
 
2855
    _fmt = ("Branching '%(url)s'(%(format)s) must create a working tree.")
 
2856
 
 
2857
    def __init__(self, format, url):
 
2858
        BzrError.__init__(self, format=format, url=url)
 
2859
 
 
2860
 
 
2861
class NoSuchView(BzrError):
 
2862
    """A view does not exist.
 
2863
    """
 
2864
 
 
2865
    _fmt = u"No such view: %(view_name)s."
 
2866
 
 
2867
    def __init__(self, view_name):
 
2868
        self.view_name = view_name
 
2869
 
 
2870
 
 
2871
class ViewsNotSupported(BzrError):
 
2872
    """Views are not supported by a tree format.
 
2873
    """
 
2874
 
 
2875
    _fmt = ("Views are not supported by %(tree)s;"
 
2876
            " use 'brz upgrade' to change your tree to a later format.")
 
2877
 
 
2878
    def __init__(self, tree):
 
2879
        self.tree = tree
 
2880
 
 
2881
 
 
2882
class FileOutsideView(BzrError):
 
2883
 
 
2884
    _fmt = ('Specified file "%(file_name)s" is outside the current view: '
 
2885
            '%(view_str)s')
 
2886
 
 
2887
    def __init__(self, file_name, view_files):
 
2888
        self.file_name = file_name
 
2889
        self.view_str = ", ".join(view_files)
 
2890
 
 
2891
 
2209
2892
class UnresumableWriteGroup(BzrError):
2210
2893
 
2211
2894
    _fmt = ("Repository %(repository)s cannot resume write group "
2264
2947
class RecursiveBind(BzrError):
2265
2948
 
2266
2949
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
2267
 
            'Please use `brz unbind` to fix.')
 
2950
        'Please use `brz unbind` to fix.')
2268
2951
 
2269
2952
    def __init__(self, branch_url):
2270
2953
        self.branch_url = branch_url
2271
2954
 
2272
2955
 
 
2956
class HpssVfsRequestNotAllowed(BzrError):
 
2957
 
 
2958
    _fmt = ("VFS requests over the smart server are not allowed. Encountered: "
 
2959
            "%(method)s, %(arguments)s.")
 
2960
 
 
2961
    def __init__(self, method, arguments):
 
2962
        self.method = method
 
2963
        self.arguments = arguments
 
2964
 
 
2965
 
2273
2966
class UnsupportedKindChange(BzrError):
2274
2967
 
2275
2968
    _fmt = ("Kind change from %(from_kind)s to %(to_kind)s for "
2282
2975
        self.format = format
2283
2976
 
2284
2977
 
2285
 
class ChangesAlreadyStored(CommandError):
 
2978
class FeatureAlreadyRegistered(BzrError):
 
2979
 
 
2980
    _fmt = 'The feature %(feature)s has already been registered.'
 
2981
 
 
2982
    def __init__(self, feature):
 
2983
        self.feature = feature
 
2984
 
 
2985
 
 
2986
class ChangesAlreadyStored(BzrCommandError):
2286
2987
 
2287
2988
    _fmt = ('Cannot store uncommitted changes because this branch already'
2288
2989
            ' stores uncommitted changes.')
2289
 
 
2290
 
 
2291
 
class RevnoOutOfBounds(InternalBzrError):
2292
 
 
2293
 
    _fmt = ("The requested revision number %(revno)d is outside of the "
2294
 
            "expected boundaries (%(minimum)d <= %(maximum)d).")
2295
 
 
2296
 
    def __init__(self, revno, bounds):
2297
 
        InternalBzrError.__init__(
2298
 
            self, revno=revno, minimum=bounds[0], maximum=bounds[1])