~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_parents.py

  • Committer: Vincent Ladeuil
  • Date: 2007-07-15 11:24:18 UTC
  • mfrom: (2617 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070715112418-9nn4n6esxv60ny4b
merge bzr.dev@1617

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
 
21
 
from bzrlib import errors, symbol_versioning
 
21
from bzrlib import (
 
22
    errors,
 
23
    revision as _mod_revision,
 
24
    symbol_versioning,
 
25
    )
22
26
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
23
27
from bzrlib.uncommit import uncommit
24
28
 
33
37
        """
34
38
        self.assertEqual(expected, tree.get_parent_ids())
35
39
        if expected == []:
36
 
            self.assertEqual(None, tree.last_revision())
 
40
            self.assertEqual(_mod_revision.NULL_REVISION,
 
41
                             _mod_revision.ensure_null(tree.last_revision()))
37
42
        else:
38
43
            self.assertEqual(expected[0], tree.last_revision())
39
44
        self.assertEqual(expected[1:],
41
46
                tree.pending_merges))
42
47
 
43
48
 
 
49
class TestGetParents(TestParents):
 
50
 
 
51
    def test_get_parents(self):
 
52
        t = self.make_branch_and_tree('.')
 
53
        self.assertEqual([], t.get_parent_ids())
 
54
 
 
55
 
44
56
class TestSetParents(TestParents):
45
57
 
46
58
    def test_set_no_parents(self):
52
64
        t.set_parent_trees([])
53
65
        self.assertConsistentParents([], t)
54
66
 
 
67
    def test_set_null_parent(self):
 
68
        t = self.make_branch_and_tree('.')
 
69
        self.assertRaises(errors.ReservedId, t.set_parent_ids, ['null:'],
 
70
                          allow_leftmost_as_ghost=True)
 
71
        self.assertRaises(errors.ReservedId, t.set_parent_trees,
 
72
                          [('null:', None)], allow_leftmost_as_ghost=True)
 
73
 
55
74
    def test_set_one_ghost_parent_rejects(self):
56
75
        t = self.make_branch_and_tree('.')
57
76
        self.assertRaises(errors.GhostRevisionUnusableHere,