~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevision.py

  • Committer: Robert Collins
  • Date: 2005-10-03 01:15:02 UTC
  • mfrom: (1092.2.28)
  • Revision ID: robertc@robertcollins.net-20051003011502-f579a509a136b774
mergeĀ fromĀ baz2bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    b..3   a..3 merges b..4
43
43
    b..4   a..4
44
44
    b..5   a..5 merges b..5
45
 
    b..6
 
45
    b..6 merges a4
46
46
 
47
47
    so A is missing b6 at the start
48
48
    and B is missing a3, a4, a5
71
71
    fetch(from_branch=br2, to_branch=br1)
72
72
    br1.add_pending_merge(br2.revision_history()[5])
73
73
    commit(br1, "Commit nine", rev_id="a@u-0-5")
74
 
    # disabled - it makes testing fetch too hard,
75
 
    # but can be easily reenabled (without the fetch
76
 
    # when GHOSTS are supported. RBC 20050928
 
74
    # DO NOT FETCH HERE - we WANT a GHOST.
77
75
    #fetch(from_branch=br1, to_branch=br2)
78
 
    #br2.add_pending_merge(br1.revision_history()[4])
79
 
    commit(br2, "Commit ten - no merge", rev_id="b@u-0-6")
80
 
 
81
 
    #fetch(from_branch=br2, to_branch=br1)
 
76
    br2.add_pending_merge(br1.revision_history()[4])
 
77
    commit(br2, "Commit ten - ghost merge", rev_id="b@u-0-6")
82
78
    
83
79
    return br1, br2
84
80
 
140
136
        ## assert not is_ancestor(revisions[3], revisions_2[3], br1)
141
137
 
142
138
 
143
 
 
144
139
class TestIntermediateRevisions(TestCaseInTempDir):
145
140
 
146
141
    def setUp(self):
249
244
                          revisions_2[4])
250
245
        fetch(from_branch=br2, to_branch=br1)
251
246
        self.assertEqual(common_ancestor(revisions[5], revisions_2[6], sources),
252
 
                          revisions_2[5])
 
247
                          revisions[4]) # revisions_2[5] is equally valid
253
248
        self.assertEqual(common_ancestor(revisions_2[6], revisions[5], sources),
254
249
                          revisions_2[5])
255
250
 
260
255
        revisions = br1.revision_history()
261
256
        revisions_2 = br2.revision_history()
262
257
        sources = MultipleRevisionSources(br1, br2)
263
 
 
264
258
        expected_ancestors_list = {revisions[3]:(0, 0), 
265
259
                                   revisions[2]:(1, 1),
266
260
                                   revisions_2[4]:(2, 1), 
273
267
            self.assertEqual(ancestors_list[key], value, 
274
268
                              "key %r, %r != %r" % (key, ancestors_list[key],
275
269
                                                    value))
276
 
 
277
270
        self.assertEqual(common_ancestor(revisions[0], revisions[0], sources),
278
271
                          revisions[0])
279
272
        self.assertEqual(common_ancestor(revisions[1], revisions[2], sources),
287
280
        self.assertEqual(common_ancestor(revisions[4], revisions_2[5], sources),
288
281
                          revisions_2[4])
289
282
        self.assertEqual(common_ancestor(revisions[5], revisions_2[6], sources),
290
 
                          revisions_2[5])
 
283
                          revisions[4]) # revisions_2[5] is equally valid
291
284
        self.assertEqual(common_ancestor(revisions_2[6], revisions[5], sources),
292
 
                          revisions_2[5])
 
285
                          revisions[4]) # revisions_2[5] is equally valid
293
286
 
294
287
    def test_combined(self):
295
288
        """combined_graph