~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ancestry.py

  • Committer: Jelmer Vernooij
  • Date: 2011-06-16 15:29:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5987.
  • Revision ID: jelmer@samba.org-20110616152910-g33fj0rbpngw9r7j
Use matchers.

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.branchbuilder import BranchBuilder
18
19
from bzrlib.tests import TestCaseWithMemoryTransport
19
 
from bzrlib.branchbuilder import BranchBuilder
 
20
from bzrlib.tests.matchers import MatchesAncestry
20
21
 
21
22
 
22
23
class TestAncestry(TestCaseWithMemoryTransport):
23
24
 
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
 
 
29
25
    def test_straightline_ancestry(self):
30
26
        """Test ancestry file when just committing."""
31
27
        builder = BranchBuilder(self.get_transport())
32
28
        rev_id_one = builder.build_commit()
33
29
        rev_id_two = builder.build_commit()
34
30
        branch = builder.get_branch()
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)
 
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))
38
35
 
39
36
# TODO: check that ancestry is updated to include indirectly merged revisions