~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2007-07-11 14:58:54 UTC
  • mto: This revision was merged to the branch mainline in revision 2606.
  • Revision ID: abentley@panoramicfeedback.com-20070711145854-06486yosdvexapy1
Got all tests passing with Branch returning 'null:' for null revision

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.assertTrue(_mod_revision.is_null(tree.last_revision()))
37
41
        else:
38
42
            self.assertEqual(expected[0], tree.last_revision())
39
43
        self.assertEqual(expected[1:],
41
45
                tree.pending_merges))
42
46
 
43
47
 
 
48
class TestGetParents(TestParents):
 
49
 
 
50
    def test_get_parents(self):
 
51
        t = self.make_branch_and_tree('.')
 
52
        self.assertEqual([], t.get_parent_ids())
 
53
 
 
54
 
44
55
class TestSetParents(TestParents):
45
56
 
46
57
    def test_set_no_parents(self):
52
63
        t.set_parent_trees([])
53
64
        self.assertConsistentParents([], t)
54
65
 
 
66
    def test_set_null_parent(self):
 
67
        t = self.make_branch_and_tree('.')
 
68
        self.assertRaises(errors.ReservedId, t.set_parent_ids, ['null:'],
 
69
                          allow_leftmost_as_ghost=True)
 
70
        self.assertRaises(errors.ReservedId, t.set_parent_trees,
 
71
                          [('null:', None)], allow_leftmost_as_ghost=True)
 
72
 
55
73
    def test_set_one_ghost_parent_rejects(self):
56
74
        t = self.make_branch_and_tree('.')
57
75
        self.assertRaises(errors.GhostRevisionUnusableHere,