~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
 
167
167
class InvalidRevisionId(BzrNewError):
168
168
    """Invalid revision-id {%(revision_id)s} in %(branch)s"""
 
169
 
169
170
    def __init__(self, revision_id, branch):
170
171
        # branch can be any string or object with __str__ defined
171
172
        BzrNewError.__init__(self)
173
174
        self.branch = branch
174
175
 
175
176
 
 
177
class NoSuchId(BzrNewError):
 
178
    """The file id %(file_id)s is not present in the tree %(tree)s."""
 
179
    
 
180
    def __init__(self, tree, file_id):
 
181
        BzrNewError.__init__(self)
 
182
        self.file_id = file_id
 
183
        self.tree = tree
 
184
 
 
185
 
176
186
class NoWorkingTree(BzrNewError):
177
187
    """No WorkingTree exists for %(base)s."""
178
188
    
504
514
        self.format = format
505
515
 
506
516
 
507
 
 
508
517
class StrictCommitFailed(Exception):
509
518
    """Commit refused because there are unknowns in the tree."""
510
519
 
515
524
    is_user_error = False
516
525
 
517
526
    def __init__(self, branch, revision):
518
 
        self.branch = branch
519
 
        self.revision = revision
 
527
        BzrNewError.__init__(self, branch=branch, revision=revision)
 
528
 
 
529
 
 
530
class NoSuchRevisionSpec(BzrNewError):
 
531
    """No namespace registered for string: %(spec)r"""
 
532
 
 
533
    def __init__(self, spec):
 
534
        BzrNewError.__init__(self, spec=spec)
 
535
 
 
536
 
 
537
class InvalidRevisionSpec(BzrNewError):
 
538
    """Requested revision: '%(spec)s' does not exist in branch:
 
539
%(branch)s%(extra)s"""
 
540
 
 
541
    def __init__(self, spec, branch, extra=None):
 
542
        BzrNewError.__init__(self, branch=branch, spec=spec)
 
543
        if extra:
 
544
            self.extra = '\n' + str(extra)
 
545
        else:
 
546
            self.extra = ''
520
547
 
521
548
 
522
549
class HistoryMissing(BzrError):
585
612
        self.bases = bases
586
613
 
587
614
 
588
 
class NoCommits(BzrError):
 
615
class NoCommits(BzrNewError):
 
616
    """Branch %(branch)s has no commits."""
 
617
 
589
618
    def __init__(self, branch):
590
 
        msg = "Branch %s has no commits." % branch
591
 
        BzrError.__init__(self, msg)
 
619
        BzrNewError.__init__(self, branch=branch)
592
620
 
593
621
 
594
622
class UnlistableStore(BzrError):
776
804
 
777
805
 
778
806
class InvalidRange(TransportError):
779
 
    """Invalid range access."""
 
807
    """Invalid range access in %(path)s at %(offset)s."""
780
808
    
781
809
    def __init__(self, path, offset):
782
810
        TransportError.__init__(self, ("Invalid range access in %s at %d"
783
811
                                       % (path, offset)))
 
812
        self.path = path
 
813
        self.offset = offset
784
814
 
785
815
 
786
816
class InvalidHttpResponse(TransportError):
948
978
        DependencyNotPresent.__init__(self, 'paramiko', error)
949
979
 
950
980
 
 
981
class PointlessMerge(BzrNewError):
 
982
    """Nothing to merge."""
 
983
 
 
984
 
951
985
class UninitializableFormat(BzrNewError):
952
986
    """Format %(format)s cannot be initialised by this version of bzr."""
953
987
 
1111
1145
    """End of line marker was not \\n in bzr revision-bundle"""    
1112
1146
 
1113
1147
    def __init__(self):
1114
 
        BzrNewError.__init__(self)    
 
1148
        BzrNewError.__init__(self)
1115
1149
 
1116
1150
 
1117
1151
class UnknownSSH(BzrNewError):
1121
1155
        BzrNewError.__init__(self)
1122
1156
        self.vendor = vendor
1123
1157
 
 
1158
 
 
1159
class GhostRevisionUnusableHere(BzrNewError):
 
1160
    """Ghost revision {%(revision_id)s} cannot be used here."""
 
1161
 
 
1162
    def __init__(self, revision_id):
 
1163
        BzrNewError.__init__(self)
 
1164
        self.revision_id = revision_id