/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-06-01 21:57:00 UTC
  • mfrom: (7490.39.3 move-launchpad)
  • Revision ID: breezy.the.bot@gmail.com-20200601215700-joxuzo6w172gq74v
Move launchpad hoster support to the launchpad plugin.

Merged from https://code.launchpad.net/~jelmer/brz/move-launchpad/+merge/384931

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
 
233
242
class NoWorkingTree(BzrError):
234
243
 
235
244
    _fmt = 'No WorkingTree exists for "%(base)s".'
262
271
            'E.g. brz whoami "Your Name <name@example.com>"')
263
272
 
264
273
 
265
 
class CommandError(BzrError):
 
274
class BzrCommandError(BzrError):
266
275
    """Error from user command"""
267
276
 
268
277
    # Error from malformed user command; please avoid raising this as a
270
279
    #
271
280
    # I think it's a waste of effort to differentiate between errors that
272
281
    # 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
 
282
    # BzrCommandError, and non-UI code should not throw a subclass of
 
283
    # BzrCommandError.  ADHB 20051211
279
284
 
280
285
 
281
286
class NotWriteLocked(BzrError):
377
382
    _fmt = 'Permission denied: "%(path)s"%(extra)s'
378
383
 
379
384
 
 
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
 
380
397
class UnsupportedProtocol(PathError):
381
398
 
382
399
    _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s'
563
580
        self.format = format
564
581
 
565
582
 
 
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
 
566
592
class IncompatibleFormat(BzrError):
567
593
 
568
594
    _fmt = "Format %(format)s is not compatible with .bzr version %(controldir)s."
1280
1306
        TransportError.__init__(self, msg, orig_error=orig_error)
1281
1307
 
1282
1308
 
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
1309
class InvalidHttpRange(InvalidHttpResponse):
1309
1310
 
1310
1311
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
1460
1461
        self.file_id = file_id
1461
1462
 
1462
1463
 
 
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
 
1463
1474
class DuplicateKey(BzrError):
1464
1475
 
1465
1476
    _fmt = "Key %(key)s is already present in map"
1473
1484
        self.prefix = prefix
1474
1485
 
1475
1486
 
 
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
 
1476
1504
class BzrBadParameter(InternalBzrError):
1477
1505
 
1478
1506
    _fmt = "Bad parameter: %(param)r"
1490
1518
    _fmt = "Parameter %(param)s is neither unicode nor utf8."
1491
1519
 
1492
1520
 
 
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
 
1493
1542
class BzrMoveFailedError(BzrError):
1494
1543
 
1495
1544
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1619
1668
    _fmt = "Diff3 is not installed on this machine."
1620
1669
 
1621
1670
 
 
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
 
1622
1677
class ExistingLimbo(BzrError):
1623
1678
 
1624
1679
    _fmt = """This tree contains left-over files from a failed operation.
1640
1695
        BzrError.__init__(self, pending_deletion=pending_deletion)
1641
1696
 
1642
1697
 
 
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
 
1643
1709
class ImmortalPendingDeletion(BzrError):
1644
1710
 
1645
1711
    _fmt = ("Unable to delete transform temporary directory "
1866
1932
        self.other = other
1867
1933
 
1868
1934
 
 
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
 
1869
1948
class RootNotRich(BzrError):
1870
1949
 
1871
1950
    _fmt = """This operation requires rich root data storage"""
1928
2007
        " branch location."
1929
2008
 
1930
2009
 
 
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
 
1931
2020
class PatchVerificationFailed(BzrError):
1932
2021
    """A patch from a merge directive could not be verified"""
1933
2022
 
1957
2046
        self.location = location
1958
2047
 
1959
2048
 
 
2049
class UnsupportedInventoryKind(BzrError):
 
2050
 
 
2051
    _fmt = """Unsupported entry kind %(kind)s"""
 
2052
 
 
2053
    def __init__(self, kind):
 
2054
        self.kind = kind
 
2055
 
 
2056
 
1960
2057
class BadSubsumeSource(BzrError):
1961
2058
 
1962
2059
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2282
2379
        self.format = format
2283
2380
 
2284
2381
 
2285
 
class ChangesAlreadyStored(CommandError):
 
2382
class ChangesAlreadyStored(BzrCommandError):
2286
2383
 
2287
2384
    _fmt = ('Cannot store uncommitted changes because this branch already'
2288
2385
            ' stores uncommitted changes.')