47
46
wt_to.add_pending_merge(branch_from.last_revision())
48
def compare_tree_fileids(self, branch, old_rev, new_rev):
49
old_tree = self.branch.repository.revision_tree(old_rev)
50
new_tree = self.branch.repository.revision_tree(new_rev)
51
delta = compare_trees(old_tree, new_tree)
53
l2 = [id for path, id, kind in delta.added] + \
54
[id for oldpath, newpath, id, kind, text_modified, \
55
meta_modified in delta.renamed] + \
56
[id for path, id, kind, text_modified, meta_modified in \
61
class TestFileIdInvolved(FileIdInvolvedBase):
50
64
super(TestFileIdInvolved, self).setUp()
51
65
# create three branches, and merge it
166
180
if len(history) < 2: return
168
182
for start in range(0,len(history)-1):
183
start_id = history[start]
169
184
for end in range(start+1,len(history)):
171
l1 = self.branch.fileid_involved_between_revs(
172
history[start], history[end])
174
old_tree = self.branch.repository.revision_tree(history[start])
175
new_tree = self.branch.repository.revision_tree(history[end])
176
delta = compare_trees(old_tree, new_tree )
178
l2 = [id for path, id, kind in delta.added] + \
179
[id for oldpath, newpath, id, kind, text_modified, \
180
meta_modified in delta.renamed] + \
181
[id for path, id, kind, text_modified, meta_modified in \
184
self.assertEquals(l1, set(l2))
185
end_id = history[end]
186
l1 = self.branch.fileid_involved_between_revs(start_id, end_id)
188
l2 = self.compare_tree_fileids(self.branch, start_id, end_id)
189
self.assertEquals(l1, l2)
192
class TestFileIdInvolvedSuperset(FileIdInvolvedBase):
195
super(TestFileIdInvolvedSuperset, self).setUp()
197
main_wt = self.make_branch_and_tree('main')
198
main_branch = main_wt.branch
199
self.build_tree(["main/a","main/b","main/c"])
201
main_wt.add(['a', 'b', 'c'], ['a-file-id-2006-01-01-abcd',
202
'b-file-id-2006-01-01-defg',
203
'c-funky<file-id> quiji%bo'])
204
main_wt.commit("Commit one", rev_id="rev-A")
206
branch2_branch = main_branch.clone("branch2")
207
os.chmod("branch2/b",0770)
208
branch2_branch.working_tree().commit("branch2, Commit one",
211
self.merge(branch2_branch, main_wt)
212
os.chmod("main/b",0660)
213
main_wt.commit("merge branch1, rev-22", rev_id="rev-G")
216
self.branch = main_branch
218
def test_fileid_involved_full_compare2(self):
219
history = self.branch.revision_history()
223
l1 = self.branch.fileid_involved_between_revs(old_rev, new_rev)
225
l2 = self.compare_tree_fileids(self.branch, old_rev, new_rev)
226
self.assertNotEqual(l2, l1)
227
self.AssertSubset(l2, l1)