~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revision.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-09 19:25:42 UTC
  • mto: (5777.5.1 inventoryworkingtree)
  • mto: This revision was merged to the branch mainline in revision 5781.
  • Revision ID: jelmer@samba.org-20110409192542-8bbedp36s7nj928e
Split InventoryTree out of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    )
28
28
from bzrlib.revision import NULL_REVISION
29
29
from bzrlib.tests import TestCase, TestCaseWithTransport
30
 
from bzrlib.tests.matchers import MatchesAncestry
 
30
from bzrlib.trace import mutter
31
31
 
32
32
# We're allowed to test deprecated interfaces
33
33
warnings.filterwarnings('ignore',
66
66
    br2 = tree2.branch
67
67
    tree2.commit("Commit four", rev_id="b@u-0-3")
68
68
    tree2.commit("Commit five", rev_id="b@u-0-4")
69
 
    self.assertEquals(br2.last_revision(), 'b@u-0-4')
 
69
    revisions_2 = br2.revision_history()
 
70
    self.assertEquals(revisions_2[-1], 'b@u-0-4')
70
71
 
71
72
    tree1.merge_from_branch(br2)
72
73
    tree1.commit("Commit six", rev_id="a@u-0-3")
73
74
    tree1.commit("Commit seven", rev_id="a@u-0-4")
74
75
    tree2.commit("Commit eight", rev_id="b@u-0-5")
75
 
    self.assertEquals(br2.last_revision(), 'b@u-0-5')
 
76
    self.assertEquals(br2.revision_history()[-1], 'b@u-0-5')
76
77
 
77
78
    tree1.merge_from_branch(br2)
78
79
    tree1.commit("Commit nine", rev_id="a@u-0-5")
79
80
    # DO NOT MERGE HERE - we WANT a GHOST.
80
 
    br1.lock_read()
81
 
    try:
82
 
        graph = br1.repository.get_graph()
83
 
        revhistory = list(graph.iter_lefthand_ancestry(br1.last_revision(),
84
 
            [revision.NULL_REVISION]))
85
 
        revhistory.reverse()
86
 
    finally:
87
 
        br1.unlock()
88
 
    tree2.add_parent_tree_id(revhistory[4])
 
81
    tree2.add_parent_tree_id(br1.revision_history()[4])
89
82
    tree2.commit("Commit ten - ghost merge", rev_id="b@u-0-6")
90
83
 
91
84
    return br1, br2
111
104
             ('a@u-0-5', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2', 'a@u-0-3', 'a@u-0-4',
112
105
                          'b@u-0-3', 'b@u-0-4',
113
106
                          'b@u-0-5', 'a@u-0-5']),
114
 
             ('b@u-0-6', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2', 'a@u-0-4',
 
107
             ('b@u-0-6', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2',
115
108
                          'b@u-0-3', 'b@u-0-4',
116
109
                          'b@u-0-5', 'b@u-0-6']),
117
110
             ]
123
116
                    continue
124
117
                if rev_id in br2_only and not branch is br2:
125
118
                    continue
126
 
                self.assertThat(anc,
127
 
                    MatchesAncestry(branch.repository, rev_id))
 
119
                mutter('ancestry of {%s}: %r',
 
120
                       rev_id, branch.repository.get_ancestry(rev_id))
 
121
                result = sorted(branch.repository.get_ancestry(rev_id))
 
122
                self.assertEquals(result, [None] + sorted(anc))
128
123
 
129
124
 
130
125
class TestIntermediateRevisions(TestCaseWithTransport):