~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_dpush.py

  • Committer: Martin Pool
  • Date: 2010-04-21 11:27:04 UTC
  • mto: This revision was merged to the branch mainline in revision 5189.
  • Revision ID: mbp@canonical.com-20100421112704-zijso22b6pdevrxy
Simplify various code to use user_url

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    )
30
30
from bzrlib.tests import (
31
31
    blackbox,
32
 
    script,
33
32
    test_foreign,
34
33
    )
35
34
from bzrlib.tests.blackbox import test_push
59
58
    return result
60
59
 
61
60
 
62
 
class TestDpush(tests.TestCaseWithTransport):
 
61
class TestDpush(blackbox.ExternalBase):
63
62
 
64
63
    def setUp(self):
65
64
        super(TestDpush, self).setUp()
87
86
        self.build_tree(("dc/foo", "blaaaa"))
88
87
        dc.open_workingtree().commit('msg')
89
88
 
90
 
        script.run_script(self, """
91
 
            $ bzr dpush -d dc d
92
 
            2>Pushed up to revision 2.
93
 
            $ bzr status dc
94
 
            """)
 
89
        output, error = self.run_bzr("dpush -d dc d")
 
90
        self.assertEquals(error, "Pushed up to revision 2.\n")
 
91
        self.check_output("", "status dc")
95
92
 
96
93
    def test_dpush_new(self):
97
94
        b = self.make_dummy_builder('d').get_branch()
102
99
        dc_tree.add("foofile")
103
100
        dc_tree.commit("msg")
104
101
 
105
 
        script.run_script(self, '''
106
 
            $ bzr dpush -d dc d
107
 
            $ bzr revno dc
108
 
            2
109
 
            $ bzr status dc
110
 
            ''')
 
102
        self.check_output("", "dpush -d dc d")
 
103
        self.check_output("2\n", "revno dc")
 
104
        self.check_output("", "status dc")
111
105
 
112
106
    def test_dpush_wt_diff(self):
113
107
        b = self.make_dummy_builder('d').get_branch()
119
113
        newrevid = dc_tree.commit('msg')
120
114
 
121
115
        self.build_tree_contents([("dc/foofile", "blaaaal")])
122
 
        script.run_script(self, '''
123
 
            $ bzr dpush -d dc d --no-strict
124
 
            ''')
 
116
        self.check_output("", "dpush -d dc d --no-strict")
125
117
        self.assertFileEqual("blaaaal", "dc/foofile")
126
118
        # if the dummy vcs wasn't that dummy we could uncomment the line below
127
119
        # self.assertFileEqual("blaaaa", "d/foofile")
128
 
        script.run_script(self, '''
129
 
            $ bzr status dc
130
 
            modified:
131
 
              foofile
132
 
            ''')
 
120
        self.check_output('modified:\n  foofile\n', "status dc")
133
121
 
134
122
    def test_diverged(self):
135
123
        builder = self.make_dummy_builder('d')
165
153
        conf.set_user_option('dpush_strict', value)
166
154
 
167
155
    _default_command = ['dpush', '../to']
 
156
    _default_pushed_revid = False # Doesn't aplly for dpush
 
157
 
 
158
    def assertPushSucceeds(self, args, pushed_revid=None, with_warning=False):
 
159
        if with_warning:
 
160
            error_regexes = self._default_errors
 
161
        else:
 
162
            error_regexes = []
 
163
        self.run_bzr(self._default_command + args,
 
164
                     working_dir=self._default_wd, error_regexes=error_regexes)
 
165
        if pushed_revid is None:
 
166
            # dpush change the revids, so we need to get back to it
 
167
            branch_from = branch.Branch.open(self._default_wd)
 
168
            pushed_revid = branch_from.last_revision()
 
169
        branch_to = branch.Branch.open('to')
 
170
        repo_to = branch_to.repository
 
171
        self.assertTrue(repo_to.has_revision(pushed_revid))
 
172
        self.assertEqual(branch_to.last_revision(), pushed_revid)
 
173
 
168
174
 
169
175
 
170
176
class TestDpushStrictWithoutChanges(TestDpushStrictMixin,