/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 bzrlib/errors.py

  • Committer: Martin Pool
  • Date: 2007-09-03 04:35:49 UTC
  • mfrom: (2778 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2779.
  • Revision ID: mbp@sourcefrog.net-20070903043549-0cfyrgx7z2h8ppks
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
256
256
 
257
257
class NoSuchId(BzrError):
258
258
 
259
 
    _fmt = "The file id %(file_id)s is not present in the tree %(tree)s."
 
259
    _fmt = 'The file id "%(file_id)s" is not present in the tree %(tree)s.'
260
260
    
261
261
    def __init__(self, tree, file_id):
262
262
        BzrError.__init__(self)
266
266
 
267
267
class NoSuchIdInRepository(NoSuchId):
268
268
 
269
 
    _fmt = ("The file id %(file_id)r is not present in the repository"
270
 
            " %(repository)r")
 
269
    _fmt = ('The file id "%(file_id)s" is not present in the repository'
 
270
            ' %(repository)r')
271
271
 
272
272
    def __init__(self, repository, file_id):
273
273
        BzrError.__init__(self, repository=repository, file_id=file_id)
286
286
 
287
287
class NoWorkingTree(BzrError):
288
288
 
289
 
    _fmt = "No WorkingTree exists for %(base)s."
 
289
    _fmt = 'No WorkingTree exists for "%(base)s".'
290
290
    
291
291
    def __init__(self, base):
292
292
        BzrError.__init__(self)
308
308
 
309
309
class WorkingTreeAlreadyPopulated(BzrError):
310
310
 
311
 
    _fmt = """Working tree already populated in %(base)s"""
 
311
    _fmt = 'Working tree already populated in "%(base)s"'
312
312
 
313
313
    internal_error = True
314
314
 
468
468
 
469
469
class NotADirectory(PathError):
470
470
 
471
 
    _fmt = "%(path)r is not a directory %(extra)s"
 
471
    _fmt = '"%(path)s" is not a directory %(extra)s'
472
472
 
473
473
 
474
474
class NotInWorkingDirectory(PathError):
475
475
 
476
 
    _fmt = "%(path)r is not in the working directory %(extra)s"
 
476
    _fmt = '"%(path)s" is not in the working directory %(extra)s'
477
477
 
478
478
 
479
479
class DirectoryNotEmpty(PathError):
480
480
 
481
 
    _fmt = "Directory not empty: %(path)r%(extra)s"
 
481
    _fmt = 'Directory not empty: "%(path)s"%(extra)s'
482
482
 
483
483
 
484
484
class ReadingCompleted(BzrError):
495
495
 
496
496
class ResourceBusy(PathError):
497
497
 
498
 
    _fmt = "Device or resource busy: %(path)r%(extra)s"
 
498
    _fmt = 'Device or resource busy: "%(path)s"%(extra)s'
499
499
 
500
500
 
501
501
class PermissionDenied(PathError):
502
502
 
503
 
    _fmt = "Permission denied: %(path)r%(extra)s"
 
503
    _fmt = 'Permission denied: "%(path)s"%(extra)s'
504
504
 
505
505
 
506
506
class InvalidURL(PathError):
507
507
 
508
 
    _fmt = "Invalid url supplied to transport: %(path)r%(extra)s"
 
508
    _fmt = 'Invalid url supplied to transport: "%(path)s"%(extra)s'
509
509
 
510
510
 
511
511
class InvalidURLJoin(PathError):
512
512
 
513
 
    _fmt = "Invalid URL join request: %(args)s%(extra)s"
 
513
    _fmt = 'Invalid URL join request: "%(args)s"%(extra)s'
514
514
 
515
515
    def __init__(self, msg, base, args):
516
516
        PathError.__init__(self, base, msg)
542
542
 
543
543
class ShortReadvError(PathError):
544
544
 
545
 
    _fmt = ("readv() read %(actual)s bytes rather than %(length)s bytes"
546
 
            " at %(offset)s for %(path)s%(extra)s")
 
545
    _fmt = ('readv() read %(actual)s bytes rather than %(length)s bytes'
 
546
            ' at %(offset)s for "%(path)s"%(extra)s')
547
547
 
548
548
    internal_error = True
549
549
 
556
556
 
557
557
class PathNotChild(PathError):
558
558
 
559
 
    _fmt = "Path %(path)r is not a child of path %(base)r%(extra)s"
 
559
    _fmt = 'Path "%(path)s" is not a child of path "%(base)s"%(extra)s'
560
560
 
561
561
    internal_error = True
562
562
 
572
572
 
573
573
class InvalidNormalization(PathError):
574
574
 
575
 
    _fmt = "Path %(path)r is not unicode normalized"
 
575
    _fmt = 'Path "%(path)s" is not unicode normalized'
576
576
 
577
577
 
578
578
# TODO: This is given a URL; we try to unescape it but doing that from inside
580
580
# TODO: Probably this behavior of should be a common superclass 
581
581
class NotBranchError(PathError):
582
582
 
583
 
    _fmt = "Not a branch: %(path)s"
 
583
    _fmt = 'Not a branch: "%(path)s".'
584
584
 
585
585
    def __init__(self, path):
586
586
       import bzrlib.urlutils as urlutils
598
598
 
599
599
class AlreadyBranchError(PathError):
600
600
 
601
 
    _fmt = "Already a branch: %(path)s."
 
601
    _fmt = 'Already a branch: "%(path)s".'
602
602
 
603
603
 
604
604
class BranchExistsWithoutWorkingTree(PathError):
605
605
 
606
 
    _fmt = "Directory contains a branch, but no working tree \
607
 
(use bzr checkout if you wish to build a working tree): %(path)s"
 
606
    _fmt = 'Directory contains a branch, but no working tree \
 
607
(use bzr checkout if you wish to build a working tree): "%(path)s"'
608
608
 
609
609
 
610
610
class AtomicFileAlreadyClosed(PathError):
611
611
 
612
 
    _fmt = ("'%(function)s' called on an AtomicFile after it was closed:"
613
 
            " %(path)s")
 
612
    _fmt = ('"%(function)s" called on an AtomicFile after it was closed:'
 
613
            ' "%(path)s"')
614
614
 
615
615
    def __init__(self, path, function):
616
616
        PathError.__init__(self, path=path, extra=None)
619
619
 
620
620
class InaccessibleParent(PathError):
621
621
 
622
 
    _fmt = ("Parent not accessible given base %(base)s and"
623
 
            " relative path %(path)s")
 
622
    _fmt = ('Parent not accessible given base "%(base)s" and'
 
623
            ' relative path "%(path)s"')
624
624
 
625
625
    def __init__(self, path, base):
626
626
        PathError.__init__(self, path)
629
629
 
630
630
class NoRepositoryPresent(BzrError):
631
631
 
632
 
    _fmt = "No repository present: %(path)r"
 
632
    _fmt = 'No repository present: "%(path)s"'
633
633
    def __init__(self, bzrdir):
634
634
        BzrError.__init__(self)
635
635
        self.path = bzrdir.transport.clone('..').base
637
637
 
638
638
class FileInWrongBranch(BzrError):
639
639
 
640
 
    _fmt = "File %(path)s in not in branch %(branch_base)s."
 
640
    _fmt = 'File "%(path)s" in not in branch %(branch_base)s.'
641
641
 
642
642
    def __init__(self, branch, path):
643
643
        BzrError.__init__(self)
687
687
class AlreadyVersionedError(BzrError):
688
688
    """Used when a path is expected not to be versioned, but it is."""
689
689
 
690
 
    _fmt = "%(context_info)s%(path)s is already versioned"
 
690
    _fmt = "%(context_info)s%(path)s is already versioned."
691
691
 
692
692
    def __init__(self, path, context_info=None):
693
693
        """Construct a new AlreadyVersionedError.
708
708
class NotVersionedError(BzrError):
709
709
    """Used when a path is expected to be versioned, but it is not."""
710
710
 
711
 
    _fmt = "%(context_info)s%(path)s is not versioned"
 
711
    _fmt = "%(context_info)s%(path)s is not versioned."
712
712
 
713
713
    def __init__(self, path, context_info=None):
714
714
        """Construct a new NotVersionedError.
767
767
 
768
768
class ForbiddenControlFileError(BzrError):
769
769
 
770
 
    _fmt = "Cannot operate on %(filename)s because it is a control file"
 
770
    _fmt = 'Cannot operate on "%(filename)s" because it is a control file'
771
771
 
772
772
 
773
773
class LockError(BzrError):
870
870
 
871
871
class LockContention(LockError):
872
872
 
873
 
    _fmt = "Could not acquire lock %(lock)s"
 
873
    _fmt = 'Could not acquire lock "%(lock)s"'
874
874
    # TODO: show full url for lock, combining the transport and relative
875
875
    # bits?
876
876
 
950
950
        BzrError.__init__(self, files=files, files_str=files_str)
951
951
 
952
952
 
 
953
class BadCommitMessageEncoding(BzrError):
 
954
 
 
955
    _fmt = 'The specified commit message contains characters unsupported by '\
 
956
        'the current encoding.'
 
957
 
 
958
 
953
959
class UpgradeReadonly(BzrError):
954
960
 
955
961
    _fmt = "Upgrade URL cannot work with readonly URLs."
994
1000
                          new_revision=new_revision)
