/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-06-14 17:59:16 UTC
  • mto: This revision was merged to the branch mainline in revision 7065.
  • Revision ID: jelmer@jelmer.uk-20180614175916-a2e2xh5k533guq1x
Move breezy.plugins.git to breezy.git.

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):
230
250
    _fmt = "The branch '%(branch)s' is not stacked."
231
251
 
232
252
 
 
253
class InventoryModified(InternalBzrError):
 
254
 
 
255
    _fmt = ("The current inventory for the tree %(tree)r has been modified,"
 
256
            " so a clean inventory cannot be read without data loss.")
 
257
 
 
258
    def __init__(self, tree):
 
259
        self.tree = tree
 
260
 
 
261
 
233
262
class NoWorkingTree(BzrError):
234
263
 
235
264
    _fmt = 'No WorkingTree exists for "%(base)s".'
255
284
        self.base = base
256
285
 
257
286
 
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):
 
287
class BzrCommandError(BzrError):
266
288
    """Error from user command"""
267
289
 
268
290
    # Error from malformed user command; please avoid raising this as a
270
292
    #
271
293
    # I think it's a waste of effort to differentiate between errors that
272
294
    # 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
 
295
    # BzrCommandError, and non-UI code should not throw a subclass of
 
296
    # BzrCommandError.  ADHB 20051211
279
297
 
280
298
 
281
299
class NotWriteLocked(BzrError):
377
395
    _fmt = 'Permission denied: "%(path)s"%(extra)s'
378
396
 
379
397
 
 
398
class UnavailableRepresentation(InternalBzrError):
 
399
 
 
400
    _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
 
401
        "is encoded as '%(native)s'.")
 
402
 
 
403
    def __init__(self, key, wanted, native):
 
404
        InternalBzrError.__init__(self)
 
405
        self.wanted = wanted
 
406
        self.native = native
 
407
        self.key = key
 
408
 
 
409
 
380
410
class UnsupportedProtocol(PathError):
381
411
 
382
412
    _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s'
398
428
class UnstackableRepositoryFormat(BzrError):
399
429
 
400
430
    _fmt = ("The repository '%(url)s'(%(format)s) is not a stackable format. "
401
 
            "You will need to upgrade the repository to permit branch stacking.")
 
431
        "You will need to upgrade the repository to permit branch stacking.")
402
432
 
403
433
    def __init__(self, format, url):
404
434
        BzrError.__init__(self)
454
484
    _fmt = 'Not a branch: "%(path)s"%(detail)s.'
455
485
 
456
486
    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)
 
487
       from . import urlutils
 
488
       path = urlutils.unescape_for_display(path, 'ascii')
 
489
       if detail is not None:
 
490
           detail = ': ' + detail
 
491
       self.detail = detail
 
492
       self.controldir = controldir
 
493
       PathError.__init__(self, path=path)
464
494
 
465
495
    def __repr__(self):
466
496
        return '<%s %r>' % (self.__class__.__name__, self.__dict__)
468
498
    def _get_format_string(self):
469
499
        # GZ 2017-06-08: Not the best place to lazy fill detail in.
470
500
        if self.detail is None:
471
 
            self.detail = self._get_detail()
 
501
           self.detail = self._get_detail()
472
502
        return super(NotBranchError, self)._get_format_string()
473
503
 
474
504
    def _get_detail(self):
496
526
    _fmt = 'No submit branch available for branch "%(path)s"'
497
527
 
498
528
    def __init__(self, branch):
499
 
        from . import urlutils
500
 
        self.path = urlutils.unescape_for_display(branch.base, 'ascii')
 
529
       from . import urlutils
 
530
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
501
531
 
502
532
 
503
533
class AlreadyControlDirError(PathError):
530
560
(use brz checkout if you wish to build a working tree): "%(path)s"'
531
561
 
532
562
 
 
563
class AtomicFileAlreadyClosed(PathError):
 
564
 
 
565
    _fmt = ('"%(function)s" called on an AtomicFile after it was closed:'
 
566
            ' "%(path)s"')
 
567
 
 
568
    def __init__(self, path, function):
 
569
        PathError.__init__(self, path=path, extra=None)
 
570
        self.function = function
 
571
 
 
572
 
533
573
class InaccessibleParent(PathError):
534
574
 
