268
268
tree2 = self.make_to_branch_and_tree('2')
269
269
tree1 = self.get_tree_no_parents_abc_content(tree1)
270
270
tree2 = self.get_to_tree_no_parents_abc_content_2(tree2)
271
d = self.intertree_class(tree1, tree2).compare()
272
self.assertEqual([('a-id', 'a', True, None, None, None, None, None)],
271
root_id = tree1.inventory.root.file_id
272
self.assertEqual([('a-id', 'a', True, (True, True),
273
(root_id, root_id), ('a', 'a'),
274
('file', 'file'), (False, False))],
273
275
list(tree2.iter_changes(tree1)))
275
277
def test_meta_modification(self):
277
279
tree2 = self.make_to_branch_and_tree('2')
278
280
tree1 = self.get_tree_no_parents_abc_content(tree1)
279
281
tree2 = self.get_to_tree_no_parents_abc_content_3(tree2)
280
self.assertEqual([('c-id', 'b/c', False, None, None, None, None,
282
self.assertEqual([('c-id', 'b/c', False, (True, True),
283
('b-id', 'b-id'), ('c', 'c'), ('file', 'file'),
281
284
(False, True))], list(tree2.iter_changes(tree1)))
283
286
def test_file_rename(self):
285
288
tree2 = self.make_to_branch_and_tree('2')
286
289
tree1 = self.get_tree_no_parents_abc_content(tree1)
287
290
tree2 = self.get_to_tree_no_parents_abc_content_4(tree2)
288
self.assertEqual([('a-id', 'd', False, None, None, ('a', 'd'), None,
289
None)], list(tree2.iter_changes(tree1)))
291
root_id = tree1.inventory.root.file_id
292
self.assertEqual([('a-id', 'd', False, (True, True),
293
(root_id, root_id), ('a', 'd'), ('file', 'file'),
294
(False, False))], list(tree2.iter_changes(tree1)))
291
296
def test_file_rename_and_modification(self):
292
297
tree1 = self.make_branch_and_tree('1')
293
298
tree2 = self.make_to_branch_and_tree('2')
294
299
tree1 = self.get_tree_no_parents_abc_content(tree1)
295
300
tree2 = self.get_to_tree_no_parents_abc_content_5(tree2)
296
self.assertEqual([('a-id', 'd', True, None, None, ('a', 'd'), None,
297
None)], list(tree2.iter_changes(tree1)))
301
root_id = tree1.inventory.root.file_id
302
self.assertEqual([('a-id', 'd', True, (True, True),
303
(root_id, root_id), ('a', 'd'), ('file', 'file'),
304
(False, False))], list(tree2.iter_changes(tree1)))
299
306
def test_file_rename_and_meta_modification(self):
300
307
tree1 = self.make_branch_and_tree('1')
301
308
tree2 = self.make_to_branch_and_tree('2')
302
309
tree1 = self.get_tree_no_parents_abc_content(tree1)
303
310
tree2 = self.get_to_tree_no_parents_abc_content_6(tree2)
304
self.assertEqual([('c-id', 'e', False, None,
305
('b-id', tree1.get_root_id()), ('c', 'e'), None,
311
root_id = tree1.inventory.root.file_id
312
self.assertEqual([('c-id', 'e', False, (True, True),
313
('b-id', root_id), ('c', 'e'), ('file', 'file'),
306
314
(False, True))], list(tree2.iter_changes(tree1)))
308
316
def test_unchanged_with_renames_and_modifications(self):
311
319
tree2 = self.make_to_branch_and_tree('2')
312
320
tree1 = self.get_tree_no_parents_abc_content(tree1)
313
321
tree2 = self.get_to_tree_no_parents_abc_content_5(tree2)
315
(tree1.get_root_id(), '', False, None, None, None, None, None),
316
('b-id', 'b', False, None, None, None, None, None),
317
('a-id', 'd', True, None, None, ('a', 'd'), None, None),
318
('c-id', 'b/c', False, None, None, None, None, None)],
319
list(tree2.iter_changes(tree1, include_unchanged=True)))
322
root_id = tree1.inventory.root.file_id
323
def unchanged(file_id):
324
entry = tree1.inventory[file_id]
325
parent = entry.parent_id
328
executable = entry.executable
329
return (file_id, tree1.id2path(file_id), False, (True, True),
330
(parent, parent), (name, name), (kind, kind),
331
(executable, executable))
332
self.assertEqual([unchanged(root_id), unchanged('b-id'),
333
('a-id', 'd', True, (True, True),
334
(root_id, root_id), ('a', 'd'), ('file', 'file'),
335
(False, False)), unchanged('c-id')],
336
list(tree2.iter_changes(tree1,
337
include_unchanged=True)))