/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: 2018-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

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__:
171
182
        self.transport = transport
172
183
 
173
184
 
 
185
class InvalidEntryName(InternalBzrError):
 
186
 
 
187
    _fmt = "Invalid entry name: %(name)s"
 
188
 
 
189
    def __init__(self, name):
 
190
        BzrError.__init__(self)
 
191
        self.name = name
 
192
 
 
193
 
174
194
class InvalidRevisionNumber(BzrError):
175
195
 
176
196
    _fmt = "Invalid revision number %(revno)s"
202
222
class RootMissing(InternalBzrError):
203
223
 
204
224
    _fmt = ("The root entry of a tree must be the first entry supplied to "
205
 
            "the commit builder.")
 
225
        "the commit builder.")
206
226
 
207
227
 
208
228
class NoPublicBranch(BzrError):
225
245
        self.tree = tree
226
246
 
227
247
 
 
248
class NoSuchIdInRepository(NoSuchId):
 
249
 
 
250
    _fmt = ('The file id "%(file_id)s" is not present in the repository'
 
251
            ' %(repository)r')
 
252
 
 
253
    def __init__(self, repository, file_id):
 
254
        BzrError.__init__(self, repository=repository, file_id=file_id)
 
255
 
 
256
 
228
257
class NotStacked(BranchError):
229
258
 
230
259
    _fmt = "The branch '%(branch)s' is not stacked."
231
260
 
232
261
 
 
262
class InventoryModified(InternalBzrError):
 
263
 
 
264
    _fmt = ("The current inventory for the tree %(tree)r has been modified,"
 
265
            " so a clean inventory cannot be read without data loss.")
 
266
 
 
267
    def __init__(self, tree):
 
268
        self.tree = tree
 
269
 
 
270
 
233
271
class NoWorkingTree(BzrError):
234
272
 
235
273
    _fmt = 'No WorkingTree exists for "%(base)s".'
255
293
        self.base = base
256
294
 
257
295
 
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):
 
296
class BzrCommandError(BzrError):
266
297
    """Error from user command"""
267
298
 
268
299
    # Error from malformed user command; please avoid raising this as a
270
301
    #
271
302
    # I think it's a waste of effort to differentiate between errors that
272
303
    # 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
 
304
    # BzrCommandError, and non-UI code should not throw a subclass of
 
305
    # BzrCommandError.  ADHB 20051211
279
306
 
280
307
 
281
308
class NotWriteLocked(BzrError):
377
404
    _fmt = 'Permission denied: "%(path)s"%(extra)s'
378
405
 
379
406
 
 
407
class UnavailableRepresentation(InternalBzrError):
 
408
 
 
409
    _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
 
410
        "is encoded as '%(native)s'.")
 
411
 
 
412
    def __init__(self, key, wanted, native):
 
413
        InternalBzrError.__init__(self)
 
414
        self.wanted = wanted
 
415
        self.native = native
 
416
        self.key = key
 
417
 
 
418
 
380
419
class UnsupportedProtocol(PathError):
381
420
 
382
421
    _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s'
398
437
class UnstackableRepositoryFormat(BzrError):
399
438
 
400
439
    _fmt = ("The repository '%(url)s'(%(format)s) is not a stackable format. "
401
 
            "You will need to upgrade the repository to permit branch stacking.")
 
440
        "You will need to upgrade the repository to permit branch stacking.")
402
441
 
403
442
    def __init__(self, format, url):
404
443
        BzrError.__init__(self)
454
493
    _fmt = 'Not a branch: "%(path)s"%(detail)s.'
455
494
 
456
495
    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)
 
496
       from . import urlutils
 
497
       path = urlutils.unescape_for_display(path, 'ascii')
 
498
       if detail is not None:
 
499
           detail = ': ' + detail
 
500
       self.detail = detail
 
501
       self.controldir = controldir
 
502
       PathError.__init__(self, path=path)
