~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2007-07-13 02:23:34 UTC
  • mfrom: (2592 +trunk) (2612 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2614.
  • Revision ID: john@arbash-meinel.com-20070713022334-qb6ewgo6v4251yd9
[merge] bzr.dev 2612

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,