def test_different_file_id_in_others(self): tree = self.make_branch_and_tree('tree') self.build_tree(['tree/a', 'tree/b', 'tree/c/']) tree.add(['a', 'b', 'c'], [b'a-id', b'b-id', b'c-id']) tree.commit('first', rev_id=b'first-rev-id') tree.rename_one('b', 'c/d') self.build_tree(['tree/b']) tree.add(['b'], [b'b2-id']) tree.commit('second', rev_id=b'second-rev-id') tree.rename_one('a', 'c/e') self.build_tree(['tree/a']) tree.add(['a'], [b'a2-id']) basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree) first_tree = tree.branch.repository.revision_tree(b'first-rev-id') walker = multiwalker.MultiWalker(tree, [basis_tree, first_tree]) iterator = walker.iter_all() self.assertWalkerNext(u'', root_id, True, [u'', u''], iterator) self.assertWalkerNext(u'a', b'a2-id', True, [None, None], iterator) self.assertWalkerNext(u'b', b'b2-id', True, [u'b', None], iterator) self.assertWalkerNext(u'c', b'c-id', True, [u'c', u'c'], iterator) self.assertWalkerNext(u'c/d', b'b-id', True, [u'c/d', u'b'], iterator) self.assertWalkerNext(u'c/e', b'a-id', True, [u'a', u'a'], iterator) self.assertRaises(StopIteration, next, iterator)
def test_others_extra_at_end(self): tree = self.make_branch_and_tree('tree') self.build_tree(['tree/a', 'tree/b', 'tree/c', 'tree/d', 'tree/e']) tree.add(['a', 'b', 'c', 'd', 'e'], [b'a-id', b'b-id', b'c-id', b'd-id', b'e-id']) tree.commit('first', rev_id=b'first-rev-id') tree.remove(['e']) tree.commit('second', rev_id=b'second-rev-id') tree.remove(['d']) tree.commit('third', rev_id=b'third-rev-id') tree.remove(['c']) basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree) first_tree = tree.branch.repository.revision_tree(b'first-rev-id') second_tree = tree.branch.repository.revision_tree(b'second-rev-id') walker = multiwalker.MultiWalker( tree, [basis_tree, first_tree, second_tree]) iterator = walker.iter_all() self.assertWalkerNext(u'', root_id, True, [u'', u'', u''], iterator) self.assertWalkerNext(u'a', b'a-id', True, [u'a', u'a', u'a'], iterator) self.assertWalkerNext(u'b', b'b-id', True, [u'b', u'b', u'b'], iterator) self.assertWalkerNext(u'c', b'c-id', False, [u'c', u'c', u'c'], iterator) self.assertWalkerNext(u'd', b'd-id', False, [None, u'd', u'd'], iterator) self.assertWalkerNext(u'e', b'e-id', False, [None, u'e', None], iterator) self.assertRaises(StopIteration, next, iterator)
def test_other_extra_at_end(self): tree = self.make_branch_and_tree('tree') self.build_tree(['tree/a', 'tree/b', 'tree/d']) tree.add(['a', 'b', 'd'], [b'a-id', b'b-id', b'd-id']) tree.commit('first', rev_id=b'first-rev-id') tree.remove(['d']) basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree) walker = multiwalker.MultiWalker(tree, [basis_tree]) iterator = walker.iter_all() self.assertWalkerNext(u'', root_id, True, [u''], iterator) self.assertWalkerNext(u'a', b'a-id', True, [u'a'], iterator) self.assertWalkerNext(u'b', b'b-id', True, [u'b'], iterator) self.assertWalkerNext(u'd', b'd-id', False, [u'd'], iterator) self.assertRaises(StopIteration, next, iterator)
def test_simple_stepping(self): tree = self.make_branch_and_tree('tree') self.build_tree(['tree/a', 'tree/b/', 'tree/b/c']) tree.add(['a', 'b', 'b/c'], [b'a-id', b'b-id', b'c-id']) tree.commit('first', rev_id=b'first-rev-id') basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree) walker = multiwalker.MultiWalker(tree, [basis_tree]) iterator = walker.iter_all() self.assertWalkerNext(u'', root_id, True, [u''], iterator) self.assertWalkerNext(u'a', b'a-id', True, [u'a'], iterator) self.assertWalkerNext(u'b', b'b-id', True, [u'b'], iterator) self.assertWalkerNext(u'b/c', b'c-id', True, [u'b/c'], iterator) self.assertRaises(StopIteration, next, iterator)
def test_master_renamed_to_earlier(self): """The record is still present, it just shows up early.""" tree = self.make_branch_and_tree('tree') self.build_tree(['tree/a', 'tree/c', 'tree/d']) tree.add(['a', 'c', 'd'], [b'a-id', b'c-id', b'd-id']) tree.commit('first', rev_id=b'first-rev-id') tree.rename_one('d', 'b') basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree) walker = multiwalker.MultiWalker(tree, [basis_tree]) iterator = walker.iter_all() self.assertWalkerNext(u'', root_id, True, [u''], iterator) self.assertWalkerNext(u'a', b'a-id', True, [u'a'], iterator) self.assertWalkerNext(u'b', b'd-id', True, [u'd'], iterator) self.assertWalkerNext(u'c', b'c-id', True, [u'c'], iterator) self.assertRaises(StopIteration, next, iterator)