/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 breezy/errors.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-30 23:53:38 UTC
  • mfrom: (6734.1.22 move-errors-more)
  • Revision ID: jelmer@jelmer.uk-20170730235338-25jy0lgifkyx796l
Merge lp:~jelmer/brz/move-errors-more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
        self.msg = msg
163
163
 
164
164
 
165
 
class DirstateCorrupt(BzrError):
166
 
 
167
 
    _fmt = "The dirstate file (%(state)s) appears to be corrupt: %(msg)s"
168
 
 
169
 
    def __init__(self, state, msg):
170
 
        BzrError.__init__(self)
171
 
        self.state = state
172
 
        self.msg = msg
173
 
 
174
 
 
175
165
class IncompatibleVersion(BzrError):
176
166
 
177
167
    _fmt = 'API %(api)s is not compatible; one of versions %(wanted)r '\
323
313
        self.not_locked = not_locked
324
314
 
325
315
 
326
 
class BadIndexFormatSignature(BzrError):
327
 
 
328
 
    _fmt = "%(value)s is not an index of type %(_type)s."
329
 
 
330
 
    def __init__(self, value, _type):
331
 
        BzrError.__init__(self)
332
 
        self.value = value
333
 
        self._type = _type
334
 
 
335
 
 
336
 
class BadIndexData(BzrError):
337
 
 
338
 
    _fmt = "Error in data for index %(value)s."
339
 
 
340
 
    def __init__(self, value):
341
 
        BzrError.__init__(self)
342
 
        self.value = value
343
 
 
344
 
 
345
 
class BadIndexDuplicateKey(BzrError):
346
 
 
347
 
    _fmt = "The key '%(key)s' is already in index '%(index)s'."
348
 
 
349
 
    def __init__(self, key, index):
350
 
        BzrError.__init__(self)
351
 
        self.key = key
352
 
        self.index = index
353
 
 
354
 
 
355
 
class BadIndexKey(BzrError):
356
 
 
357
 
    _fmt = "The key '%(key)s' is not a valid key."
358
 
 
359
 
    def __init__(self, key):
360
 
        BzrError.__init__(self)
361
 
        self.key = key
362
 
 
363
 
 
364
 
class BadIndexOptions(BzrError):
365
 
 
366
 
    _fmt = "Could not parse options for index %(value)s."
367
 
 
368
 
    def __init__(self, value):
369
 
        BzrError.__init__(self)
370
 
        self.value = value
371
 
 
372
 
 
373
 
class BadIndexValue(BzrError):
374
 
 
375
 
    _fmt = "The value '%(value)s' is not a valid value."
376
 
 
377
 
    def __init__(self, value):
378
 
        BzrError.__init__(self)
379
 
        self.value = value
380
 
 
381
 
 
382
316
class StrictCommitFailed(BzrError):
383
317
 
384
318
    _fmt = "Commit refused because there are unknown files in the tree"
482
416
        self.key = key
483
417
 
484
418
 
485
 
class UnknownHook(BzrError):
486
 
 
487
 
    _fmt = "The %(type)s hook '%(hook)s' is unknown in this version of breezy."
488
 
 
489
 
    def __init__(self, hook_type, hook_name):
490
 
        BzrError.__init__(self)
491
 
        self.type = hook_type
492
 
        self.hook = hook_name
493
 
 
494
 
 
495
419
class UnsupportedProtocol(PathError):
496
420
 
497
421
    _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s'
500
424
        PathError.__init__(self, url, extra=extra)
501
425
 
502
426
 
503
 
class UnstackableBranchFormat(BzrError):
504
 
 
505
 
    _fmt = ("The branch '%(url)s'(%(format)s) is not a stackable format. "
506
 
        "You will need to upgrade the branch to permit branch stacking.")
507
 
 
508
 
    def __init__(self, format, url):
509
 
        BzrError.__init__(self)
510
 
        self.format = format
511
 
        self.url = url
512
 
 
513
 
 
514
427
class UnstackableLocationError(BzrError):
515
428
 
516
429
    _fmt = "The branch '%(branch_url)s' cannot be stacked on '%(target_url)s'."
1018
931
        self.lock_token = lock_token
1019
932
 
1020
933
 
1021
 
class PointlessCommit(BzrError):
1022
 
 
1023
 
    _fmt = "No changes to commit"
1024
 
 
1025
 
 
1026
 
class CannotCommitSelectedFileMerge(BzrError):
1027
 
 
1028
 
    _fmt = 'Selected-file commit of merges is not supported yet:'\
1029
 
        ' files %(files_str)s'
1030
 
 
1031
 
    def __init__(self, files):
1032
 
        files_str = ', '.join(files)
1033
 
        BzrError.__init__(self, files=files, files_str=files_str)
1034
 
 
1035
 
 
1036
 
