/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-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

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."
956
930
        self.revision_id = revision_id
957
931
 
958
932
 
959
 
class InvalidRevisionSpec(BzrError):
960
 
 
961
 
    _fmt = ("Requested revision: '%(spec)s' does not exist in branch:"
962
 
            " %(branch_url)s%(extra)s")
963
 
 
964
 
    def __init__(self, spec, branch, extra=None):
965
 
        BzrError.__init__(self, branch=branch, spec=spec)
966
 
        self.branch_url = getattr(branch, 'user_url', str(branch))
967
 
        if extra:
968
 
            self.extra = '\n' + str(extra)
969
 
        else:
970
 
            self.extra = ''
971
 
 
972
 
 
973
933
class AppendRevisionsOnlyViolation(BzrError):
974
934
 
975
935
    _fmt = ('Operation denied because it would change the main history,'
1320
1280
        TransportError.__init__(self, msg, orig_error=orig_error)
1321
1281
 
1322
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
 
1323
1308
class InvalidHttpRange(InvalidHttpResponse):
1324
1309
 
1325
1310
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
1475
1460
        self.file_id = file_id
1476
1461
 
1477
1462
 
1478
 
class DuplicateFileId(BzrError):
1479
 
 
1480
 
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1481
 
 
1482
 
    def __init__(self, file_id, entry):
1483
 
        BzrError.__init__(self)
1484
 
        self.file_id = file_id
1485
 
        self.entry = entry
1486
 
 
1487
 
 
1488
1463
class DuplicateKey(BzrError):
1489
1464
 
1490
1465
    _fmt = "Key %(key)s is already present in map"
1498
1473
        self.prefix = prefix
1499
1474
 
1500
1475
 
1501
 
class MalformedTransform(InternalBzrError):
1502
 
 
1503
 
    _fmt = "Tree transform is malformed %(conflicts)r"
1504
 
 
1505
 
 
1506
 
class NoFinalPath(BzrError):
1507
 
 
1508
 
    _fmt = ("No final name for trans_id %(trans_id)r\n"
1509
 
            "file-id: %(file_id)r\n"
1510
 
            "root trans-id: %(root_trans_id)r\n")
1511
 
 
1512
 
    def __init__(self, trans_id, transform):
1513
 
        self.trans_id = trans_id
1514
 
        self.file_id = transform.final_file_id(trans_id)
1515
 
        self.root_trans_id = transform.root
1516
 
 
1517
 
 
1518
1476
class BzrBadParameter(InternalBzrError):
1519
1477
 
1520
1478
    _fmt = "Bad parameter: %(param)r"
1532
1490
    _fmt = "Parameter %(param)s is neither unicode nor utf8."
1533
1491
 
1534
1492
 
1535
 
class ReusingTransform(BzrError):
1536
 
 
1537
 
    _fmt = "Attempt to reuse a transform that has already been applied."
1538
 
 
1539
 
 
1540
 
class CantMoveRoot(BzrError):
1541
 
 
1542
 
    _fmt = "Moving the root directory is not supported at this time"
1543
 
 
1544
 
 
1545
 
class TransformRenameFailed(BzrError):
1546
 
 
1547
 
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
1548
 
 
1549
 
    def __init__(self, from_path, to_path, why, errno):
1550
 
        self.from_path = from_path
1551
 
        self.to_path = to_path
1552
 
        self.why = why
1553
 
        self.errno = errno
1554
 
 
1555
 
 
1556
1493
class BzrMoveFailedError(BzrError):
1557
1494
 
1558
1495
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1682
1619
    _fmt = "Diff3 is not installed on this machine."
1683
1620
 
1684
1621
 
1685
 
class ExistingContent(BzrError):
1686
 
    # Added in breezy 0.92, used by VersionedFile.add_lines.
1687
 
 
1688
 
    _fmt = "The content being inserted is already present."
1689
 
 
1690
 
 
1691
1622
class ExistingLimbo(BzrError):
1692
1623
 
1693
1624
    _fmt = """This tree contains left-over files from a failed operation.
1709
1640
        BzrError.__init__(self, pending_deletion=pending_deletion)
1710
1641
 
1711
1642
 
1712
 
class ImmortalLimbo(BzrError):
1713
 
 
1714
 
    _fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
1715
 
    Please examine %(limbo_dir)s to see if it contains any files you wish to
1716
 
    keep, and delete it when you are done."""
1717
 
 
1718
 
    def __init__(self, limbo_dir):
1719
 
        BzrError.__init__(self)
1720
 
        self.limbo_dir = limbo_dir
1721
 
 
1722
 
 
1723
1643
class ImmortalPendingDeletion(BzrError):
1724
1644
 
1725
1645
    _fmt = ("Unable to delete transform temporary directory "
1946
1866
        self.other = other
1947
1867
 
1948
1868
 
1949
 
class BadInventoryFormat(BzrError):
1950
 
 
1951
 
    _fmt = "Root class for inventory serialization errors"
1952
 
 
1953
 
 
1954
 
class UnexpectedInventoryFormat(BadInventoryFormat):
1955
 
 
1956
 
    _fmt = "The inventory was not in the expected format:\n %(msg)s"
1957
 
 
1958
 
    def __init__(self, msg):
1959
 
        BadInventoryFormat.__init__(self, msg=msg)
1960
 
 
1961
 
 
1962
1869
class RootNotRich(BzrError):
1963
1870
 
1964
1871
    _fmt = """This operation requires rich root data storage"""
2021
1928
        " branch location."
2022
1929
 
2023
1930
 
2024
 
class IllegalMergeDirectivePayload(BzrError):
2025
 
    """A merge directive contained something other than a patch or bundle"""
2026
 
 
2027
 
    _fmt = "Bad merge directive payload %(start)r"
2028
 
 
2029
 
    def __init__(self, start):
2030
 
        BzrError(self)
2031
 
        self.start = start
2032
 
 
2033
 
 
2034
1931
class PatchVerificationFailed(BzrError):
2035
1932
    """A patch from a merge directive could not be verified"""
2036
1933
 
2060
1957
        self.location = location
2061
1958
 
2062
1959
 
2063
 
class UnsupportedInventoryKind(BzrError):
2064
 
 
2065
 
    _fmt = """Unsupported entry kind %(kind)s"""
2066
 
 
2067
 
    def __init__(self, kind):
2068
 
        self.kind = kind
2069
 
 
2070
 
 
2071
1960
class BadSubsumeSource(BzrError):
2072
1961
 
2073
1962
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2393
2282
        self.format = format
2394
2283
 
2395
2284
 
2396
 
class ChangesAlreadyStored(BzrCommandError):
 
2285
class ChangesAlreadyStored(CommandError):
2397
2286
 
2398
2287
    _fmt = ('Cannot store uncommitted changes because this branch already'
2399
2288
            ' stores uncommitted changes.')