29
29
class TestUpdate(ExternalBase):
31
31
def test_update_standalone_trivial(self):
33
out, err = self.runbzr('update')
33
out, err = self.run_bzr('update')
34
34
self.assertEqual('Tree is up to date at revision 0.\n', err)
35
35
self.assertEqual('', out)
37
37
def test_update_standalone_trivial_with_alias_up(self):
39
out, err = self.runbzr('up')
39
out, err = self.run_bzr('up')
40
40
self.assertEqual('Tree is up to date at revision 0.\n', err)
41
41
self.assertEqual('', out)
43
43
def test_update_up_to_date_light_checkout(self):
44
44
self.make_branch_and_tree('branch')
45
self.runbzr('checkout --lightweight branch checkout')
46
out, err = self.runbzr('update checkout')
45
self.run_bzr('checkout --lightweight branch checkout')
46
out, err = self.run_bzr('update checkout')
47
47
self.assertEqual('Tree is up to date at revision 0.\n', err)
48
48
self.assertEqual('', out)
59
59
# because it currently uses the branch last-revision marker.
60
60
self.make_branch_and_tree('branch')
62
self.runbzr('checkout --lightweight branch checkout')
62
self.run_bzr('checkout --lightweight branch checkout')
63
63
self.build_tree(['checkout/file'])
64
self.runbzr('add checkout/file')
65
self.runbzr('commit -m add-file checkout')
64
self.run_bzr('add checkout/file')
65
self.run_bzr('commit -m add-file checkout')
66
66
# now branch should be out of date
67
out,err = self.runbzr('update branch')
67
out,err = self.run_bzr('update branch')
68
68
self.assertEqual('', out)
69
69
self.assertEqual('All changes applied successfully.\n'
70
70
'Updated to revision 1.\n', err)
73
73
def test_update_out_of_date_light_checkout(self):
74
74
self.make_branch_and_tree('branch')
75
75
# make two checkouts
76
self.runbzr('checkout --lightweight branch checkout')
77
self.runbzr('checkout --lightweight branch checkout2')
76
self.run_bzr('checkout --lightweight branch checkout')
77
self.run_bzr('checkout --lightweight branch checkout2')
78
78
self.build_tree(['checkout/file'])
79
self.runbzr('add checkout/file')
80
self.runbzr('commit -m add-file checkout')
79
self.run_bzr('add checkout/file')
80
self.run_bzr('commit -m add-file checkout')
81
81
# now checkout2 should be out of date
82
out,err = self.runbzr('update checkout2')
82
out,err = self.run_bzr('update checkout2')
83
83
self.assertEqual('All changes applied successfully.\n'
84
84
'Updated to revision 1.\n',
88
88
def test_update_conflicts_returns_2(self):
89
89
self.make_branch_and_tree('branch')
90
90
# make two checkouts
91
self.runbzr('checkout --lightweight branch checkout')
91
self.run_bzr('checkout --lightweight branch checkout')
92
92
self.build_tree(['checkout/file'])
93
self.runbzr('add checkout/file')
94
self.runbzr('commit -m add-file checkout')
95
self.runbzr('checkout --lightweight branch checkout2')
93
self.run_bzr('add checkout/file')
94
self.run_bzr('commit -m add-file checkout')
95
self.run_bzr('checkout --lightweight branch checkout2')
96
96
# now alter file in checkout
97
97
a_file = file('checkout/file', 'wt')
98
98
a_file.write('Foo')
100
self.runbzr('commit -m checnge-file checkout')
100
self.run_bzr('commit -m checnge-file checkout')
101
101
# now checkout2 should be out of date
102
102
# make a local change to file
103
103
a_file = file('checkout2/file', 'wt')
104
104
a_file.write('Bar')
106
out,err = self.runbzr('update checkout2', retcode=1)
106
out,err = self.run_bzr('update checkout2', retcode=1)
107
107
self.assertEqual(['1 conflicts encountered.',
108
108
'Updated to revision 2.'],
109
109
err.split('\n')[1:3])
205
205
checkout = readonly_branch.create_checkout('checkout',
206
206
lightweight=True)
207
207
tree.commit('empty commit')
208
self.runbzr(['update', 'checkout'])
208
self.run_bzr(['update', 'checkout'])