class ExcludesUnsupported(BzrError):
1037
 
 
1038
 
    _fmt = ('Excluding paths during commit is not supported by '
1039
 
            'repository at %(repository)r.')
1040
 
 
1041
 
    def __init__(self, repository):
1042
 
        BzrError.__init__(self, repository=repository)
1043
 
 
1044
 
 
1045
 
class BadCommitMessageEncoding(BzrError):
1046
 
 
1047
 
    _fmt = 'The specified commit message contains characters unsupported by '\
1048
 
        'the current encoding.'
1049
 
 
1050
 
 
1051
934
class UpgradeReadonly(BzrError):
1052
935
 
1053
936
    _fmt = "Upgrade URL cannot work with readonly URLs."
1062
945
        self.format = format
1063
946
 
1064
947
 
1065
 
class StrictCommitFailed(Exception):
1066
 
 
1067
 
    _fmt = "Commit refused because there are unknowns in the tree."
1068
 
 
1069
 
 
1070
948
class NoSuchRevision(InternalBzrError):
1071
949
 
1072
950
    _fmt = "%(branch)s has no revision %(revision)s"
1992
1870
    _fmt = "Format error in conflict listings"
1993
1871
 
1994
1872
 
1995
 
class CorruptDirstate(BzrError):
1996
 
 
1997
 
    _fmt = ("Inconsistency in dirstate file %(dirstate_path)s.\n"
1998
 
            "Error: %(description)s")
1999
 
 
2000
 
    def __init__(self, dirstate_path, description):
2001
 
        BzrError.__init__(self)
2002
 
        self.dirstate_path = dirstate_path
2003
 
        self.description = description
2004
 
 
2005
 
 
2006
1873
class CorruptRepository(BzrError):
2007
1874
 
2008
1875
    _fmt = ("An error has been detected in the repository %(repo_path)s.\n"
2492
2359
        self.reason = reason
2493
2360
 
2494
2361
 
2495
 
class BzrDirError(BzrError):
2496
 
 
2497
 
    def __init__(self, controldir):
2498
 
        from . import urlutils
2499
 
        display_url = urlutils.unescape_for_display(controldir.user_url,
2500
 
                                                    'ascii')
2501
 
        BzrError.__init__(self, controldir=controldir, display_url=display_url)
2502
 
 
2503
 
 
2504
 
class UnsyncedBranches(BzrDirError):
2505
 
 
2506
 
    _fmt = ("'%(display_url)s' is not in sync with %(target_url)s.  See"
2507
 
            " brz help sync-for-reconfigure.")
2508
 
 
2509
 
    def __init__(self, controldir, target_branch):
2510
 
        BzrError.__init__(self, controldir)
2511
 
        from . import urlutils
2512
 
        self.target_url = urlutils.unescape_for_display(target_branch.base,
2513
 
                                                        'ascii')
2514
 
 
2515
 
 
2516
 
class AlreadyBranch(BzrDirError):
2517
 
 
2518
 
    _fmt = "'%(display_url)s' is already a branch."
2519
 
 
2520
 
 
2521
 
class AlreadyTree(BzrDirError):
2522
 
 
2523
 
    _fmt = "'%(display_url)s' is already a tree."
2524
 
 
2525
 
 
2526
 
class AlreadyCheckout(BzrDirError):
2527
 
 
2528
 
    _fmt = "'%(display_url)s' is already a checkout."
2529
 
 
2530
 
 
2531
 
class AlreadyLightweightCheckout(BzrDirError):
2532
 
 
2533
 
    _fmt = "'%(display_url)s' is already a lightweight checkout."
2534
 
 
2535
 
 
2536
 
class AlreadyUsingShared(BzrDirError):
2537
 
 
2538
 
    _fmt = "'%(display_url)s' is already using a shared repository."
2539
 
 
2540
 
 
2541
 
class AlreadyStandalone(BzrDirError):
2542
 
 
2543
 
    _fmt = "'%(display_url)s' is already standalone."
2544
 
 
2545
 
 
2546
 
class AlreadyWithTrees(BzrDirError):
2547
 
 
2548
 
    _fmt = ("Shared repository '%(display_url)s' already creates "
2549
 
            "working trees.")
2550
 
 
2551
 
 
2552
 
class AlreadyWithNoTrees(BzrDirError):
2553
 
 
2554
 
    _fmt = ("Shared repository '%(display_url)s' already doesn't create "
2555
 
            "working trees.")
2556
 
 
2557
 
 
2558
 
class ReconfigurationNotSupported(BzrDirError):
2559
 
 
2560
 
    _fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2561
 
 
2562
 
 
2563
 
class NoBindLocation(BzrDirError):
2564
 
 
2565
 
    _fmt = "No location could be found to bind to at %(display_url)s."
2566
 
 
2567
 
 
2568
2362
class UncommittedChanges(BzrError):
2569
2363
 
2570
2364
    _fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2605
2399
            ' (See brz shelve --list).%(more)s')
