/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: Gustav Hartvigsson
  • Date: 2021-01-11 20:19:38 UTC
  • mfrom: (7526.3.2 work)
  • Revision ID: gustav.hartvigsson@gmail.com-20210111201938-omr9wjz3qdgyxe8k
MergedĀ lp:brz

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".'
271
262
            'E.g. brz whoami "Your Name <name@example.com>"')
272
263
 
273
264
 
274
 
class BzrCommandError(BzrError):
 
265
class CommandError(BzrError):
275
266
    """Error from user command"""
276
267
 
277
268
    # Error from malformed user command; please avoid raising this as a
279
270
    #
280
271
    # I think it's a waste of effort to differentiate between errors that
281
272
    # are not intended to be caught anyway.  UI code need not subclass
282
 
    # BzrCommandError, and non-UI code should not throw a subclass of
283
 
    # BzrCommandError.  ADHB 20051211
 
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
284
279
 
285
280
 
286
281
class NotWriteLocked(BzrError):
382
377
    _fmt = 'Permission denied: "%(path)s"%(extra)s'
383
378
 
384
379
 
385
 
class UnavailableRepresentation(InternalBzrError):
386
 
 
387
 
    _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
388
 
            "is encoded as '%(native)s'.")
389
 
 
390
 
    def __init__(self, key, wanted, native):
391
 
        InternalBzrError.__init__(self)
392
 
        self.wanted = wanted
393
 
        self.native = native
394
 
        self.key = key
395
 
 
396
 
 
397
380
class UnsupportedProtocol(PathError):
398
381
 
399
382
    _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s'
580
563
        self.format = format
581
564
 
582
565
 
583
 
class LineEndingError(BzrError):
584
 
 
585
 
    _fmt = ("Line ending corrupted for file: %(file)s; "
586
 
            "Maybe your files got corrupted in transport?")
587
 
 
588
 
    def __init__(self, file):
589
 
        self.file = file
590
 
 
591
 
 
592
566
class IncompatibleFormat(BzrError):
593
567
 
594
568
    _fmt = "Format %(format)s is not compatible with .bzr version %(controldir)s."
1306
1280
        TransportError.__init__(self, msg, orig_error=orig_error)
1307
1281
 
1308
1282
 
 
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
 
1309
1308
class InvalidHttpRange(InvalidHttpResponse):
1310
1309
 
1311
1310
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
1461
1460
        self.file_id = file_id
1462
1461
 
1463
1462
 
1464
 
class DuplicateFileId(BzrError):
1465
 
 
1466
 
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1467
 
 
1468
 
    def __init__(self, file_id, entry):
1469
 
        BzrError.__init__(self)
1470
 
        self.file_id = file_id
1471
 
        self.entry = entry
1472
 
 
1473
 
 
1474
1463
class DuplicateKey(BzrError):
1475
1464
 
1476
1465
    _fmt = "Key %(key)s is already present in map"
1484
1473
        self.prefix = prefix
1485
1474
 
1486
1475
 
1487
 
class MalformedTransform(InternalBzrError):
1488
 
 
1489
 
    _fmt = "Tree transform is malformed %(conflicts)r"
1490
 
 
1491
 
 
1492
 
class NoFinalPath(BzrError):
1493
 
 
1494
 
    _fmt = ("No final name for trans_id %(trans_id)r\n"
1495
 
            "file-id: %(file_id)r\n"
1496
 
            "root trans-id: %(root_trans_id)r\n")
1497
 
 
1498
 
    def __init__(self, trans_id, transform):
1499
 
        self.trans_id = trans_id
1500
 
        self.file_id = transform.final_file_id(trans_id)
1501
 
        self.root_trans_id = transform.root
1502
 
 
1503
 
 
1504
1476
class BzrBadParameter(InternalBzrError):
1505
1477
 
1506
1478
    _fmt = "Bad parameter: %(param)r"
1518
1490
    _fmt = "Parameter %(param)s is neither unicode nor utf8."
1519
1491
 
1520
1492
 
1521
 
class ReusingTransform(BzrError):
1522
 
 
1523
 
    _fmt = "Attempt to reuse a transform that has already been applied."
