~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_ancestry.py

  • Committer: Robert Collins
  • Date: 2005-09-27 07:24:40 UTC
  • mfrom: (1185.1.41)
  • Revision ID: robertc@robertcollins.net-20050927072440-1bf4d99c3e1db5b3
pair programming worx... merge integration and weave

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from bzrlib.selftest import TestCase, TestCaseInTempDir
23
23
from bzrlib.branch import Branch
 
24
from bzrlib.revision import is_ancestor
24
25
 
25
26
 
26
27
class TestAncestry(TestCaseInTempDir):
 
28
 
27
29
    def test_straightline_ancestry(self):
28
30
        """Test ancestry file when just committing."""
29
 
        b = Branch('.', init=True)
 
31
        b = Branch.initialize('.')
30
32
 
31
33
        b.commit(message='one',
32
34
                 allow_pointless=True,
38
40
 
39
41
        ancs = b.get_ancestry('tester@foo--2')
40
42
 
 
43
    def test_none_is_always_an_ancestor(self):
 
44
        b = Branch.initialize('.')
 
45
        # note this is tested before any commits are done.
 
46
        self.assertEqual(True, is_ancestor(None, None, b))
 
47
        b.commit(message='one',
 
48
                 allow_pointless=True,
 
49
                 rev_id='tester@foo--1')
 
50
        self.assertEqual(True, is_ancestor(None, None, b))
 
51
        self.assertEqual(True, is_ancestor('tester@foo--1', None, b))
 
52
        self.assertEqual(False, is_ancestor(None, 'tester@foo--1', b))
41
53
 
42
54
 
43
55
# TODO: check that ancestry is updated to include indirectly merged revisions
44
 
        
45
 
        
46
 
 
47
 
if __name__ == '__main__':
48
 
    import unittest
49
 
    sys.exit(unittest.main())