/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/tests/blackbox/test_dpush.py

  • Committer: Jelmer Vernooij
  • Date: 2009-04-09 21:50:23 UTC
  • mto: This revision was merged to the branch mainline in revision 4281.
  • Revision ID: jelmer@samba.org-20090409215023-l1wqokoy35s9z8zy
Fix tests after CommitBuilder changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
 
17
18
"""Black-box tests for bzr dpush."""
18
19
 
 
20
 
19
21
import os
20
22
 
21
 
from bzrlib.branch import Branch
22
 
from bzrlib.bzrdir import BzrDirFormat
23
 
from bzrlib.foreign import ForeignBranch, ForeignRepository
24
 
from bzrlib.repository import Repository
25
 
from bzrlib.tests.blackbox import ExternalBase
26
 
from bzrlib.tests.test_foreign import DummyForeignVcsDirFormat
 
23
from bzrlib.branch import (
 
24
    Branch,
 
25
    )
 
26
from bzrlib.bzrdir import (
 
27
    BzrDirFormat,
 
28
    )
 
29
from bzrlib.foreign import (
 
30
    ForeignBranch,
 
31
    ForeignRepository,
 
32
    )
 
33
from bzrlib.repository import (
 
34
    Repository,
 
35
    )
 
36
from bzrlib.tests.blackbox import (
 
37
    ExternalBase,
 
38
    )
 
39
from bzrlib.tests.test_foreign import (
 
40
    DummyForeignVcsDirFormat,
 
41
    )
27
42
 
28
43
 
29
44
class TestDpush(ExternalBase):
50
65
    def test_dpush_native(self):
51
66
        target_tree = self.make_branch_and_tree("dp")
52
67
        source_tree = self.make_branch_and_tree("dc")
53
 
        error = self.run_bzr("dpush -d dc dp", retcode=3)[1]
 
68
        output, error = self.run_bzr("dpush -d dc dp", retcode=3)
 
69
        self.assertEquals("", output)
54
70
        self.assertContainsRe(error, 'not a foreign branch, use regular push')
55
71
 
56
72
    def test_dpush(self):
60
76
        self.build_tree(("dc/foo", "blaaaa"))
61
77
        dc.open_workingtree().commit('msg')
62
78
 
63
 
        self.run_bzr("dpush -d dc d")
 
79
        self.check_output("", "dpush -d dc d")
64
80
        self.check_output("", "status dc")
65
81
 
66
82
    def test_dpush_new(self):
67
83
        branch = self.make_dummy_builder('d').get_branch()
68
84
 
69
85
        dc = branch.bzrdir.sprout('dc', force_new_repo=True)
70
 
        self.build_tree(("dc/foofile", "blaaaa"))
 
86
        self.build_tree_contents([("dc/foofile", "blaaaa")])
71
87
        dc_tree = dc.open_workingtree()
72
88
        dc_tree.add("foofile")
73
89
        dc_tree.commit("msg")
74
90
 
75
 
        self.run_bzr("dpush -d dc d")
 
91
        self.check_output("", "dpush -d dc d")
76
92
        self.check_output("2\n", "revno dc")
77
93
        self.check_output("", "status dc")
78
94
 
86
102
        newrevid = dc_tree.commit('msg')
87
103
 
88
104
        self.build_tree_contents([("dc/foofile", "blaaaal")])
89
 
        self.run_bzr("dpush -d dc d")
 
105
        self.check_output("", "dpush -d dc d")
90
106
        self.assertFileEqual("blaaaal", "dc/foofile")
91
107
        self.check_output('modified:\n  foofile\n', "status dc")
92
108
 
104
120
        builder.build_snapshot('revid2', None,
105
121
          [('modify', ('fooid', 'blie'))])
106
122
 
107
 
        error = self.run_bzr("dpush -d dc d", retcode=3)[1]
 
123
        output, error = self.run_bzr("dpush -d dc d", retcode=3)
 
124
        self.assertEquals(output, "")
108
125
        self.assertContainsRe(error, "have diverged")