113
113
def test_smoke_update_checkout_bound_branch_local_commits(self):
114
114
# smoke test for doing an update of a checkout of a bound
115
115
# branch with local commits.
116
self.make_branch_and_tree('master')
116
master = self.make_branch_and_tree('master')
117
117
# make a bound branch
118
118
self.run_bzr('checkout', 'master', 'child')
119
# get an object form of child
120
child = WorkingTree.open('child')
120
122
self.run_bzr('checkout', '--lightweight', 'child', 'checkout')
123
# get an object form of the checkout to manipulate
124
wt = WorkingTree.open('checkout')
122
126
a_file = file('master/file', 'wt')
123
127
a_file.write('Foo')
125
self.run_bzr('add', 'master')
126
self.run_bzr('commit', '-m', 'add file', 'master')
130
master_tip = master.commit('add file')
128
132
a_file = file('child/file_b', 'wt')
129
133
a_file.write('Foo')
131
self.run_bzr('add', 'child')
132
self.run_bzr('commit', '--local', '-m', 'add file_b', 'child')
135
child.add(['file_b'])
136
child_tip = child.commit('add file_b', local=True)
134
138
a_file = file('checkout/file_c', 'wt')
135
139
a_file.write('Foo')
137
self.run_bzr('add', 'checkout')
139
143
# now, update checkout ->
140
144
# get all three files and a pending merge.
143
147
self.assertContainsRe(err, 'Updated to revision 1.\n'
144
148
'Your local commits will now show as'
145
149
' pending merges')
146
wt = WorkingTree.open('checkout')
147
self.assertNotEqual([], wt.pending_merges())
150
self.assertEqual([master_tip, child_tip], wt.get_parent_ids())
148
151
self.failUnlessExists('checkout/file')
149
152
self.failUnlessExists('checkout/file_b')
150
153
self.failUnlessExists('checkout/file_c')
179
182
os.chdir('checkout1')
180
183
self.run_bzr('merge', '../other')
182
self.assertEqual(['o2'], checkout1.pending_merges())
185
self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])
184
187
# At this point, 'commit' should fail, because we are out of date
185
188
self.run_bzr_error(["please run 'bzr update'"],
193
196
'Updated to revision 2.\n', err)
195
198
# The pending merges should still be there
196
self.assertEqual(['o2'], checkout1.pending_merges())
199
self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])