/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-07-20 02:17:05 UTC
  • mfrom: (7518.1.2 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200720021705-5f11tmo1hdqjxm6x
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/387628

Show diffs side-by-side

added added

removed removed

Lines of Context:
230
230
    _fmt = "The branch '%(branch)s' is not stacked."
231
231
 
232
232
 
233
 
class InventoryModified(InternalBzrError):
234
 
 
235
 
    _fmt = ("The current inventory for the tree %(tree)r has been modified,"
236
 
            " so a clean inventory cannot be read without data loss.")
237
 
 
238
 
    def __init__(self, tree):
239
 
        self.tree = tree
240
 
 
241
 
 
242
233
class NoWorkingTree(BzrError):
243
234
 
244
235
    _fmt = 'No WorkingTree exists for "%(base)s".'
386
377
    _fmt = 'Permission denied: "%(path)s"%(extra)s'
387
378
 
388
379
 
389
 
class UnavailableRepresentation(InternalBzrError):
390
 
 
391
 
    _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
392
 
            "is encoded as '%(native)s'.")
393
 
 
394
 
    def __init__(self, key, wanted, native):
395
 
        InternalBzrError.__init__(self)
396
 
        self.wanted = wanted
397
 
        self.native = native
398
 
        self.key = key
399
 
 
400
 
 
401
380
class UnsupportedProtocol(PathError):
402
381
 
403
382
    _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s'
1310
1289
        TransportError.__init__(self, msg, orig_error=orig_error)
1311
1290
 
1312
1291
 
 
1292
class UnexpectedHttpStatus(InvalidHttpResponse):
 
1293
 
 
1294
    _fmt = "Unexpected HTTP status %(code)d for %(path)s"
 
1295
 
 
1296
    def __init__(self, path, code, msg=None):
 
1297
        self.path = path
 
1298
        self.code = code
 
1299
        self.msg = msg
 
1300
        full_msg = 'status code %d unexpected' % code
 
1301
        if msg is not None:
 
1302
            full_msg += ': ' + msg
 
1303
        InvalidHttpResponse.__init__(
 
1304
            self, path, full_msg)
 
1305
 
 
1306
 
 
1307
class BadHttpRequest(UnexpectedHttpStatus):
 
1308
 
 
1309
    _fmt = "Bad http request for %(path)s: %(reason)s"
 
1310
 
 
1311
    def __init__(self, path, reason):
 
1312
        self.path = path
 
1313
        self.reason = reason
 
1314
        TransportError.__init__(self, reason)
 
1315
 
 
1316
 
1313
1317
class InvalidHttpRange(InvalidHttpResponse):
1314
1318
 
1315
1319
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
1465
1469
        self.file_id = file_id
1466
1470
 
1467
1471
 
1468
 
class DuplicateFileId(BzrError):
1469
 
 
1470
 
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1471
 
 
1472
 
    def __init__(self, file_id, entry):
1473
 
        BzrError.__init__(self)
1474
 
        self.file_id = file_id
1475
 
        self.entry = entry
1476
 
 
1477
 
 
1478
1472
class DuplicateKey(BzrError):
1479
1473
 
1480
1474
    _fmt = "Key %(key)s is already present in map"
1488
1482
        self.prefix = prefix
1489
1483
 
1490
1484
 
1491
 
class MalformedTransform(InternalBzrError):
1492
 
 
1493
 
    _fmt = "Tree transform is malformed %(conflicts)r"
1494
 
 
1495
 
 
1496
 
class NoFinalPath(BzrError):
1497
 
 
1498
 
    _fmt = ("No final name for trans_id %(trans_id)r\n"
1499
 
            "file-id: %(file_id)r\n"
1500
 
            "root trans-id: %(root_trans_id)r\n")
1501
 
 
1502
 
    def __init__(self, trans_id, transform):
1503
 
        self.trans_id = trans_id
1504
 
        self.file_id = transform.final_file_id(trans_id)
1505
 
        self.root_trans_id = transform.root
1506
 
 
1507
 
 
1508
1485
class BzrBadParameter(InternalBzrError):
1509
1486
 
