114
114
"""Merge brings across history from unrelated source"""
116
116
br1 = Branch.initialize('br1')
117
br1.commit(message='rev 1-1', rev_id='1-1')
118
br1.commit(message='rev 1-2', rev_id='1-2')
117
br1.working_tree().commit(message='rev 1-1', rev_id='1-1')
118
br1.working_tree().commit(message='rev 1-2', rev_id='1-2')
120
120
br2 = Branch.initialize('br2')
121
br2.commit(message='rev 2-1', rev_id='2-1')
121
br2.working_tree().commit(message='rev 2-1', rev_id='2-1')
122
122
merge(other_revision=['br1', -1], base_revision=['br1', 0],
124
124
self._check_revs_present(br2)
127
127
"""Merge brings across history from source"""
129
129
br1 = Branch.initialize('br1')
130
br1.commit(message='rev 1-1', rev_id='1-1')
130
br1.working_tree().commit(message='rev 1-1', rev_id='1-1')
131
131
copy_branch(br1, 'br2')
132
132
br2 = Branch.open('br2')
133
br1.commit(message='rev 1-2', rev_id='1-2')
134
br2.commit(message='rev 2-1', rev_id='2-1')
133
br1.working_tree().commit(message='rev 1-2', rev_id='1-2')
134
br2.working_tree().commit(message='rev 2-1', rev_id='2-1')
135
135
merge(other_revision=['br1', -1], base_revision=[None, None],
137
137
self._check_revs_present(br2)
152
152
br1 = Branch.initialize('br1')
153
153
self.build_tree_contents([('br1/file', 'original contents\n')])
154
154
br1.add(['file'], ['this-file-id'])
155
br1.commit(message='rev 1-1', rev_id='1-1')
155
br1.working_tree().commit(message='rev 1-1', rev_id='1-1')
156
156
copy_branch(br1, 'br2')
157
157
br2 = Branch.open('br2')
158
158
self.build_tree_contents([('br1/file', 'original from 1\n')])
159
br1.commit(message='rev 1-2', rev_id='1-2')
159
br1.working_tree().commit(message='rev 1-2', rev_id='1-2')
160
160
self.build_tree_contents([('br1/file', 'agreement\n')])
161
br1.commit(message='rev 1-3', rev_id='1-3')
161
br1.working_tree().commit(message='rev 1-3', rev_id='1-3')
162
162
self.build_tree_contents([('br2/file', 'contents in 2\n')])
163
br2.commit(message='rev 2-1', rev_id='2-1')
163
br2.working_tree().commit(message='rev 2-1', rev_id='2-1')
164
164
self.build_tree_contents([('br2/file', 'agreement\n')])
165
br2.commit(message='rev 2-2', rev_id='2-2')
165
br2.working_tree().commit(message='rev 2-2', rev_id='2-2')
167
167
def test_merge_fetches_file_history(self):
168
168
"""Merge brings across file histories"""
201
201
self.build_tree(("source/", "source/file", "target/"))
202
202
branch = Branch.initialize("source")
203
203
branch.add(["file"], ["id"])
204
branch.commit("added file")
204
branch.working_tree().commit("added file")
205
205
print >>open("source/file", 'w'), "blah"
206
branch.commit("changed file")
206
branch.working_tree().commit("changed file")
207
207
target = Branch.initialize("target/")
208
208
source = Branch.open(self.get_remote_url("source/"))
209
209
self.assertEqual(greedy_fetch(target, source), (2, []))