535
575
    _fmt = ('Parent not accessible given base "%(base)s" and'
543
583
class NoRepositoryPresent(BzrError):
544
584
 
545
585
    _fmt = 'No repository present: "%(path)s"'
546
 
 
547
586
    def __init__(self, controldir):
548
587
        BzrError.__init__(self)
549
588
        self.path = controldir.transport.clone('..').base
594
633
    """
595
634
 
596
635
    _fmt = "%(target)s\n" \
597
 
        "is not compatible with\n" \
598
 
        "%(source)s\n" \
599
 
        "%(details)s"
 
636
            "is not compatible with\n" \
 
637
            "%(source)s\n" \
 
638
            "%(details)s"
600
639
 
601
640
    def __init__(self, source, target, details=None):
602
641
        if details is None:
930
969
        self.revision_id = revision_id
931
970
 
932
971
 
 
972
class InvalidRevisionSpec(BzrError):
 
973
 
 
974
    _fmt = ("Requested revision: '%(spec)s' does not exist in branch:"
 
975
            " %(branch_url)s%(extra)s")
 
976
 
 
977
    def __init__(self, spec, branch, extra=None):
 
978
        BzrError.__init__(self, branch=branch, spec=spec)
 
979
        self.branch_url = getattr(branch, 'user_url', str(branch))
 
980
        if extra:
 
981
            self.extra = '\n' + str(extra)
 
982
        else:
 
983
            self.extra = ''
 
984
 
 
985
 
933
986
class AppendRevisionsOnlyViolation(BzrError):
934
987
 
935
988
    _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".')
 
989
           ' which is not permitted by the append_revisions_only setting on'
 
990
           ' branch "%(location)s".')
938
991
 
939
992
    def __init__(self, location):
940
 
        import breezy.urlutils as urlutils
941
 
        location = urlutils.unescape_for_display(location, 'ascii')
942
 
        BzrError.__init__(self, location=location)
 
993
       import breezy.urlutils as urlutils
 
994
       location = urlutils.unescape_for_display(location, 'ascii')
 
995
       BzrError.__init__(self, location=location)
943
996
 
944
997
 
945
998
class DivergedBranches(BzrError):
985
1038
class NoCommonRoot(BzrError):
986
1039
 
987
1040
    _fmt = ("Revisions are not derived from the same root: "
988
 
            "%(revision_a)s %(revision_b)s.")
 
1041
           "%(revision_a)s %(revision_b)s.")
989
1042
 
990
1043
    def __init__(self, revision_a, revision_b):
991
1044
        BzrError.__init__(self, revision_a=revision_a, revision_b=revision_b)
997
1050
 
998
1051
    def __init__(self, rev_id, not_ancestor_id):
999
1052
        BzrError.__init__(self, rev_id=rev_id,
1000
 
                          not_ancestor_id=not_ancestor_id)
 
1053
            not_ancestor_id=not_ancestor_id)
1001
1054
 
1002
1055
 
1003
1056
class NoCommits(BranchError):
1011
1064
        BzrError.__init__(self, "Store %s is not listable" % store)
1012
1065
 
1013
1066
 
 
1067
 
1014
1068
class UnlistableBranch(BzrError):
1015
1069
 
1016
1070
    def __init__(self, br):
1158
1212
        if orig_error is None:
1159
1213
            orig_error = ''
1160
1214
        if msg is None:
1161
 
            msg = ''
 
1215
            msg =  ''
1162
1216
        self.msg = msg
1163
1217
        self.orig_error = orig_error
1164
1218
        BzrError.__init__(self)
1209
1263
        self.exc_type, self.exc_value, self.exc_tb = exc_info
1210
1264
        self.exc_info = exc_info
1211
1265
        traceback_strings = traceback.format_exception(
1212
 
            self.exc_type, self.exc_value, self.exc_tb)
 
1266
                self.exc_type, self.exc_value, self.exc_tb)
1213
1267
        self.traceback_text = ''.join(traceback_strings)
1214
1268
 
1215
1269
 
1280
1334
        TransportError.__init__(self, msg, orig_error=orig_error)
1281
1335
 
1282
1336
 
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
1337
class InvalidHttpRange(InvalidHttpResponse):
1309
1338
 
1310
1339
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
1378
1407
        BzrError.__init__(self, basedir=tree.basedir)
1379
1408
 
1380
1409
 
 
1410
class CantReprocessAndShowBase(BzrError):
 
1411
 
 
1412
    _fmt = ("Can't reprocess and show base, because reprocessing obscures "
 
1413
           "the relationship of conflicting lines to the base")
 
1414
 
 
1415
 
1381
1416
class GraphCycleError(BzrError):
1382
1417
 
1383
1418
    _fmt = "Cycle in graph %(graph)r"
1460
1495
        self.file_id = file_id
1461
1496
 
1462
1497
 
 
1498
class DuplicateFileId(BzrError):
 
1499
 
 
1500
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
 
1501
 
 
1502
    def __init__(self, file_id, entry):
 
1503
        BzrError.__init__(self)
 
1504
        self.file_id = file_id
 
1505
        self.entry = entry
 
1506
 
 
1507
 
1463
1508
class DuplicateKey(BzrError):
1464
1509
 
1465
1510
    _fmt = "Key %(key)s is already present in map"
1473
1518
        self.prefix = prefix
1474
1519
 
1475
1520
 
 
1521
class MalformedTransform(InternalBzrError):
 
1522
 
 
1523
    _fmt = "Tree transform is malformed %(conflicts)r"
 
1524
 
 
1525
 
 
1526
class NoFinalPath(BzrError):
 
1527
 
 
1528
    _fmt = ("No final name for trans_id %(trans_id)r\n"
 
1529
            "file-id: %(file_id)r\n"
 
1530
            "root trans-id: %(root_trans_id)r\n")
 
1531
 
 
1532
    def __init__(self, trans_id, transform):
 
1533
        self.trans_id = trans_id
 
1534
        self.file_id = transform.final_file_id(trans_id)
 
1535
        self.root_trans_id = transform.root
 
1536
 
 
1537
 
1476
1538
class BzrBadParameter(InternalBzrError):
1477
1539
 
1478
1540
    _fmt = "Bad parameter: %(param)r"
1490
1552
    _fmt = "Parameter %(param)s is neither unicode nor utf8."
1491
1553
 
1492
1554
 
 
1555
class ReusingTransform(BzrError):
 
1556
 
 
1557
    _fmt = "Attempt to reuse a transform that has already been applied."
 
1558
 
 
1559
 
 
1560
class CantMoveRoot(BzrError):
 
1561
 
 
1562
    _fmt = "Moving the root directory is not supported at this time"
 
1563
 
 
1564
 
 
1565
class TransformRenameFailed(BzrError):
 
1566
 
 
1567
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
 
1568
 
 
1569
    def __init__(self, from_path, to_path, why, errno):
 
1570
        self.from_path = from_path
 
1571
        self.to_path = to_path
 
1572
        self.why = why
 
1573
        self.errno = errno
 
1574
 
 
1575
 
1493
1576
class BzrMoveFailedError(BzrError):
1494
1577
 
1495
1578
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1496
 
            "%(_has_extra)s%(extra)s")
 
1579
        "%(_has_extra)s%(extra)s")
1497
1580
 
1498
1581
    def __init__(self, from_path='', to_path='', extra=None):
1499
1582
        from breezy.osutils import splitpath
1529
1612
class BzrRenameFailedError(BzrMoveFailedError):
1530
1613
 
1531
1614
    _fmt = ("Could not rename %(from_path)s%(operator)s %(to_path)s"
1532
 
            "%(_has_extra)s%(extra)s")
 
1615
        "%(_has_extra)s%(extra)s")
1533
1616
 
1534
1617
    def __init__(self, from_path, to_path, extra=None):
1535
1618
        BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1581
1664
class BadConversionTarget(BzrError):
1582
1665
 
1583
1666
    _fmt = "Cannot convert from format %(from_format)s to format %(format)s." \
1584
 
        "    %(problem)s"
 
1667
            "    %(problem)s"
1585
1668
 
1586
1669
    def __init__(self, problem, format, from_format=None):
1587
1670
        BzrError.__init__(self)
1619
1702
    _fmt = "Diff3 is not installed on this machine."
1620
1703
 
1621
1704
 
 
1705
class ExistingContent(BzrError):
 
1706
    # Added in breezy 0.92, used by VersionedFile.add_lines.
 
1707
 
 
1708
    _fmt = "The content being inserted is already present."
 
1709
 
 
1710
 
1622
1711
class ExistingLimbo(BzrError):
1623
1712
 
1624
1713
    _fmt = """This tree contains left-over files from a failed operation.
1626
1715
    keep, and delete it when you are done."""
1627
1716
 
1628
1717
    def __init__(self, limbo_dir):
1629
 
        BzrError.__init__(self)
1630
 
        self.limbo_dir = limbo_dir
 
1718
       BzrError.__init__(self)
 
1719
       self.limbo_dir = limbo_dir
1631
1720
 
1632
1721
 
1633
1722
class ExistingPendingDeletion(BzrError):
1637
1726
    wish to keep, and delete it when you are done."""
1638
1727
 
1639
1728
    def __init__(self, pending_deletion):
1640
 
        BzrError.__init__(self, pending_deletion=pending_deletion)
 
1729
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1730
 
 
1731
 
 
1732
class ImmortalLimbo(BzrError):
 
1733
 
 
1734
    _fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
 
1735
    Please examine %(limbo_dir)s to see if it contains any files you wish to
 
1736
    keep, and delete it when you are done."""
 
1737
 
 
1738
    def __init__(self, limbo_dir):
 
1739
       BzrError.__init__(self)
 
1740
       self.limbo_dir = limbo_dir
1641
1741
 
1642
1742
 
1643
1743
class ImmortalPendingDeletion(BzrError):
1644
1744
 
1645
1745
    _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.")
 
1746
    "%(pending_deletion)s.  Please examine %(pending_deletion)s to see if it "
 
1747
    "contains any files you wish to keep, and delete it when you are done.")
1648
1748
 
1649
1749
    def __init__(self, pending_deletion):
1650
 
        BzrError.__init__(self, pending_deletion=pending_deletion)
 
1750
       BzrError.__init__(self, pending_deletion=pending_deletion)
1651
1751
 
1652
1752
 
1653
1753
class OutOfDateTree(BzrError):
1739
1839
class RichRootUpgradeRequired(UpgradeRequired):
1740
1840
 
1741
1841
    _fmt = ("To use this feature you must upgrade your branch at %(path)s to"
1742
 
            " a format which supports rich roots.")
 
1842
           " a format which supports rich roots.")
1743
1843
 
1744
1844
 
1745
1845
class LocalRequiresBoundBranch(BzrError):
1772
1872
    """
1773
1873
 
1774
1874
 
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
1875
class GhostTagsNotSupported(BzrError):
1783
1876
 
1784
1877
    _fmt = "Ghost tags not supported by format %(format)r."
1866
1959
        self.other = other
1867
1960
 
1868
1961
 
 
1962
class BadInventoryFormat(BzrError):
 
1963
 
 
1964
    _fmt = "Root class for inventory serialization errors"
 
1965
 
 
1966
 
 
1967
class UnexpectedInventoryFormat(BadInventoryFormat):
 
1968
 
 
1969
    _fmt = "The inventory was not in the expected format:\n %(msg)s"
 
1970
 
 
1971
    def __init__(self, msg):
 
1972
        BadInventoryFormat.__init__(self, msg=msg)
 
1973
 
 
1974
 
1869
1975
class RootNotRich(BzrError):
1870
1976
 
1871
1977
    _fmt = """This operation requires rich root data storage"""
1914
2020
        self.revision_id = revision_id
1915
2021
 
1916
2022
 
 
2023
class IllegalUseOfScopeReplacer(InternalBzrError):
 
2024
 
 
2025
    _fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
 
2026
            " %(msg)s%(extra)s")
 
