~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

Merge trunk

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
 
 
195
188
class BzrCheckError(InternalBzrError):
196
189
    
197
190
    _fmt = "Internal check failed: %(message)s"
312
305
        BzrError.__init__(self, repository=repository, file_id=file_id)
313
306
 
314
307
 
315
 
class NotStacked(BranchError):
316
 
 
317
 
    _fmt = "The branch '%(branch)s' is not stacked."
318
 
 
319
 
 
320
308
class InventoryModified(InternalBzrError):
321
309
 
322
310
    _fmt = ("The current inventory for the tree %(tree)r has been modified,"
553
541
 
554
542
class InvalidURLJoin(PathError):
555
543
 
556
 
    _fmt = "Invalid URL join request: %(reason)s: %(base)r + %(join_args)r"
557
 
 
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)
563
 
 
564
 
 
565
 
class UnavailableRepresentation(InternalBzrError):
566
 
 
567
 
    _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
568
 
        "is encoded as '%(native)s'.")
569
 
 
570
 
    def __init__(self, key, wanted, native):
571
 
        InternalBzrError.__init__(self)
572
 
        self.wanted = wanted
573
 
        self.native = native
574
 
        self.key = key
 
544
    _fmt = 'Invalid URL join request: "%(args)s"%(extra)s'
 
545
 
 
546
    def __init__(self, msg, base, args):
 
547
        PathError.__init__(self, base, msg)
 
548
        self.args = [base] + list(args)
575
549
 
576
550
 
577
551
class UnknownHook(BzrError):
592
566
        PathError.__init__(self, url, extra=extra)
593
567
 
594
568
 
595
 
class UnstackableBranchFormat(BzrError):
596
 
 
597
 
    _fmt = ("The branch '%(url)s'(%(format)s) is not a stackable format. "
598
 
        "You will need to upgrade the branch to permit branch stacking.")
599
 
 
600
 
    def __init__(self, format, url):
601
 
        BzrError.__init__(self)
602
 
        self.format = format
603
 
        self.url = url
604
 
 
605
 
 
606
 
class UnstackableRepositoryFormat(BzrError):
607
 
 
608
 
    _fmt = ("The repository '%(url)s'(%(format)s) is not a stackable format. "
609
 
        "You will need to upgrade the repository to permit branch stacking.")
610
 
 
611
 
    def __init__(self, format, url):
612
 
        BzrError.__init__(self)
613
 
        self.format = format
614
 
        self.url = url
615
 
 
616
 
 
617
569
class ReadError(PathError):
618
570
    
619
571
    _fmt = """Error reading from %(path)r."""
1221
1173
        self.bases = bases
1222
1174
 
1223
1175
 
1224
 
class NoCommits(BranchError):
 
1176
class NoCommits(BzrError):
1225
1177
 
1226
1178
    _fmt = "Branch %(branch)s has no commits."
1227
1179
 
 
1180
    def __init__(self, branch):
 
1181
        BzrError.__init__(self, branch=branch)
 
1182
 
1228
1183
 
1229
1184
class UnlistableStore(BzrError):
1230
1185
 
1488
1443
        self.details = details
1489
1444
 
1490
1445
 
1491
 
class UnknownSmartMethod(InternalBzrError):
1492
 
 
1493
 
    _fmt = "The server does not recognise the '%(verb)s' request."
1494
 
 
1495
 
    def __init__(self, verb):
1496
 
        self.verb = verb
1497
 
 
1498
 
 
1499
1446
# A set of semi-meaningful errors which can be thrown
1500
1447
class TransportNotPossible(TransportError):
1501
1448
 
2086
2033
        self.path = path
2087
2034
 
2088
2035
 
2089
 
class RepositoryUpgradeRequired(UpgradeRequired):
2090
 
 
2091
 
    _fmt = "To use this feature you must upgrade your repository at %(path)s."
2092
 
 
2093
 
 
2094
2036
class LocalRequiresBoundBranch(BzrError):
2095
2037
 
2096
2038
    _fmt = "Cannot perform local-only commits on unbound branches."
2240
2182
 
2241
2183
    _fmt = "No smart server available at %(url)s"
2242
2184
 
2243
 
    @symbol_versioning.deprecated_method(symbol_versioning.one_four)
2244
2185
    def __init__(self, url):
2245
2186
        self.url = url
2246
2187
 
2563
2504
        BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2564
2505
 
2565
2506
 
2566
 
class UnsyncedBranches(BzrDirError):
2567
 
 
2568
 
    _fmt = ("'%(display_url)s' is not in sync with %(target_url)s.  See"
2569
 
            " bzr help sync-for-reconfigure.")
2570
 
 
2571
 
    def __init__(self, bzrdir, target_branch):
2572
 
        BzrDirError.__init__(self, bzrdir)
2573
 
        import bzrlib.urlutils as urlutils
2574
 
        self.target_url = urlutils.unescape_for_display(target_branch.base,
2575
 
                                                        'ascii')
2576
 
 
2577
 
 
2578
2507
class AlreadyBranch(BzrDirError):
2579
2508
 
2580
2509
    _fmt = "'%(display_url)s' is already a branch."
2595
2524
    _fmt = "'%(display_url)s' is already a lightweight checkout."
2596
2525
 
2597
2526
 
2598
 
class AlreadyUsingShared(BzrDirError):
2599
 
 
2600
 
    _fmt = "'%(display_url)s' is already using a shared repository."
2601
 
 
2602
 
 
2603
 
class AlreadyStandalone(BzrDirError):
2604
 
 
2605
 
    _fmt = "'%(display_url)s' is already standalone."
2606
 
 
2607
 
 
2608
2527
class ReconfigurationNotSupported(BzrDirError):
2609
2528
 
2610
2529
    _fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2663
2582
        self.timezone = timezone
2664
2583
 
2665
2584
 
2666
 
class CommandAvailableInPlugin(StandardError):
2667
 
    
2668
 
    internal_error = False
2669
 
 
2670
 
    def __init__(self, cmd_name, plugin_metadata, provider):
2671
 
        
2672
 
        self.plugin_metadata = plugin_metadata
2673
 
        self.cmd_name = cmd_name
2674
 
        self.provider = provider
2675
 
 
2676
 
    def __str__(self):
2677
 
 
2678
 
        _fmt = ('"%s" is not a standard bzr command. \n' 
2679
 
                'However, the following official plugin provides this command: %s\n'
2680
 
                'You can install it by going to: %s'
2681
 
                % (self.cmd_name, self.plugin_metadata['name'], 
2682
 
                    self.plugin_metadata['url']))
2683
 
 
2684
 
        return _fmt
2685
 
 
2686
 
 
2687
 
class NoPluginAvailable(BzrError):
2688
 
    pass    
2689
 
 
2690
 
 
2691
 
class NotATerminal(BzrError):
2692
 
 
2693
 
    _fmt = 'Unable to ask for a password without real terminal.'
2694
 
 
2695
 
 
2696
2585
class UnableEncodePath(BzrError):
2697
2586
 
2698
2587
    _fmt = ('Unable to encode %(kind)s path %(path)r in '