/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: Andrew Bennetts
  • Date: 2008-04-10 07:58:01 UTC
  • mfrom: (3352 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3357.
  • Revision ID: andrew.bennetts@canonical.com-20080410075801-n24st9wfiizkvszp
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
    _fmt = "The tree builder is already building a tree."
186
186
 
187
187
 
 
188
class BranchError(BzrError):
 
189
    """Base class for concrete 'errors about a branch'."""
 
190
 
 
191
    def __init__(self, branch):
 
192
        BzrError.__init__(self, branch=branch)
 
193
 
 
194
 
188
195
class BzrCheckError(InternalBzrError):
189
196
    
190
197
    _fmt = "Internal check failed: %(message)s"
305
312
        BzrError.__init__(self, repository=repository, file_id=file_id)
306
313
 
307
314
 
 
315
class NotStacked(BranchError):
 
316
 
 
317
    _fmt = "The branch '%(branch)s' is not stacked."
 
318
 
 
319
 
308
320
class InventoryModified(InternalBzrError):
309
321
 
310
322
    _fmt = ("The current inventory for the tree %(tree)r has been modified,"
541
553
 
542
554
class InvalidURLJoin(PathError):
543
555
 
544
 
    _fmt = 'Invalid URL join request: "%(args)s"%(extra)s'
 
556
    _fmt = "Invalid URL join request: %(reason)s: %(base)r + %(join_args)r"
545
557
 
546
 
    def __init__(self, msg, base, args):
547
 
        PathError.__init__(self, base, msg)
548
 
        self.args = [base] + list(args)
 
558
    def __init__(self, reason, base, join_args):
 
559
        self.reason = reason
 
560
        self.base = base
 
561
        self.join_args = join_args
 
562
        PathError.__init__(self, base, reason)
549
563
 
550
564
 
551
565
class UnknownHook(BzrError):
566
580
        PathError.__init__(self, url, extra=extra)
567
581
 
568
582
 
 
583
class UnstackableBranchFormat(BzrError):
 
584
 
 
585
    _fmt = ("The branch '%(url)s'(%(format)s) is not a stackable format. "
 
586
        "You will need to upgrade the branch to permit branch stacking.")
 
587
 
 
588
    def __init__(self, format, url):
 
589
        BzrError.__init__(self)
 
590
        self.format = format
 
591
        self.url = url
 
592
 
 
593
 
 
594
class UnstackableRepositoryFormat(BzrError):
 
595
 
 
596
    _fmt = ("The repository '%(url)s'(%(format)s) is not a stackable format. "
 
597
        "You will need to upgrade the repository to permit branch stacking.")
 
598
 
 
599
    def __init__(self, format, url):
 
600
        BzrError.__init__(self)
 
601
        self.format = format
 
602
        self.url = url
 
603
 
 
604
 
569
605
class ReadError(PathError):
570
606
    
571
607
    _fmt = """Error reading from %(path)r."""
684
720
 
685
721
class UnknownFormatError(BzrError):
686
722
    
687
 
    _fmt = "Unknown branch format: %(format)r"
 
723
    _fmt = "Unknown %(kind)s format: %(format)r"
 
724
 
 
725
    def __init__(self, format, kind='branch'):
 
726
        self.kind = kind
 
727
        self.format = format
688
728
 
689
729
 
690
730
class IncompatibleFormat(BzrError):
1169
1209
        self.bases = bases
1170
1210
 
1171
1211
 
1172
 
class NoCommits(BzrError):
 
1212
class NoCommits(BranchError):
1173
1213
 
1174
1214
    _fmt = "Branch %(branch)s has no commits."
1175
1215
 
1176
 
    def __init__(self, branch):
1177
 
        BzrError.__init__(self, branch=branch)
1178
 
 
1179
1216
 
1180
1217
class UnlistableStore(BzrError):
1181
1218
 
1439
1476
        self.details = details
1440
1477
 
1441
1478
 
 
1479
class UnknownSmartMethod(InternalBzrError):
 
1480
 
 
1481
    _fmt = "The server does not recognise the '%(verb)s' request."
 
1482
 
 
1483
    def __init__(self, verb):
 
1484
        self.verb = verb
 
1485
 
 
1486
 
1442
1487
# A set of semi-meaningful errors which can be thrown
1443
1488
class TransportNotPossible(TransportError):
1444
1489
 
2178
2223
 
2179
2224
    _fmt = "No smart server available at %(url)s"
2180
2225
 
 
2226
    @symbol_versioning.deprecated_method(symbol_versioning.one_four)
2181
2227
    def __init__(self, url):
2182
2228
        self.url = url
2183
2229
 
2576
2622
 
2577
2623
    def __init__(self, timezone):
2578
2624
        self.timezone = timezone
 
2625
 
 
2626
 
 
2627
class CommandAvailableInPlugin(StandardError):
 
2628
    
 
2629
    internal_error = False
 
2630
 
 
2631
    def __init__(self, cmd_name, plugin_metadata, provider):
 
2632
        
 
2633
        self.plugin_metadata = plugin_metadata
 
2634
        self.cmd_name = cmd_name
 
2635
        self.provider = provider
 
2636
 
 
2637
    def __str__(self):
 
2638
 
 
2639
        _fmt = ('"%s" is not a standard bzr command. \n' 
 
2640
                'However, the following official plugin provides this command: %s\n'
 
2641
                'You can install it by going to: %s'
 
2642
                % (self.cmd_name, self.plugin_metadata['name'], 
 
2643
                    self.plugin_metadata['url']))
 
2644
 
 
2645
        return _fmt
 
2646
 
 
2647
 
 
2648
class NoPluginAvailable(BzrError):
 
2649
    pass    
 
2650
 
 
2651
 
 
2652
class NotATerminal(BzrError):
 
2653
 
 
2654
    _fmt = 'Unable to ask for a password without real terminal.'
 
2655
 
 
2656
 
 
2657
class UnableEncodePath(BzrError):
 
2658
 
 
2659
    _fmt = ('Unable to encode %(kind)s path %(path)r in '
 
2660
            'user encoding %(user_encoding)s')
 
2661
 
 
2662
    def __init__(self, path, kind):
 
2663
        self.path = path
 
2664
        self.kind = kind
 
2665
        self.user_encoding = osutils.get_user_encoding()