2027
 
 
2028
    def __init__(self, name, msg, extra=None):
 
2029
        BzrError.__init__(self)
 
2030
        self.name = name
 
2031
        self.msg = msg
 
2032
        if extra:
 
2033
            self.extra = ': ' + str(extra)
 
2034
        else:
 
2035
            self.extra = ''
 
2036
 
 
2037
 
 
2038
class InvalidImportLine(InternalBzrError):
 
2039
 
 
2040
    _fmt = "Not a valid import statement: %(msg)\n%(text)s"
 
2041
 
 
2042
    def __init__(self, text, msg):
 
2043
        BzrError.__init__(self)
 
2044
        self.text = text
 
2045
        self.msg = msg
 
2046
 
 
2047
 
 
2048
class ImportNameCollision(InternalBzrError):
 
2049
 
 
2050
    _fmt = ("Tried to import an object to the same name as"
 
2051
            " an existing object. %(name)s")
 
2052
 
 
2053
    def __init__(self, name):
 
2054
        BzrError.__init__(self)
 
2055
        self.name = name
 
2056
 
 
2057
 
1917
2058
class NotAMergeDirective(BzrError):
1918
2059
    """File starting with %(firstline)r is not a merge directive"""
1919
 
 
1920
2060
    def __init__(self, firstline):