995
1001
 
996
1002
 
 
1003
class RangeInChangeOption(BzrError):
 
1004
 
 
1005
    _fmt = "Option --change does not accept revision ranges"
 
1006
 
 
1007
 
997
1008
class NoSuchRevisionSpec(BzrError):
998
1009
 
999
1010
    _fmt = "No namespace registered for string: %(spec)r"
1005
1016
class NoSuchRevisionInTree(NoSuchRevision):
1006
1017
    """When using Tree.revision_tree, and the revision is not accessible."""
1007
1018
    
1008
 
    _fmt = "The revision id %(revision_id)s is not present in the tree %(tree)s."
 
1019
    _fmt = "The revision id {%(revision_id)s} is not present in the tree %(tree)s."
1009
1020
 
1010
1021
    def __init__(self, tree, revision_id):
1011
1022
        BzrError.__init__(self)
1143
1154
 
1144
1155
class BoundBranchOutOfDate(BzrError):
1145
1156
 
1146
 
    _fmt = ("Bound branch %(branch)s is out of date"
1147
 
            " with master branch %(master)s.")
 
1157
    _fmt = ("Bound branch %(branch)s is out of date with master branch"
 
1158
            " %(master)s.")
1148
1159
 
1149
1160
    def __init__(self, branch, master):