2606
2400
 
2607
2401
 
2608
 
class MissingTemplateVariable(BzrError):
2609
 
 
2610
 
    _fmt = 'Variable {%(name)s} is not available.'
2611
 
 
2612
 
    def __init__(self, name):
2613
 
        self.name = name
2614
 
 
2615
 
 
2616
 
class NoTemplate(BzrError):
2617
 
 
2618
 
    _fmt = 'No template specified.'
2619
 
 
2620
 
 
2621
2402
class UnableCreateSymlink(BzrError):
2622
2403
 
2623
2404
    _fmt = 'Unable to create symlink %(path_str)son this platform'
2633
2414
        self.path_str = path_str
2634
2415
 
2635
2416
 
2636
 
class UnsupportedTimezoneFormat(BzrError):
2637
 
 
2638
 
    _fmt = ('Unsupported timezone format "%(timezone)s", '
2639
 
            'options are "utc", "original", "local".')
2640
 
 
2641
 
    def __init__(self, timezone):
2642
 
        self.timezone = timezone
2643
 
 
2644
 
 
2645
2417
class UnableEncodePath(BzrError):
2646
2418
 
2647
2419
    _fmt = ('Unable to encode %(kind)s path %(path)r in '
2662
2434
        BzrError.__init__(self, alias_name=alias_name)
2663
2435
 
2664
2436
 
2665
 
class DirectoryLookupFailure(BzrError):
2666
 
    """Base type for lookup errors."""
2667
 
 
2668
 
    pass
2669
 
 
2670
 
 
2671
 
class InvalidLocationAlias(DirectoryLookupFailure):
2672
 
 
2673
 
    _fmt = '"%(alias_name)s" is not a valid location alias.'
2674
 
 
2675
 
    def __init__(self, alias_name):
2676
 
        DirectoryLookupFailure.__init__(self, alias_name=alias_name)
2677
 
 
2678
 
 
2679
 
class UnsetLocationAlias(DirectoryLookupFailure):
2680
 
 
2681
 
    _fmt = 'No %(alias_name)s location assigned.'
2682
 
 
2683
 
    def __init__(self, alias_name):
2684
 
        DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
2685
 
 
2686
 
 
2687
2437
class CannotBindAddress(BzrError):
2688
2438
 
2689
2439
    _fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2694
2444
            orig_error=repr(orig_error.args))
2695
2445
 
2696
2446
 
2697
 
class UnknownRules(BzrError):
2698
 
 
2699
 
    _fmt = ('Unknown rules detected: %(unknowns_str)s.')
2700
 
 
2701
 
    def __init__(self, unknowns):
2702
 
        BzrError.__init__(self, unknowns_str=", ".join(unknowns))
2703
 
 
2704
 
 
2705
2447
class TipChangeRejected(BzrError):
2706
2448
    """A pre_change_branch_tip hook function may raise this to cleanly and
2707
2449
    explicitly abort a change to a branch tip.
2713
2455
        self.msg = msg
2714
2456
 
2715
2457
 
2716
 
class DecompressCorruption(BzrError):
2717
 
 
2718
 
    _fmt = "Corruption while decompressing repository file%(orig_error)s"
2719
 
 
2720
 
    def __init__(self, orig_error=None):
2721
 
        if orig_error is not None:
2722
 
            self.orig_error = ", %s" % (orig_error,)
2723
 
        else:
2724
 
            self.orig_error = ""
2725
 
        BzrError.__init__(self)
2726
 
 
2727
 
 
2728
2458
class JailBreak(BzrError):
2729
2459
 
2730
2460
    _fmt = "An attempt to access a url outside the server jail was made: '%(url)s'."
2738
2468
    _fmt = 'The user aborted the operation.'
2739
2469
 
2740
2470
 
2741
 
class MustHaveWorkingTree(BzrError):
2742
 
 
2743
 
    _fmt = ("Branching '%(url)s'(%(format)s) must create a working tree.")
2744
 
 
2745
 
    def __init__(self, format, url):
2746
 
        BzrError.__init__(self, format=format, url=url)
2747
 
 
2748
 
 
2749
2471
class UnresumableWriteGroup(BzrError):
2750
2472
 
2751
2473
    _fmt = ("Repository %(repository)s cannot resume write group "
2822
2544
        self.format = format
2823
2545
 
2824
2546
 
2825
 
class FeatureAlreadyRegistered(BzrError):
2826
 
 
2827
 
    _fmt = 'The feature %(feature)s has already been registered.'
2828
 
 
2829
 
    def __init__(self, feature):
2830
 
        self.feature = feature
2831
 
 
2832
 
 
2833
2547
class ChangesAlreadyStored(BzrCommandError):
2834
2548
 
2835
2549
    _fmt = ('Cannot store uncommitted changes because this branch already'