1921
2061
        BzrError.__init__(self, firstline=firstline)
1922
2062
 
1928
2068
        " branch location."
1929
2069
 
1930
2070
 
 
2071
class IllegalMergeDirectivePayload(BzrError):
 
2072
    """A merge directive contained something other than a patch or bundle"""
 
2073
 
 
2074
    _fmt = "Bad merge directive payload %(start)r"
 
2075
 
 
2076
    def __init__(self, start):
 
2077
        BzrError(self)
 
2078
        self.start = start
 
2079
 
 
2080
 
1931
2081
class PatchVerificationFailed(BzrError):
1932
2082
    """A patch from a merge directive could not be verified"""
1933
2083
 
1957
2107
        self.location = location
1958
2108
 
1959
2109
 
 
2110
class UnsupportedInventoryKind(BzrError):
 
2111
 
 
2112
    _fmt = """Unsupported entry kind %(kind)s"""
 
2113
 
 
2114
    def __init__(self, kind):
 
2115
        self.kind = kind
 
2116
 
 
2117
 
1960
2118
class BadSubsumeSource(BzrError):
1961
2119
 
1962
2120
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
1986
2144
class TagsNotSupported(BzrError):
1987
2145
 
1988
2146
    _fmt = ("Tags not supported by %(branch)s;"
1989
 
            " you may be able to use 'brz upgrade %(branch_url)s'.")
 
