/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: 2009-06-30 15:54:23 UTC
  • mto: (4496.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4497.
  • Revision ID: v.ladeuil+lp@free.fr-20090630155423-afousrl3zrdx0he2
Fixed as per jam's review.

* tests/blackbox/test_push.py:
(load_tests): One more changes type.
(TestPushStrictMixin): Switch to using mixin, it's clearer.
Define some default values as attributes so that they can be
changed more easily.
(TestPushStrictMixin.assertPushFails,
TestPushStrictMixin.assertPushSucceeds): Use default values from
attributes.
(TestPushStrictWithChanges._out_of_sync_trees): Setup a new
context and change the default values.

* errors.py:
(OutOfDateTree, UncommittedChanges): Add a more parameter so more
details can be given.

* builtins.py:
(cmd_push.run): Add an additional check that the tree is still in
sync with its branch before pushing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2093
2093
 
2094
2094
class OutOfDateTree(BzrError):
2095
2095
 
2096
 
    _fmt = "Working tree is out of date, please run 'bzr update'."
 
2096
    _fmt = "Working tree is out of date, please run 'bzr update'.%(more)s"
2097
2097
 
2098
 
    def __init__(self, tree):
 
2098
    def __init__(self, tree, more=None):
 
2099
        if more is None:
 
2100
            more = ''
 
2101
        else:
 
2102
            more = ' ' + more
2099
2103
        BzrError.__init__(self)
2100
2104
        self.tree = tree
 
2105
        self.more = more
2101
2106
 
2102
2107
 
2103
2108
class PublicBranchOutOfDate(BzrError):
2779
2784
class UncommittedChanges(BzrError):
2780
2785
 
2781
2786
    _fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2782
 
            ' (See bzr status).')
 
2787
            ' (See bzr status).%(more)s')
2783
2788
 
2784
 
    def __init__(self, tree):
 
2789
    def __init__(self, tree, more=None):
 
2790
        if more is None:
 
2791
            more = ''
 
2792
        else:
 
2793
            more = ' ' + more
2785
2794
        import bzrlib.urlutils as urlutils
2786
2795
        display_url = urlutils.unescape_for_display(
2787
2796
            tree.bzrdir.root_transport.base, 'ascii')
2788
 
        BzrError.__init__(self, tree=tree, display_url=display_url)
 
2797
        BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2789
2798
 
2790
2799
 
2791
2800
class MissingTemplateVariable(BzrError):