91
91
os.chdir('overwriteme')
92
92
self.run_bzr('pull --overwrite ../a')
93
93
overwritten = Branch.open('.')
94
self.assertEqual(overwritten.revision_history(),
94
self.assertEqual(overwritten.last_revision(),
96
96
a_tree.merge_from_branch(b_tree.branch)
97
97
a_tree.commit(message="blah4", allow_pointless=True)
98
98
os.chdir('../b/subdir')
143
143
self.run_bzr('pull -r 3')
144
144
self.assertEqual(b.revno(),3)
145
145
self.run_bzr('pull -r 4')
146
self.assertEqual(a.revision_history(), b.revision_history())
146
self.assertEqual(a.last_revision(), b.last_revision())
148
148
def test_pull_tags(self):
149
149
"""Tags are updated by pull, and revisions named in those tags are
179
179
self.build_tree_contents([('a/foo', 'a third change')])
180
180
a_tree.commit(message='a third change')
182
rev_history_a = a_tree.branch.revision_history()
183
self.assertEqual(len(rev_history_a), 3)
182
self.assertEqual(a_tree.branch.last_revision_info()[0], 3)
185
184
b_tree.merge_from_branch(a_tree.branch)
186
185
b_tree.commit(message='merge')
188
self.assertEqual(len(b_tree.branch.revision_history()), 2)
187
self.assertEqual(b_tree.branch.last_revision_info()[0], 2)
191
190
self.run_bzr('pull --overwrite ../a')
192
rev_history_b = b_tree.branch.revision_history()
193
self.assertEqual(len(rev_history_b), 3)
194
self.assertEqual(rev_history_b, rev_history_a)
191
(last_revinfo_b) = b_tree.branch.last_revision_info()
192
self.assertEqual(last_revinfo_b[0], 3)
193
self.assertEqual(last_revinfo_b[1], a_tree.branch.last_revision())
196
195
def test_overwrite_children(self):
197
196
# Make sure pull --overwrite sets the revision-history
209
208
self.build_tree_contents([('a/foo', 'a third change')])
210
209
a_tree.commit(message='a third change')
212
self.assertEqual(len(a_tree.branch.revision_history()), 3)
211
self.assertEqual(a_tree.branch.last_revision_info()[0], 3)
214
213
b_tree.merge_from_branch(a_tree.branch)
215
214
b_tree.commit(message='merge')
217
self.assertEqual(len(b_tree.branch.revision_history()), 2)
216
self.assertEqual(b_tree.branch.last_revision_info()[0], 2)
219
218
self.build_tree_contents([('a/foo', 'a fourth change\n')])
220
219
a_tree.commit(message='a fourth change')
222
rev_history_a = a_tree.branch.revision_history()
223
self.assertEqual(len(rev_history_a), 4)
221
rev_info_a = a_tree.branch.last_revision_info()
222
self.assertEqual(rev_history_a[0], 4)
225
224
# With convergence, we could just pull over the
226
225
# new change, but with --overwrite, we want to switch our history
228
227
self.run_bzr('pull --overwrite ../a')
229
rev_history_b = b_tree.branch.revision_history()
230
self.assertEqual(len(rev_history_b), 4)
232
self.assertEqual(rev_history_b, rev_history_a)
228
rev_info_b = b_tree.branch.last_revision_info()
229
self.assertEqual(rev_info_b[0], 4)
230
self.assertEqual(rev_info_b, rev_info_a)
234
232
def test_pull_remember(self):
235
233
"""Pull changes from one branch to another and test parent location."""
304
302
self.assertEqual(err,
305
303
' M a\nAll changes applied successfully.\n')
307
self.assertEqualDiff(tree_a.branch.revision_history(),
308
tree_b.branch.revision_history())
305
self.assertEqualDiff(tree_a.branch.last_revision(),
306
tree_b.branch.last_revision())
310
308
testament_a = Testament.from_revision(tree_a.branch.repository,
311
309
tree_a.get_parent_ids()[0])