2147
            " you may be able to use brz upgrade.")
1990
2148
 
1991
2149
    def __init__(self, branch):
1992
2150
        self.branch = branch
1993
 
        self.branch_url = branch.user_url
1994
2151
 
1995
2152
 
1996
2153
class TagAlreadyExists(BzrError):
2152
2309
            ' (See brz shelve --list).%(more)s')
2153
2310
 
2154
2311
 
 
2312
class UnableCreateSymlink(BzrError):
 
2313
 
 
2314
    _fmt = 'Unable to create symlink %(path_str)son this platform'
 
2315
 
 
2316
    def __init__(self, path=None):
 
2317
        path_str = ''
 
2318
        if path:
 
2319
            try:
 
2320
                path_str = repr(str(path))
 
2321
            except UnicodeEncodeError:
 
2322
                path_str = repr(path)
 
2323
            path_str += ' '
 
2324
        self.path_str = path_str
 
2325
 
 
2326
 
2155
2327
class UnableEncodePath(BzrError):
2156
2328
 
2157
2329
    _fmt = ('Unable to encode %(kind)s path %(path)r in '
2179
2351
    def __init__(self, host, port, orig_error):
2180
2352
        # nb: in python2.4 socket.error doesn't have a useful repr
2181
2353
        BzrError.__init__(self, host=host, port=port,
2182
 
                          orig_error=repr(orig_error.args))
 
2354
            orig_error=repr(orig_error.args))
2183
2355
 
2184
2356
 
2185
2357
class TipChangeRejected(BzrError):
2264
2436
class RecursiveBind(BzrError):
2265
2437
 
2266
2438
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
2267
 
            'Please use `brz unbind` to fix.')
 
2439
        'Please use `brz unbind` to fix.')
2268
2440
 
2269
2441
    def __init__(self, branch_url):
2270
2442
        self.branch_url = branch_url
2282
2454
        self.format = format
2283
2455
 
2284
2456
 
2285
 
class ChangesAlreadyStored(CommandError):
 
2457
class ChangesAlreadyStored(BzrCommandError):
2286
2458
 
2287
2459
    _fmt = ('Cannot store uncommitted changes because this branch already'
2288
2460
            ' 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])