1510
1487
    _fmt = "Bad parameter: %(param)r"
1522
1499
    _fmt = "Parameter %(param)s is neither unicode nor utf8."
1523
1500
 
1524
1501
 
1525
 
class ReusingTransform(BzrError):
1526
 
 
1527
 
    _fmt = "Attempt to reuse a transform that has already been applied."
1528
 
 
1529
 
 
1530
 
class CantMoveRoot(BzrError):
1531
 
 
1532
 
    _fmt = "Moving the root directory is not supported at this time"
1533
 
 
1534
 
 
1535
 
class TransformRenameFailed(BzrError):
1536
 
 
1537
 
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
1538
 
 
1539
 
    def __init__(self, from_path, to_path, why, errno):
1540
 
        self.from_path = from_path
1541
 
        self.to_path = to_path
1542
 
        self.why = why
1543
 
        self.errno = errno
1544
 
 
1545
 
 
1546
1502
class BzrMoveFailedError(BzrError):
1547
1503
 
1548
1504
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1672
1628
    _fmt = "Diff3 is not installed on this machine."
1673
1629
 
1674
1630
 
1675
 
class ExistingContent(BzrError):
1676
 
    # Added in breezy 0.92, used by VersionedFile.add_lines.
1677
 
 
1678
 
    _fmt = "The content being inserted is already present."
1679
 
 
1680
 
 
1681
1631
class ExistingLimbo(BzrError):
1682
1632
 
1683
1633
    _fmt = """This tree contains left-over files from a failed operation.
1699
1649
        BzrError.__init__(self, pending_deletion=pending_deletion)
1700
1650
 
1701
1651
 
1702
 
class ImmortalLimbo(BzrError):
1703
 
 
1704
 
    _fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
1705
 
    Please examine %(limbo_dir)s to see if it contains any files you wish to
1706
 
    keep, and delete it when you are done."""
1707
 
 
1708
 
    def __init__(self, limbo_dir):
1709
 
        BzrError.__init__(self)
1710
 
        self.limbo_dir = limbo_dir
1711
 
 
1712
 
 
1713
1652
class ImmortalPendingDeletion(BzrError):
1714
1653
 
1715
1654
    _fmt = ("Unable to delete transform temporary directory "
1936
1875
        self.other = other
1937
1876
 
1938
1877
 
1939
 
class BadInventoryFormat(BzrError):
1940
 
 
1941
 
    _fmt = "Root class for inventory serialization errors"
1942
 
 
1943
 
 
1944
 
class UnexpectedInventoryFormat(BadInventoryFormat):
1945
 
 
1946
 
    _fmt = "The inventory was not in the expected format:\n %(msg)s"
1947
 
 
1948
 
    def __init__(self, msg):
1949
 
        BadInventoryFormat.__init__(self, msg=msg)
1950
 
 
1951
 
 
1952
1878
class RootNotRich(BzrError):
1953
1879
 
1954
1880
    _fmt = """This operation requires rich root data storage"""
2011
1937
        " branch location."
2012
1938
 
2013
1939
 
2014
 
class IllegalMergeDirectivePayload(BzrError):
2015
 
    """A merge directive contained something other than a patch or bundle"""
2016
 
 
2017
 
    _fmt = "Bad merge directive payload %(start)r"
2018
 
 
2019
 
    def __init__(self, start):
2020
 
        BzrError(self)
2021
 
        self.start = start
2022
 
 
2023
 
 
2024
1940
class PatchVerificationFailed(BzrError):
2025
1941
    """A patch from a merge directive could not be verified"""
2026
1942
 
2050
1966
        self.location = location
2051
1967
 
2052
1968
 
2053
 
class UnsupportedInventoryKind(BzrError):
2054
 
 
2055
 
    _fmt = """Unsupported entry kind %(kind)s"""
2056
 
 
2057
 
    def __init__(self, kind):
2058
 
        self.kind = kind
2059
 
 
2060
 
 
2061
1969
class BadSubsumeSource(BzrError):
2062
1970
 
2063
1971
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"