1150
1161
        BzrError.__init__(self)
1265
1276
 
1266
1277
class RevisionNotPresent(VersionedFileError):
1267
1278
    
1268
 
    _fmt = "Revision {%(revision_id)s} not present in %(file_id)s."
 
1279
    _fmt = 'Revision {%(revision_id)s} not present in "%(file_id)s".'
1269
1280
 
1270
1281
    def __init__(self, revision_id, file_id):
1271
1282
        VersionedFileError.__init__(self)
1275
1286
 
1276
1287
class RevisionAlreadyPresent(VersionedFileError):
1277
1288
    
1278
 
    _fmt = "Revision {%(revision_id)s} already present in %(file_id)s."
 
1289
    _fmt = 'Revision {%(revision_id)s} already present in "%(file_id)s".'
1279
1290
 
1280
1291
    def __init__(self, revision_id, file_id):
1281
1292
        VersionedFileError.__init__(self)
1295
1306
    internal_error = True
1296
1307
 
1297
1308
 
1298
 
class KnitHeaderError(KnitError):
1299
 
 
1300
 
    _fmt = "Knit header error: %(badline)r unexpected for file %(filename)s"
1301
 
 
1302
 
    def __init__(self, badline, filename):
1303
 
        KnitError.__init__(self)
1304
 
        self.badline = badline
1305
 
        self.filename = filename
1306
 
 
1307
 
 
1308
1309
class KnitCorrupt(KnitError):
1309
1310
 
1310
1311
    _fmt = "Knit %(filename)s corrupt: %(how)s"
1315
1316
        self.how = how
1316
1317
 
1317
1318
 
 
1319
class KnitDataStreamIncompatible(KnitError):
 
1320
 
 
1321
    _fmt = "Cannot insert knit data stream of format \"%(stream_format)s\" into knit of format \"%(target_format)s\"."
 