464
503
 
465
504
    def __repr__(self):
466
505
        return '<%s %r>' % (self.__class__.__name__, self.__dict__)
468
507
    def _get_format_string(self):
469
508
        # GZ 2017-06-08: Not the best place to lazy fill detail in.
470
509
        if self.detail is None:
471
 
            self.detail = self._get_detail()
 
510
           self.detail = self._get_detail()
472
511
        return super(NotBranchError, self)._get_format_string()
473
512
 
474
513
    def _get_detail(self):
496
535
    _fmt = 'No submit branch available for branch "%(path)s"'
497
536
 
498
537
    def __init__(self, branch):
499
 
        from . import urlutils
500
 
        self.path = urlutils.unescape_for_display(branch.base, 'ascii')
 
538
       from . import urlutils
 
539
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
501
540
 
502
541
 
503
542
class AlreadyControlDirError(PathError):
530
569
(use brz checkout if you wish to build a working tree): "%(path)s"'
531
570
 
532
571
 
 
572
class AtomicFileAlreadyClosed(PathError):
 
573
 
 
574
    _fmt = ('"%(function)s" called on an AtomicFile after it was closed:'
 
575
            ' "%(path)s"')
 
576
 
 
577
    def __init__(self, path, function):
 
578
        PathError.__init__(self, path=path, extra=None)
 
579
        self.function = function
 
580
 
 
581
 
533
582
class InaccessibleParent(PathError):
534
583
 
