~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ancestry.py

(gz) Fix test failure on alpha by correcting format string for
 gc_chk_sha1_record (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
 
18
from bzrlib.tests import TestCaseWithMemoryTransport
18
19
from bzrlib.branchbuilder import BranchBuilder
19
 
from bzrlib.tests import TestCaseWithMemoryTransport
20
 
from bzrlib.tests.matchers import MatchesAncestry
21
20
 
22
21
 
23
22
class TestAncestry(TestCaseWithMemoryTransport):
24
23
 
 
24
    def assertAncestryEqual(self, expected, revision_id, branch):
 
25
        """Assert that the ancestry of revision_id in branch is as expected."""
 
26
        ancestry = branch.repository.get_ancestry(revision_id)
 
27
        self.assertEqual(expected, ancestry)
 
28
 
25
29
    def test_straightline_ancestry(self):
26
30
        """Test ancestry file when just committing."""
27
31
        builder = BranchBuilder(self.get_transport())
28
32
        rev_id_one = builder.build_commit()
29
33
        rev_id_two = builder.build_commit()
30
34
        branch = builder.get_branch()
31
 
        self.assertThat([rev_id_one, rev_id_two],
32
 
            MatchesAncestry(branch.repository, rev_id_two))
33
 
        self.assertThat([rev_id_one],
34
 
            MatchesAncestry(branch.repository, rev_id_one))
 
35
        self.assertAncestryEqual([None, rev_id_one, rev_id_two],
 
36
            rev_id_two, branch)
 
37
        self.assertAncestryEqual([None, rev_id_one], rev_id_one, branch)
35
38
 
36
39
# TODO: check that ancestry is updated to include indirectly merged revisions