/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: Vincent Ladeuil
  • Date: 2012-01-18 14:09:19 UTC
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120118140919-rlvdrhpc0nq1lbwi
Change set/remove to require a lock for the branch config files.

This means that tests (or any plugin for that matter) do not requires an
explicit lock on the branch anymore to change a single option. This also
means the optimisation becomes "opt-in" and as such won't be as
spectacular as it may be and/or harder to get right (nothing fails
anymore).

This reduces the diff by ~300 lines.

Code/tests that were updating more than one config option is still taking
a lock to at least avoid some IOs and demonstrate the benefits through
the decreased number of hpss calls.

The duplication between BranchStack and BranchOnlyStack will be removed
once the same sharing is in place for local config files, at which point
the Stack class itself may be able to host the changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
700
700
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
701
701
 
702
702
 
703
 
class AlreadyControlDirError(PathError):
704
 
 
705
 
    _fmt = 'A control directory already exists: "%(path)s".'
706
 
 
707
 
 
708
703
class AlreadyBranchError(PathError):
709
704
 
710
705
    _fmt = 'Already a branch: "%(path)s".'
711
706
 
712
707
 
713
 
class InvalidBranchName(PathError):
714
 
 
715
 
    _fmt = "Invalid branch name: %(name)s"
716
 
 
717
 
    def __init__(self, name):
718
 
        BzrError.__init__(self)
719
 
        self.name = name
720
 
 
721
 
 
722
 
class ParentBranchExists(AlreadyBranchError):
723
 
 
724
 
    _fmt = 'Parent branch already exists: "%(path)s".'
725
 
 
726
 
 
727
708
class BranchExistsWithoutWorkingTree(PathError):
728
709
 
729
710
    _fmt = 'Directory contains a branch, but no working tree \
1686
1667
        TransportError.__init__(self, msg, orig_error=orig_error)
1687
1668
 
1688
1669
 
1689
 
class CertificateError(TransportError):
1690
 
 
1691
 
    _fmt = "Certificate error: %(error)s"
1692
 
 
1693
 
    def __init__(self, error):
1694
 
        self.error = error
1695
 
 
1696
 
 
1697
1670
class InvalidHttpRange(InvalidHttpResponse):
1698
1671
 
1699
1672
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
1770
1743
 
1771
1744
class ConfigOptionValueError(BzrError):
1772
1745
 
1773
 
    _fmt = ('Bad value "%(value)s" for option "%(name)s".\n'
1774
 
            'See ``bzr help %(name)s``')
 
1746
    _fmt = """Bad value "%(value)s" for option "%(name)s"."""
1775
1747
 
1776
1748
    def __init__(self, name, value):
1777
1749
        BzrError.__init__(self, name=name, value=value)
2777
2749
    _fmt = "No mail-to address (--mail-to) or output (-o) specified."
2778
2750
 
2779
2751
 
 
2752
class UnknownMailClient(BzrError):
 
2753
 
 
2754
    _fmt = "Unknown mail client: %(mail_client)s"
 
2755
 
 
2756
    def __init__(self, mail_client):
 
2757
        BzrError.__init__(self, mail_client=mail_client)
 
2758
 
 
2759
 
2780
2760
class MailClientNotFound(BzrError):
2781
2761
 
2782
2762
    _fmt = "Unable to find mail client with the following names:"\
2893
2873
        BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2894
2874
 
2895
2875
 
2896
 
class StoringUncommittedNotSupported(BzrError):
2897
 
 
2898
 
    _fmt = ('Branch "%(display_url)s" does not support storing uncommitted'
2899
 
            ' changes.')
2900
 
 
2901
 
    def __init__(self, branch):
2902
 
        import bzrlib.urlutils as urlutils
2903
 
        user_url = getattr(branch, "user_url", None)
2904
 
        if user_url is None:
2905
 
            display_url = str(branch)
2906
 
        else:
2907
 
            display_url = urlutils.unescape_for_display(user_url, 'ascii')
2908
 
        BzrError.__init__(self, branch=branch, display_url=display_url)
2909
 
 
2910
 
 
2911
2876
class ShelvedChanges(UncommittedChanges):
2912
2877
 
2913
2878
    _fmt = ('Working tree "%(display_url)s" has shelved changes'
3250
3215
 
3251
3216
class ExpandingUnknownOption(BzrError):
3252
3217
 
3253
 
    _fmt = 'Option "%(name)s" is not defined while expanding "%(string)s".'
 
3218
    _fmt = 'Option %(name)s is not defined while expanding "%(string)s".'
3254
3219
 
3255
3220
    def __init__(self, name, string):
3256
3221
        self.name = name
3257
3222
        self.string = string
3258
3223
 
3259
3224
 
3260
 
class IllegalOptionName(BzrError):
3261
 
 
3262
 
    _fmt = 'Option "%(name)s" is not allowed.'
3263
 
 
3264
 
    def __init__(self, name):
3265
 
        self.name = name
3266
 
 
3267
 
 
3268
3225
class NoCompatibleInter(BzrError):
3269
3226
 
3270
3227
    _fmt = ('No compatible object available for operations from %(source)r '
3363
3320
 
3364
3321
    def __init__(self, feature):
3365
3322
        self.feature = feature
3366
 
 
3367
 
 
3368
 
class ChangesAlreadyStored(BzrCommandError):
3369
 
 
3370
 
    _fmt = ('Cannot store uncommitted changes because this branch already'
3371
 
            ' stores uncommitted changes.')