/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: Canonical.com Patch Queue Manager
  • Date: 2007-08-28 13:02:28 UTC
  • mfrom: (2759.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070828130228-rv0k8180v9n4vj90
(Daniel Watkins) Clean-up error messages quoting parameters when necessary

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
 
1005
1005
class NoSuchRevisionInTree(NoSuchRevision):
1006
1006
    """When using Tree.revision_tree, and the revision is not accessible."""
1007
1007
    
1008
 
    _fmt = "The revision id %(revision_id)s is not present in the tree %(tree)s."
 
1008
    _fmt = "The revision id {%(revision_id)s} is not present in the tree %(tree)s."
1009
1009
 
1010
1010
    def __init__(self, tree, revision_id):
1011
1011
        BzrError.__init__(self)
1143
1143
 
1144
1144
class BoundBranchOutOfDate(BzrError):
1145
1145
 
1146
 
    _fmt = ("Bound branch %(branch)s is out of date"
1147
 
            " with master branch %(master)s.")
 
1146
    _fmt = ("Bound branch %(branch)s is out of date with master branch"
 
1147
            " %(master)s.")
1148
1148
 
1149
1149
    def __init__(self, branch, master):
1150
1150
        BzrError.__init__(self)
1265
1265
 
1266
1266
class RevisionNotPresent(VersionedFileError):
1267
1267
    
1268
 
    _fmt = "Revision {%(revision_id)s} not present in %(file_id)s."
 
1268
    _fmt = 'Revision {%(revision_id)s} not present in "%(file_id)s".'
1269
1269
 
1270
1270
    def __init__(self, revision_id, file_id):
1271
1271
        VersionedFileError.__init__(self)
1275
1275
 
1276
1276
class RevisionAlreadyPresent(VersionedFileError):
1277
1277
    
1278
 
    _fmt = "Revision {%(revision_id)s} already present in %(file_id)s."
 
1278
    _fmt = 'Revision {%(revision_id)s} already present in "%(file_id)s".'
1279
1279
 
1280
1280
    def __init__(self, revision_id, file_id):
1281
1281
        VersionedFileError.__init__(self)
1297
1297
 
1298
1298
class KnitHeaderError(KnitError):
1299
1299
 
1300
 
    _fmt = "Knit header error: %(badline)r unexpected for file %(filename)s"
 
1300
    _fmt = 'Knit header error: %(badline)r unexpected for file "%(filename)s".'
1301
1301
 
1302
1302
    def __init__(self, badline, filename):
1303
1303
        KnitError.__init__(self)
1527
1527
 
1528
1528
class SigningFailed(BzrError):
1529
1529
 
1530
 
    _fmt = "Failed to gpg sign data with command %(command_line)r"
 
1530
    _fmt = 'Failed to gpg sign data with command "%(command_line)s"'
1531
1531
 
1532
1532
    def __init__(self, command_line):
1533
1533
        BzrError.__init__(self, command_line=command_line)
1607
1607
 
1608
1608
class NoBundleFound(BzrError):
1609
1609
 
1610
 
    _fmt = "No bundle was found in %(filename)s"
 
1610
    _fmt = 'No bundle was found in "%(filename)s".'
1611
1611
 
1612
1612
    def __init__(self, filename):
1613
1613
        BzrError.__init__(self)
2176
2176
 
2177
2177
class BadSubsumeSource(BzrError):
2178
2178
 
2179
 
    _fmt = """Can't subsume %(other_tree)s into %(tree)s.  %(reason)s"""
 
2179
    _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2180
2180
 
2181
2181
    def __init__(self, tree, other_tree, reason):
2182
2182
        self.tree = tree
2194
2194
 
2195
2195
class BadReferenceTarget(BzrError):
2196
2196
 
2197
 
    _fmt = "Can't add reference to %(other_tree)s into %(tree)s.  %(reason)s"
 
2197
    _fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
 
2198
           "%(reason)s"
2198
2199
 
2199
2200
    internal_error = True
2200
2201
 
2301
2302
 
2302
2303
class DuplicateRecordNameError(ContainerError):
2303
2304
 
2304
 
    _fmt = "Container has multiple records with the same name: \"%(name)s\""
 
2305
    _fmt = "Container has multiple records with the same name: %(name)s"
2305
2306
 
2306
2307
    def __init__(self, name):
2307
2308
        self.name = name