1322
 
 
1323
    def __init__(self, stream_format, target_format):
 
1324
        self.stream_format = stream_format
 
1325
        self.target_format = target_format
 
1326
        
 
1327
 
 
1328
class KnitHeaderError(KnitError):
 
1329
 
 
1330
    _fmt = 'Knit header error: %(badline)r unexpected for file "%(filename)s".'
 
1331
 
 
1332
    def __init__(self, badline, filename):
 
1333
        KnitError.__init__(self)
 
1334
        self.badline = badline
 
1335
        self.filename = filename
 
1336
 
1318
1337
class KnitIndexUnknownMethod(KnitError):
1319
1338
    """Raised when we don't understand the storage method.
1320
1339
 
1527
1546
 
1528
1547
class SigningFailed(BzrError):
1529
1548
 
1530
 
    _fmt = "Failed to gpg sign data with command %(command_line)r"
 
1549
    _fmt = 'Failed to gpg sign data with command "%(command_line)s"'
1531
1550
 
1532
1551
    def __init__(self, command_line):
1533
1552
        BzrError.__init__(self, command_line=command_line)
1607
1626
 
1608
1627
class NoBundleFound(BzrError):
1609
1628
 
1610
 
    _fmt = "No bundle was found in %(filename)s"
 
1629
    _fmt = 'No bundle was found in "%(filename)s".'
1611
1630
 
1612
1631
    def __init__(self, filename):
1613
1632
        BzrError.__init__(self)
1636
1655
        self.text_revision = text_revision
1637
1656
        self.file_id = file_id
1638
1657
 
 
1658
 
1639
1659
class DuplicateFileId(BzrError):
1640
1660
 
1641
1661
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1844
1864
       self.limbo_dir = limbo_dir
1845
1865
 
1846
1866
 
 
1867
class ExistingPendingDeletion(BzrError):
 
1868
 
 
1869
    _fmt = """This tree contains left-over files from a failed operation.
 
1870
    Please examine %(pending_deletion)s to see if it contains any files you
 
1871
    wish to keep, and delete it when you are done."""
 
1872
 
 
1873
    def __init__(self, pending_deletion):
 
1874
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1875
 
 
1876
 
1847
1877
class ImmortalLimbo(BzrError):
1848
1878
 
1849
1879
    _fmt = """Unable to delete transform temporary directory $(limbo_dir)s.
1855
1885
       self.limbo_dir = limbo_dir
1856
1886
 
1857
1887
 
 
1888
class ImmortalPendingDeletion(BzrError):
 
1889
 
 
1890
    _fmt = """Unable to delete transform temporary directory
 
1891
    %(pending_deletion)s.  Please examine %(pending_deletions)s to see if it
 
1892
    contains any files you wish to keep, and delete it when you are done."""
 
1893
 
 
1894
    def __init__(self, pending_deletion):
 
1895
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1896
 
 
1897
 
1858
1898
class OutOfDateTree(BzrError):
1859
1899
 
1860
1900
    _fmt = "Working tree is out of date, please run 'bzr update'."
2175
2215
 
2176
2216
class BadSubsumeSource(BzrError):
2177
2217
 
2178
 
    _fmt = """Can't subsume %(other_tree)s into %(tree)s.  %(reason)s"""
 
2218
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2179
2219
 
2180
2220
    def __init__(self, tree, other_tree, reason):
2181
2221
        self.tree = tree
2193
2233
 
2194
2234
class BadReferenceTarget(BzrError):
2195
2235
 
2196
 
    _fmt = "Can't add reference to %(other_tree)s into %(tree)s.  %(reason)s"
 
2236
    _fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
 
2237
           "%(reason)s"
2197
2238
 
2198
2239
    internal_error = True
2199
2240
 
2300
2341
 
2301
2342
class DuplicateRecordNameError(ContainerError):
2302
2343
 
2303
 
    _fmt = "Container has multiple records with the same name: \"%(name)s\""
 
2344
    _fmt = "Container has multiple records with the same name: %(name)s"
2304
2345
 
2305
2346
    def __init__(self, name):
2306
2347
        self.name = name