535
584
    _fmt = ('Parent not accessible given base "%(base)s" and'
543
592
class NoRepositoryPresent(BzrError):
544
593
 
545
594
    _fmt = 'No repository present: "%(path)s"'
546
 
 
547
595
    def __init__(self, controldir):
548
596
        BzrError.__init__(self)
549
597
        self.path = controldir.transport.clone('..').base
594
642
    """
595
643
 
596
644
    _fmt = "%(target)s\n" \
597
 
        "is not compatible with\n" \
598
 
        "%(source)s\n" \
599
 
        "%(details)s"
 
645
            "is not compatible with\n" \
 
646
            "%(source)s\n" \
 
647
            "%(details)s"
600
648
 
601
649
    def __init__(self, source, target, details=None):
602
650
        if details is None:
930
978
        self.revision_id = revision_id
931
979
 
932
980
 
 
981
class InvalidRevisionSpec(BzrError):
 
982
 
 
983
    _fmt = ("Requested revision: '%(spec)s' does not exist in branch:"
 
984
            " %(branch_url)s%(extra)s")
 
985
 
 
986
    def __init__(self, spec, branch, extra=None):
 
987
        BzrError.__init__(self, branch=branch, spec=spec)
 
988
        self.branch_url = getattr(branch, 'user_url', str(branch))
 
989
        if extra:
 
990
            self.extra = '\n' + str(extra)
 
991
        else:
 
992
            self.extra = ''
 
993
 
 
994
 
933
995
class AppendRevisionsOnlyViolation(BzrError):
934
996
 
935
997
    _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".')
 
998
           ' which is not permitted by the append_revisions_only setting on'
 
999
           ' branch "%(location)s".')
938
1000
 
939
1001
    def __init__(self, location):
940
 
        import breezy.urlutils as urlutils
941
 
        location = urlutils.unescape_for_display(location, 'ascii')
942
 
        BzrError.__init__(self, location=location)
 
1002
       import breezy.urlutils as urlutils
 
1003
       location = urlutils.unescape_for_display(location, 'ascii')
 
1004
       BzrError.__init__(self, location=location)
943
1005
 
944
1006
 
945
1007
class DivergedBranches(BzrError):
985
1047
class NoCommonRoot(BzrError):
986
1048
 
987
1049
    _fmt = ("Revisions are not derived from the same root: "
988
 
            "%(revision_a)s %(revision_b)s.")
 
1050
           "%(revision_a)s %(revision_b)s.")
989
1051
 
990
1052
    def __init__(self, revision_a, revision_b):
991
1053
        BzrError.__init__(self, revision_a=revision_a, revision_b=revision_b)
997
1059
 
998
1060
    def __init__(self, rev_id, not_ancestor_id):
999
1061
        BzrError.__init__(self, rev_id=rev_id,
1000
 
                          not_ancestor_id=not_ancestor_id)
 
1062
            not_ancestor_id=not_ancestor_id)
1001
1063
 
1002
1064
 
1003
1065
class NoCommits(BranchError):
1011
1073
        BzrError.__init__(self, "Store %s is not listable" % store)
1012
1074
 
1013
1075
 
 
1076
 
1014
1077
class UnlistableBranch(BzrError):
1015
1078
 
1016
1079
    def __init__(self, br):
1158
1221
        if orig_error is None:
1159
1222
            orig_error = ''
1160
1223
        if msg is None:
1161
 
            msg = ''
 
1224
            msg =  ''
1162
1225
        self.msg = msg
1163
1226
        self.orig_error = orig_error
1164
1227
        BzrError.__init__(self)
1209
1272
        self.exc_type, self.exc_value, self.exc_tb = exc_info
1210
1273
        self.exc_info = exc_info
1211
1274
        traceback_strings = traceback.format_exception(
1212
 
            self.exc_type, self.exc_value, self.exc_tb)
 
1275
                self.exc_type, self.exc_value, self.exc_tb)
1213
1276
        self.traceback_text = ''.join(traceback_strings)
1214
1277
 
1215
1278
 
1280
1343
        TransportError.__init__(self, msg, orig_error=orig_error)
1281
1344
 
1282
1345
 
1283
 
class UnexpectedHttpStatus(InvalidHttpResponse):
1284
 
 
1285
 
    _fmt = "Unexpected HTTP status %(code)d for %(path)s"
1286
 
 
1287
 
    def __init__(self, path, code, msg=None):
1288
 
        self.path = path
1289
 
        self.code = code
1290
 
        self.msg = msg
1291
 
        full_msg = 'status code %d unexpected' % code
1292
 
        if msg is not None:
1293
 
            full_msg += ': ' + msg
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
1346
class InvalidHttpRange(InvalidHttpResponse):
1309
1347
 
1310
1348
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
1378
1416
        BzrError.__init__(self, basedir=tree.basedir)
1379
1417
 
1380
1418
 
 
1419
class CantReprocessAndShowBase(BzrError):
 
1420
 
 
1421
    _fmt = ("Can't reprocess and show base, because reprocessing obscures "
 
1422
           "the relationship of conflicting lines to the base")
 
1423
 
 
1424
 
1381
1425
class GraphCycleError(BzrError):
1382
1426
 
1383
1427
    _fmt = "Cycle in graph %(graph)r"
1460
1504
        self.file_id = file_id
1461
1505
 
1462
1506
 
 
1507
class DuplicateFileId(BzrError):
 
1508
 
 
1509
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
 
1510
 
 
1511
    def __init__(self, file_id, entry):
 
1512
        BzrError.__init__(self)
 
1513
        self.file_id = file_id
 
1514
        self.entry = entry
 
1515
 
 
1516
 
1463
1517
class DuplicateKey(BzrError):
1464
1518
 
1465
1519
    _fmt = "Key %(key)s is already present in map"
1473
1527
        self.prefix = prefix
1474
1528
 
1475
1529
 
 
1530
class MalformedTransform(InternalBzrError):
 
1531
 
 
1532
    _fmt = "Tree transform is malformed %(conflicts)r"
 
1533
 
 
1534
 
 
1535
class NoFinalPath(BzrError):
 
1536
 
 
1537
    _fmt = ("No final name for trans_id %(trans_id)r\n"
 
1538
            "file-id: %(file_id)r\n"
 
1539
            "root trans-id: %(root_trans_id)r\n")
 
1540
 
 
1541
    def __init__(self, trans_id, transform):
 
1542
        self.trans_id = trans_id
 
1543
        self.file_id = transform.final_file_id(trans_id)
 
1544
        self.root_trans_id = transform.root
 
1545
 
 
1546
 
1476
1547
class BzrBadParameter(InternalBzrError):
1477
1548
 
1478
1549
    _fmt = "Bad parameter: %(param)r"
1490
1561
    _fmt = "Parameter %(param)s is neither unicode nor utf8."
1491
1562
 
1492
1563
 
 
1564
class ReusingTransform(BzrError):
 
1565
 
 
1566
    _fmt = "Attempt to reuse a transform that has already been applied."
 
1567
 
 
1568
 
 
1569
class CantMoveRoot(BzrError):
 
1570
 
 
1571
    _fmt = "Moving the root directory is not supported at this time"
 
1572
 
 
1573
 
 
1574
class TransformRenameFailed(BzrError):
 
1575
 
 
1576
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
 
1577
 
 
1578
    def __init__(self, from_path, to_path, why, errno):
 
1579
        self.from_path = from_path
 
1580
        self.to_path = to_path
 
1581
        self.why = why
 
1582
        self.errno = errno
 
1583
 
 
1584
 
1493
1585
class BzrMoveFailedError(BzrError):
1494
1586
 
1495
1587
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1496
 
            "%(_has_extra)s%(extra)s")
 
1588
        "%(_has_extra)s%(extra)s")
1497
1589
 
1498
1590
    def __init__(self, from_path='', to_path='', extra=None):
1499
1591
        from breezy.osutils import splitpath
1529
1621
class BzrRenameFailedError(BzrMoveFailedError):
1530
1622
 
1531
1623
    _fmt = ("Could not rename %(from_path)s%(operator)s %(to_path)s"
1532
 
            "%(_has_extra)s%(extra)s")
 
1624
        "%(_has_extra)s%(extra)s")
1533
1625
 
1534
1626
    def __init__(self, from_path, to_path, extra=None):
1535
1627
        BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1581
1673
class BadConversionTarget(BzrError):
1582
1674
 
1583
1675
    _fmt = "Cannot convert from format %(from_format)s to format %(format)s." \
1584
 
        "    %(problem)s"
 
1676
            "    %(problem)s"
1585
1677
 
1586
1678
    def __init__(self, problem, format, from_format=None):
1587
1679
        BzrError.__init__(self)
1619
1711
    _fmt = "Diff3 is not installed on this machine."
1620
1712
 
1621
1713
 
 
1714
class ExistingContent(BzrError):
 
1715
    # Added in breezy 0.92, used by VersionedFile.add_lines.
 
1716
 
 
1717
    _fmt = "The content being inserted is already present."
 
1718
 
 
1719
 
1622
1720
class ExistingLimbo(BzrError):
1623
1721
 
1624
1722
    _fmt = """This tree contains left-over files from a failed operation.
1626
1724
    keep, and delete it when you are done."""
1627
1725
 
1628
1726
    def __init__(self, limbo_dir):
1629
 
        BzrError.__init__(self)
1630
 
        self.limbo_dir = limbo_dir
 
1727
       BzrError.__init__(self)
 
1728
       self.limbo_dir = limbo_dir
1631
1729
 
1632
1730
 
1633
1731
class ExistingPendingDeletion(BzrError):
1637
1735
    wish to keep, and delete it when you are done."""
1638
1736
 
1639
1737
    def __init__(self, pending_deletion):
1640
 
        BzrError.__init__(self, pending_deletion=pending_deletion)
 
1738
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1739
 
 
1740
 
 
1741
class ImmortalLimbo(BzrError):
 
1742
 
 
1743
    _fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
 
1744
    Please examine %(limbo_dir)s to see if it contains any files you wish to
 
1745
    keep, and delete it when you are done."""
 
1746
 
 
1747
    def __init__(self, limbo_dir):
 
1748
       BzrError.__init__(self)
 
1749
       self.limbo_dir = limbo_dir
1641
1750
 
1642
1751
 
1643
1752
class ImmortalPendingDeletion(BzrError):
1644
1753
 
1645
1754
    _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.")
 
1755
    "%(pending_deletion)s.  Please examine %(pending_deletion)s to see if it "
 
1756
    "contains any files you wish to keep, and delete it when you are done.")
1648
1757
 
1649
1758
    def __init__(self, pending_deletion):
1650
 
        BzrError.__init__(self, pending_deletion=pending_deletion)
 
1759
       BzrError.__init__(self, pending_deletion=pending_deletion)
1651
1760
 
1652
1761
 
1653
1762
class OutOfDateTree(BzrError):
1739
1848
class RichRootUpgradeRequired(UpgradeRequired):
1740
1849
 
1741
1850
    _fmt = ("To use this feature you must upgrade your branch at %(path)s to"
1742
 
            " a format which supports rich roots.")
 
1851
           " a format which supports rich roots.")
1743
1852
 
1744
1853
 
1745
1854
class LocalRequiresBoundBranch(BzrError):
1758
1867
        self.tname = type(method_self).__name__
1759
1868
 
1760
1869
 
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)
1767
 
 
1768
 
 
1769
1870
class NonAsciiRevisionId(UnsupportedOperation):
1770
1871
    """Raised when a commit is attempting to set a non-ascii revision id
1771
1872
       but cant.
1772
1873
    """
1773
1874
 
1774
1875
 
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
1876
class GhostTagsNotSupported(BzrError):
1783
1877
 
1784
1878
    _fmt = "Ghost tags not supported by format %(format)r."
1866
1960
        self.other = other
1867
1961
 
1868
1962
 
 
1963
class BadInventoryFormat(BzrError):
 
1964
 
 
1965
    _fmt = "Root class for inventory serialization errors"
 
1966
 
 
1967
 
 
1968
class UnexpectedInventoryFormat(BadInventoryFormat):
 
1969
 
 
1970
    _fmt = "The inventory was not in the expected format:\n %(msg)s"
 
1971
 
 
1972
    def __init__(self, msg):
 
1973
        BadInventoryFormat.__init__(self, msg=msg)
 
1974
 
 
1975
 
1869
1976
class RootNotRich(BzrError):
1870
1977
 
1871
1978
    _fmt = """This operation requires rich root data storage"""
1914
2021
        self.revision_id = revision_id
1915
2022
 
1916
2023
 
 
2024
class IllegalUseOfScopeReplacer(InternalBzrError):
 
2025
 
 
2026
    _fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
 
2027
            " %(msg)s%(extra)s")
 
2028
 
 
2029
    def __init__(self, name, msg, extra=None):
 
2030
        BzrError.__init__(self)
 
2031
        self.name = name
 
2032
        self.msg = msg
 
2033
        if extra:
 
2034
            self.extra = ': ' + str(extra)
 
2035
        else:
 
2036
            self.extra = ''
 
2037
 
 
2038
 
 
2039
class InvalidImportLine(InternalBzrError):
 
2040
 
 
2041
    _fmt = "Not a valid import statement: %(msg)\n%(text)s"
 
2042
 
 
2043
    def __init__(self, text, msg):
 
2044
        BzrError.__init__(self)
 
2045
        self.text = text
 
2046
        self.msg = msg
 
2047
 
 
2048
 
 
2049
class ImportNameCollision(InternalBzrError):
 
2050
 
 
2051
    _fmt = ("Tried to import an object to the same name as"
 
2052
            " an existing object. %(name)s")
 
2053
 
 
2054
    def __init__(self, name):
 
2055
        BzrError.__init__(self)
 
2056
        self.name = name
 
2057
 
 
2058
 
1917
2059
class NotAMergeDirective(BzrError):
1918
2060
    """File starting with %(firstline)r is not a merge directive"""
1919
 
 
1920
2061
    def __init__(self, firstline):
1921
2062
        BzrError.__init__(self, firstline=firstline)
1922
2063
 
1928
2069
        " branch location."
1929
2070
 
1930
2071
 
 
2072
class IllegalMergeDirectivePayload(BzrError):
 
2073
    """A merge directive contained something other than a patch or bundle"""
 
2074
 
 
2075
    _fmt = "Bad merge directive payload %(start)r"
 
2076
 
 
2077
    def __init__(self, start):
 
2078
        BzrError(self)
 
2079
        self.start = start
 
2080
 
 
2081
 
1931
2082
class PatchVerificationFailed(BzrError):
1932
2083
    """A patch from a merge directive could not be verified"""
1933
2084
 
1957
2108
        self.location = location
1958
2109
 
1959
2110
 
 
2111
class UnsupportedInventoryKind(BzrError):
 
2112
 
 
2113
    _fmt = """Unsupported entry kind %(kind)s"""
 
2114
 
 
2115
    def __init__(self, kind):
 
2116
        self.kind = kind
 
2117
 
 
2118
 
1960
2119
class BadSubsumeSource(BzrError):
1961
2120
 
1962
2121
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
1986
2145
class TagsNotSupported(BzrError):
1987
2146
 
1988
2147
    _fmt = ("Tags not supported by %(branch)s;"
1989
 
            " you may be able to use 'brz upgrade %(branch_url)s'.")
 
2148
            " you may be able to use brz upgrade.")
1990
2149
 
1991
2150
    def __init__(self, branch):
1992
2151
        self.branch = branch
1993
 
        self.branch_url = branch.user_url
1994
2152
 
1995
2153
 
1996
2154
class TagAlreadyExists(BzrError):
2152
2310
            ' (See brz shelve --list).%(more)s')
2153
2311
 
2154
2312
 
 
2313
class UnableCreateSymlink(BzrError):
 
2314
 
 
2315
    _fmt = 'Unable to create symlink %(path_str)son this platform'
 
2316
 
 
2317
    def __init__(self, path=None):
 
2318
        path_str = ''
 
2319
        if path:
 
2320
            try:
 
2321
                path_str = repr(str(path))
 
2322
            except UnicodeEncodeError:
 
2323
                path_str = repr(path)
 
2324
            path_str += ' '
 
2325
        self.path_str = path_str
 
2326
 
 
2327
 
2155
2328
class UnableEncodePath(BzrError):
2156
2329
 
2157
2330
    _fmt = ('Unable to encode %(kind)s path %(path)r in '
2179
2352
    def __init__(self, host, port, orig_error):
2180
2353
        # nb: in python2.4 socket.error doesn't have a useful repr
2181
2354
        BzrError.__init__(self, host=host, port=port,
2182
 
                          orig_error=repr(orig_error.args))
 
2355
            orig_error=repr(orig_error.args))
2183
2356
 
2184
2357
 
2185
2358
class TipChangeRejected(BzrError):
2264
2437
class RecursiveBind(BzrError):
2265
2438
 
2266
2439
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
2267
 
            'Please use `brz unbind` to fix.')
 
2440
        'Please use `brz unbind` to fix.')
2268
2441
 
2269
2442
    def __init__(self, branch_url):
2270
2443
        self.branch_url = branch_url
2282
2455
        self.format = format
2283
2456
 
2284
2457
 
2285
 
class ChangesAlreadyStored(CommandError):
 
2458
class ChangesAlreadyStored(BzrCommandError):
2286
2459
 
2287
2460
    _fmt = ('Cannot store uncommitted changes because this branch already'
2288
2461
            ' 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])