~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revision.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-11 00:23:23 UTC
  • mfrom: (2070 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20061011002323-82ba88c293d7caff
[merge] bzr.dev 2070

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# (C) 2005 Canonical Ltd
2
 
 
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
import os
19
19
import warnings
20
20
 
 
21
from bzrlib import (
 
22
    revision,
 
23
    )
21
24
from bzrlib.branch import Branch
22
25
from bzrlib.errors import NoSuchRevision
23
26
from bzrlib.graph import Graph
25
28
                             common_ancestor,
26
29
                             is_ancestor, MultipleRevisionSources,
27
30
                             NULL_REVISION)
28
 
from bzrlib.tests import TestCaseWithTransport
 
31
from bzrlib.tests import TestCase, TestCaseWithTransport
29
32
from bzrlib.trace import mutter
30
33
from bzrlib.workingtree import WorkingTree
31
34
 
67
70
    tree2.commit("Commit four", rev_id="b@u-0-3")
68
71
    tree2.commit("Commit five", rev_id="b@u-0-4")
69
72
    revisions_2 = br2.revision_history()
 
73
    self.assertEquals(revisions_2[-1], 'b@u-0-4')
70
74
    
71
 
    br1.fetch(br2)
72
 
    tree1.add_pending_merge(revisions_2[4])
73
 
    self.assertEquals(revisions_2[4], 'b@u-0-4')
 
75
    tree1.merge_from_branch(br2)
74
76
    tree1.commit("Commit six", rev_id="a@u-0-3")
75
77
    tree1.commit("Commit seven", rev_id="a@u-0-4")
76
78
    tree2.commit("Commit eight", rev_id="b@u-0-5")
 
79
    self.assertEquals(br2.revision_history()[-1], 'b@u-0-5')
77
80
    
78
 
    br1.fetch(br2)
79
 
    tree1.add_pending_merge(br2.revision_history()[5])
 
81
    tree1.merge_from_branch(br2)
80
82
    tree1.commit("Commit nine", rev_id="a@u-0-5")
81
 
    # DO NOT FETCH HERE - we WANT a GHOST.
82
 
    # br2.fetch(br1)
83
 
    tree2.add_pending_merge(br1.revision_history()[4])
 
83
    # DO NOT MERGE HERE - we WANT a GHOST.
 
84
    tree2.add_parent_tree_id(br1.revision_history()[4])
84
85
    tree2.commit("Commit ten - ghost merge", rev_id="b@u-0-6")
85
86
    
86
87
    return br1, br2
155
156
        wt2.commit("Commit twelve", rev_id="b@u-0-8")
156
157
        wt2.commit("Commit thirtteen", rev_id="b@u-0-9")
157
158
 
158
 
        self.br1.fetch(self.br2)
159
 
        wt1.add_pending_merge(self.br2.revision_history()[6])
 
159
        wt1.merge_from_branch(self.br2)
160
160
        wt1.commit("Commit fourtten", rev_id="a@u-0-6")
161
161
 
162
 
        self.br2.fetch(self.br1)
163
 
        wt2.add_pending_merge(self.br1.revision_history()[6])
 
162
        wt2.merge_from_branch(self.br1)
164
163
        wt2.commit("Commit fifteen", rev_id="b@u-0-10")
165
164
 
166
165
        from bzrlib.revision import MultipleRevisionSources
235
234
        """
236
235
        br1, br2 = make_branches(self)
237
236
        source = MultipleRevisionSources(br1.repository, br2.repository)
238
 
        combined_1 = combined_graph(br1.last_revision(), 
 
237
        combined_1 = combined_graph(br1.last_revision(),
239
238
                                    br2.last_revision(), source)
240
239
        combined_2 = combined_graph(br2.last_revision(),
241
240
                                    br1.last_revision(), source)
288
287
        # in repo 2, which has A, the revision_graph()
289
288
        # should return A and B both.
290
289
        tree_1 = self.make_branch_and_tree('1')
291
 
        tree_1.add_pending_merge('A')
 
290
        tree_1.set_parent_ids(['A'], allow_leftmost_as_ghost=True)
292
291
        tree_1.commit('foo', rev_id='B', allow_pointless=True)
293
292
        tree_2 = self.make_branch_and_tree('2')
294
293
        tree_2.commit('bar', rev_id='A', allow_pointless=True)