19
19
from bzrlib.branch import Branch
20
20
from bzrlib.bzrdir import BzrDirFormat
21
from bzrlib.foreign import ForeignBranch, ForeignRepository
21
22
from bzrlib.repository import Repository
22
from bzrlib.foreign import ForeignBranch, ForeignRepository
23
23
from bzrlib.tests.blackbox import ExternalBase
24
from bzrlib.tests.test_foreign import DummyForeignVcsBzrDirFormat
24
from bzrlib.tests.test_foreign import DummyForeignVcsDirFormat
26
28
class TestDpush(ExternalBase):
31
BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
29
32
super(TestDpush, self).setUp()
30
BzrDirFormat.register_control_format(DummyForeignVcsBzrDirFormat)
32
34
def tearDown(self):
33
super(TestDpush, self).tearDown()
35
BzrDirFormat.unregister_control_format(DummyForeignVcsBzrDirFormat)
36
BzrDirFormat.unregister_control_format(DummyForeignVcsDirFormat)
39
super(TestDpush, self).tearDown()
39
41
def test_dpush_empty(self):
40
tree = self.make_branch_and_tree("dp", format=DummyForeignVcsBzrDirFormat)
42
tree = self.make_branch_and_tree("dp",
43
format=DummyForeignVcsDirFormat())
41
44
self.run_bzr("init --rich-root-pack dc")
43
self.run_bzr("dpush %s" % repos_url)
45
self.run_bzr("dpush -d dc dp")
45
47
def test_dpush(self):
46
tree = self.make_branch_and_tree("d", format=DummyForeignVcsBzrDirFormat)
48
tree = self.make_branch_and_tree("d", format=DummyForeignVcsDirFormat())
48
50
self.build_tree(("d/foo", "bar"))
52
self.run_bzr("branch %s dc" % repos_url)
54
self.run_bzr("branch d dc")
53
55
self.build_tree(("dc/foo", "blaaaa"))
54
56
self.run_bzr("commit -m msg dc")
55
self.run_bzr("dpush -d dc %s" % repos_url)
57
self.run_bzr("dpush -d dc d")
56
58
self.check_output("", "status dc")
58
60
def test_dpush_new(self):
59
tree = self.make_branch_and_tree("d", format=DummyForeignVcsBzrDirFormat)
61
tree = self.make_branch_and_tree("d", format=DummyForeignVcsDirFormat())
61
63
self.build_tree(("d/foo", "bar"))
65
self.run_bzr("branch %s dc" % repos_url)
67
self.run_bzr("branch d dc")
66
68
self.build_tree(("dc/foofile", "blaaaa"))
67
69
self.run_bzr("add dc/foofile")
68
70
self.run_bzr("commit -m msg dc")
69
self.run_bzr("dpush -d dc %s" % repos_url)
71
self.run_bzr("dpush -d dc d")
70
72
self.check_output("3\n", "revno dc")
71
73
self.check_output("", "status dc")
73
75
def test_dpush_wt_diff(self):
74
tree = self.make_branch_and_tree("d", format=DummyForeignVcsBzrDirFormat)
76
tree = self.make_branch_and_tree("d", format=DummyForeignVcsDirFormat())
76
78
self.build_tree(("d/foo", "bar"))
80
self.run_bzr("branch %s dc" % repos_url)
82
self.run_bzr("branch d dc")
81
83
self.build_tree({"dc/foofile": "blaaaa"})
82
84
self.run_bzr("add dc/foofile")
83
85
self.run_bzr("commit -m msg dc")
84
86
self.build_tree({"dc/foofile": "blaaaal"})
85
self.run_bzr("dpush -d dc %s" % repos_url)
87
self.run_bzr("dpush -d dc d")
86
88
self.check_output('modified:\n foofile\n', "status dc")