1524
 
 
1525
 
 
1526
 
class CantMoveRoot(BzrError):
1527
 
 
1528
 
    _fmt = "Moving the root directory is not supported at this time"
1529
 
 
1530
 
 
1531
 
class TransformRenameFailed(BzrError):
1532
 
 
1533
 
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
1534
 
 
1535
 
    def __init__(self, from_path, to_path, why, errno):
1536
 
        self.from_path = from_path
1537
 
        self.to_path = to_path
1538
 
        self.why = why
1539
 
        self.errno = errno
1540
 
 
1541
 
 
1542
1493
class BzrMoveFailedError(BzrError):
1543
1494
 
1544
1495
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1668
1619
    _fmt = "Diff3 is not installed on this machine."
1669
1620
 
1670
1621
 
1671
 
class ExistingContent(BzrError):
1672
 
    # Added in breezy 0.92, used by VersionedFile.add_lines.
1673
 
 
1674
 
    _fmt = "The content being inserted is already present."
1675
 
 
1676
 
 
1677
1622
class ExistingLimbo(BzrError):
1678
1623
 
1679
1624
    _fmt = """This tree contains left-over files from a failed operation.
1695
1640
        BzrError.__init__(self, pending_deletion=pending_deletion)
1696
1641
 
1697
1642
 
1698
 
class ImmortalLimbo(BzrError):
1699
 
 
1700
 
    _fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
1701
 
    Please examine %(limbo_dir)s to see if it contains any files you wish to
1702
 
    keep, and delete it when you are done."""
1703
 
 
1704
 
    def __init__(self, limbo_dir):
1705
 
        BzrError.__init__(self)
1706
 
        self.limbo_dir = limbo_dir
1707
 
 
1708
 
 
1709
1643
class ImmortalPendingDeletion(BzrError):
1710
1644
 
1711
1645
    _fmt = ("Unable to delete transform temporary directory "
1932
1866
        self.other = other
1933
1867
 
1934
1868
 
1935
 
class BadInventoryFormat(BzrError):
1936
 
 
1937
 
    _fmt = "Root class for inventory serialization errors"
1938
 
 
1939
 
 
1940
 
class UnexpectedInventoryFormat(BadInventoryFormat):
1941
 
 
1942
 
    _fmt = "The inventory was not in the expected format:\n %(msg)s"
1943
 
 
1944
 
    def __init__(self, msg):
1945
 
        BadInventoryFormat.__init__(self, msg=msg)
1946
 
 
1947
 
 
1948
1869
class RootNotRich(BzrError):
1949
1870
 
1950
1871
    _fmt = """This operation requires rich root data storage"""
2007
1928
        " branch location."
2008
1929
 
2009
1930
 
2010
 
class IllegalMergeDirectivePayload(BzrError):
2011
 
    """A merge directive contained something other than a patch or bundle"""
2012
 
 
2013
 
    _fmt = "Bad merge directive payload %(start)r"
2014
 
 
2015
 
    def __init__(self, start):
2016
 
        BzrError(self)
2017
 
        self.start = start
2018
 
 
2019
 
 
2020
1931
class PatchVerificationFailed(BzrError):
2021
1932
    """A patch from a merge directive could not be verified"""
2022
1933
 
2046
1957
        self.location = location
2047
1958
 
2048
1959
 
2049
 
class UnsupportedInventoryKind(BzrError):
2050
 
 
2051
 
    _fmt = """Unsupported entry kind %(kind)s"""
2052
 
 
2053
 
    def __init__(self, kind):
2054
 
        self.kind = kind
2055
 
 
2056
 
 
2057
1960
class BadSubsumeSource(BzrError):
2058
1961
 
2059
1962
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2379
2282
        self.format = format
2380
2283
 
2381
2284
 
2382
 
class ChangesAlreadyStored(BzrCommandError):
 
2285
class ChangesAlreadyStored(CommandError):
2383
2286
 
2384
2287
    _fmt = ('Cannot store uncommitted changes because this branch already'
2385
2288
            ' stores uncommitted changes.')