~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-02-18 02:33:47 UTC
  • mfrom: (1534.1.24 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060218023347-0952c65f668bfd68
Merge Robert Collins integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
 
106
106
class BzrCheckError(BzrNewError):
107
107
    """Internal check failed: %(message)s"""
 
108
 
108
109
    def __init__(self, message):
109
110
        BzrNewError.__init__(self)
110
111
        self.message = message
140
141
        self.base = base
141
142
 
142
143
 
 
144
class NotLocalUrl(BzrNewError):
 
145
    """%s(url) is not a local path."""
 
146
    
 
147
    def __init__(self, url):
 
148
        BzrNewError.__init__(self)
 
149
        self.url = url
 
150
 
 
151
 
143
152
class BzrCommandError(BzrError):
144
153
    # Error from malformed user command
145
154
    # This is being misused as a generic exception
203
212
        self.path = path
204
213
 
205
214
 
 
215
class NoRepositoryPresent(BzrNewError):
 
216
    """Not repository present: %(path)r"""
 
217
    def __init__(self, bzrdir):
 
218
        BzrNewError.__init__(self)
 
219
        self.path = bzrdir.transport.clone('..').base
 
220
 
 
221
 
206
222
class FileInWrongBranch(BzrNewError):
207
223
    """File %(path)s in not in branch %(branch_base)s."""
 
224
 
208
225
    def __init__(self, branch, path):
209
226
        BzrNewError.__init__(self)
210
227
        self.branch = branch
224
241
        return 'unknown branch format: %s' % self.args[0]
225
242
 
226
243
 
 
244
class IncompatibleFormat(BzrNewError):
 
245
    """Format %(format)s is not compatible with .bzr version %(bzrdir)s."""
 
246
 
 
247
    def __init__(self, format, bzrdir_format):
 
248
        BzrNewError.__init__(self)
 
249
        self.format = format
 
250
        self.bzrdir = bzrdir_format
 
251
 
 
252
 
227
253
class NotVersionedError(BzrNewError):
228
254
    """%(path)s is not versioned"""
229
255
    def __init__(self, path):
268
294
    """Upgrade URL cannot work with readonly URL's."""
269
295
 
270
296
 
 
297
class UpToDateFormat(BzrNewError):
 
298
    """The branch format %(format)s is already at the most recent format."""
 
299
 
 
300
    def __init__(self, format):
 
301
        BzrNewError.__init__(self)
 
302
        self.format = format
 
303
 
 
304
 
271
305
class StrictCommitFailed(Exception):
272
306
    """Commit refused because there are unknowns in the tree."""
273
307
 
301
335
            " specified."
302
336
        BzrCommandError.__init__(self, msg)
303
337
 
 
338
 
304
339
class NoCommonAncestor(BzrError):
305
340
    def __init__(self, revision_a, revision_b):
306
341
        msg = "Revisions have no common ancestor: %s %s." \
307
342
            % (revision_a, revision_b) 
308
343
        BzrError.__init__(self, msg)
309
344
 
 
345
 
310
346
class NoCommonRoot(BzrError):
311
347
    def __init__(self, revision_a, revision_b):
312
348
        msg = "Revisions are not derived from the same root: %s %s." \
313
349
            % (revision_a, revision_b) 
314
350
        BzrError.__init__(self, msg)
315
351
 
 
352
 
316
353
class NotAncestor(BzrError):
317
354
    def __init__(self, rev_id, not_ancestor_id):
318
355
        msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id, 
336
373
        BzrError.__init__(self, msg)
337
374
        self.bases = bases
338
375
 
 
376
 
339
377
class NoCommits(BzrError):
340
378
    def __init__(self, branch):
341
379
        msg = "Branch %s has no commits." % branch
342
380
        BzrError.__init__(self, msg)
343
381
 
 
382
 
344
383
class UnlistableStore(BzrError):
345
384
    def __init__(self, store):
346
385
        BzrError.__init__(self, "Store %s is not listable" % store)
347
386
 
 
387
 
348
388
class UnlistableBranch(BzrError):
349
389
    def __init__(self, br):
350
390
        BzrError.__init__(self, "Stores for branch %s are not listable" % br)
388
428
    """Text did not match it's checksum: %(message)s"""
389
429
 
390
430
 
 
431
class WeaveTextDiffers(WeaveError):
 
432
    """Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"""
 
433
 
 
434
    def __init__(self, revision_id, weave_a, weave_b):
 
435
        WeaveError.__init__(self)
 
436
        self.revision_id = revision_id
 
437
        self.weave_a = weave_a
 
438
        self.weave_b = weave_b
 
439
 
 
440
 
391
441
class NoSuchExportFormat(BzrNewError):
392
442
    """Export format %(format)r not supported"""
393
443
    def __init__(self, format):
406
456
        self.msg = msg
407
457
        self.orig_error = orig_error
408
458
 
 
459
 
409
460
# A set of semi-meaningful errors which can be thrown
410
461
class TransportNotPossible(TransportError):
411
462
    """This is for transports where a specific function is explicitly not
427
478
    """The connection has been closed."""
428
479
    pass
429
480
 
 
481
 
430
482
class ConflictsInTree(BzrError):
431
483
    def __init__(self):
432
484
        BzrError.__init__(self, "Working tree has conflicts.")
433
485
 
 
486
 
434
487
class ParseConfigError(BzrError):
435
488
    def __init__(self, errors, filename):
436
489
        if filename is None:
439
492
            (filename, ('\n'.join(e.message for e in errors)))
440
493
        BzrError.__init__(self, message)
441
494
 
 
495
 
442
496
class SigningFailed(BzrError):
443
497
    def __init__(self, command_line):
444
498
        BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
445
499
                               % command_line)
446
500
 
 
501
 
447
502
class WorkingTreeNotRevision(BzrError):
448
503
    def __init__(self, tree):
449
504
        BzrError.__init__(self, "The working tree for %s has changed since"
450
505
                          " last commit, but weave merge requires that it be"
451
506
                          " unchanged." % tree.basedir)
452
507
 
 
508
 
453
509
class CantReprocessAndShowBase(BzrNewError):
454
510
    """Can't reprocess and show base.
455
511
Reprocessing obscures relationship of conflicting lines to base."""
456
512
 
 
513
 
457
514
class GraphCycleError(BzrNewError):
458
515
    """Cycle in graph %(graph)r"""
459
516
    def __init__(self, graph):
506
563
    """Parameter %(param)s is not a string or unicode string."""
507
564
 
508
565
 
 
566
class BzrBadParameterMissing(BzrBadParameter):
 
567
    """Parameter $(param)s is required but not present."""
 
568
 
 
569
 
509
570
class DependencyNotPresent(BzrNewError):
510
571
    """Unable to import library: %(library)s, %(error)s"""
511
572
 
526
587
    def __init__(self, format):
527
588
        BzrNewError.__init__(self)
528
589
        self.format = format
 
590
 
 
591
 
 
592
class OutOfDateTree(BzrNewError):
 
593
    """Working tree is out of date, please run 'bzr update'."""
 
594
 
 
595
    def __init__(self, tree):
 
596
        BzrNewError.__init__(self)
 
597
        self.tree = tree