コード例 #1
0
    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'], ['a-id', 'b-id', 'c-id'])
        tree.commit('first', rev_id='first-rev-id')

        tree.rename_one('b', 'c/d')
        self.build_tree(['tree/b'])
        tree.add(['b'], ['b2-id'])
        tree.commit('second', rev_id='second-rev-id')

        tree.rename_one('a', 'c/e')
        self.build_tree(['tree/a'])
        tree.add(['a'], ['a2-id'])

        basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree)
        first_tree = tree.branch.repository.revision_tree('first-rev-id')
        walker = _mod_tree.MultiWalker(tree, [basis_tree, first_tree])

        iterator = walker.iter_all()
        self.assertWalkerNext(u'', root_id, True, [u'', u''], iterator)
        self.assertWalkerNext(u'a', 'a2-id', True, [None, None], iterator)
        self.assertWalkerNext(u'b', 'b2-id', True, [u'b', None], iterator)
        self.assertWalkerNext(u'c', 'c-id', True, [u'c', u'c'], iterator)
        self.assertWalkerNext(u'c/d', 'b-id', True, [u'c/d', u'b'], iterator)
        self.assertWalkerNext(u'c/e', 'a-id', True, [u'a', u'a'], iterator)
        self.assertRaises(StopIteration, iterator.next)
コード例 #2
0
    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'],
                 ['a-id', 'b-id', 'c-id', 'd-id', 'e-id'])
        tree.commit('first', rev_id='first-rev-id')
        tree.remove(['e'])
        tree.commit('second', rev_id='second-rev-id')
        tree.remove(['d'])
        tree.commit('third', rev_id='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('first-rev-id')
        second_tree = tree.branch.repository.revision_tree('second-rev-id')
        walker = _mod_tree.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', 'a-id', True, [u'a', u'a', u'a'], iterator)
        self.assertWalkerNext(u'b', 'b-id', True, [u'b', u'b', u'b'], iterator)
        self.assertWalkerNext(u'c', 'c-id', False, [u'c', u'c', u'c'], iterator)
        self.assertWalkerNext(u'd', 'd-id', False, [None, u'd', u'd'], iterator)
        self.assertWalkerNext(u'e', 'e-id', False, [None, u'e', None], iterator)
        self.assertRaises(StopIteration, iterator.next)
コード例 #3
0
    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'], ['a-id', 'b-id', 'd-id'])
        tree.commit('first', rev_id='first-rev-id')
        tree.remove(['d'])

        basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree)
        walker = _mod_tree.MultiWalker(tree, [basis_tree])
        iterator = walker.iter_all()
        self.assertWalkerNext(u'', root_id, True, [u''], iterator)
        self.assertWalkerNext(u'a', 'a-id', True, [u'a'], iterator)
        self.assertWalkerNext(u'b', 'b-id', True, [u'b'], iterator)
        self.assertWalkerNext(u'd', 'd-id', False, [u'd'], iterator)
        self.assertRaises(StopIteration, iterator.next)
コード例 #4
0
    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'], ['a-id', 'b-id', 'c-id'])

        tree.commit('first', rev_id='first-rev-id')

        basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree)

        walker = _mod_tree.MultiWalker(tree, [basis_tree])
        iterator = walker.iter_all()
        self.assertWalkerNext(u'', root_id, True, [u''], iterator)
        self.assertWalkerNext(u'a', 'a-id', True, [u'a'], iterator)
        self.assertWalkerNext(u'b', 'b-id', True, [u'b'], iterator)
        self.assertWalkerNext(u'b/c', 'c-id', True, [u'b/c'], iterator)
        self.assertRaises(StopIteration, iterator.next)
コード例 #5
0
    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'], ['a-id', 'c-id', 'd-id'])
        tree.commit('first', rev_id='first-rev-id')
        tree.rename_one('d', 'b')

        basis_tree, root_id = self.lock_and_get_basis_and_root_id(tree)

        walker = _mod_tree.MultiWalker(tree, [basis_tree])
        iterator = walker.iter_all()
        self.assertWalkerNext(u'', root_id, True, [u''], iterator)
        self.assertWalkerNext(u'a', 'a-id', True, [u'a'], iterator)
        self.assertWalkerNext(u'b', 'd-id', True, [u'd'], iterator)
        self.assertWalkerNext(u'c', 'c-id', True, [u'c'], iterator)
        self.assertRaises(StopIteration, iterator.next)