/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_tsort.py

  • Committer: Aaron Bentley
  • Date: 2008-02-24 16:42:13 UTC
  • mfrom: (3234 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3235.
  • Revision ID: aaron@aaronbentley.com-20080224164213-eza1lzru5bwuwmmj
Merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
             ],
182
182
            True
183
183
            )
184
 
        
 
184
 
 
185
    def test_merge_sort_race(self):
 
186
        # A
 
187
        # |
 
188
        # B-.
 
189
        # |\ \
 
190
        # | | C
 
191
        # | |/
 
192
        # | D
 
193
        # |/
 
194
        # F
 
195
        graph = {'A': [],
 
196
                 'B': ['A'],
 
197
                 'C': ['B'],
 
198
                 'D': ['B', 'C'],
 
199
                 'F': ['B', 'D'],
 
200
                 }
 
201
        self.assertSortAndIterate(graph, 'F',
 
202
            [(0, 'F', 0, (3,), False),
 
203
             (1, 'D', 1, (2,2,1), False),
 
204
             (2, 'C', 1, (2,1,1), True), # XXX: Shouldn't it be merge_depth=2?
 
205
             (3, 'B', 0, (2,), False),
 
206
             (4, 'A', 0, (1,), True),
 
207
             ], True)
 
208
        # A
 
209
        # |
 
210
        # B-.
 
211
        # |\ \
 
212
        # | X C
 
213
        # | |/
 
214
        # | D
 
215
        # |/
 
216
        # F
 
217
        graph = {'A': [],
 
218
                 'B': ['A'],
 
219
                 'C': ['B'],
 
220
                 'X': ['B'],
 
221
                 'D': ['X', 'C'],
 
222
                 'F': ['B', 'D'],
 
223
                 }
 
224
        self.assertSortAndIterate(graph, 'F',
 
225
            [(0, 'F', 0, (3,), False),
 
226
             (1, 'D', 1, (2,1,2), False),
 
227
             (2, 'C', 2, (2,2,1), True),
 
228
             (3, 'X', 1, (2,1,1), True),
 
229
             (4, 'B', 0, (2,), False),
 
230
             (5, 'A', 0, (1,), True),
 
231
             ], True)
 
232
 
185
233
    def test_merge_depth_with_nested_merges(self):
186
234
        # the merge depth marker should reflect the depth of the revision
187
235
        # in terms of merges out from the mainline
228
276
             }.items(),
229
277
            'A',
230
278
            [(0, 'A', 0, (3,),  False),
231
 
             (1, 'B', 1, (1,2,2), False),
232
 
             (2, 'C', 1, (1,2,1), True),
 
279
             (1, 'B', 1, (1,3,2), False),
 
280
             (2, 'C', 1, (1,3,1), True),
233
281
             (3, 'D', 0, (2,), False),
234
282
             (4, 'E', 1, (1,1,2), False),
235
 
             (5, 'F', 2, (1,1,1,1,1), True),
 
283
             (5, 'F', 2, (1,2,1), True),
236
284
             (6, 'G', 1, (1,1,1), True),
237
285
             (7, 'H', 0, (1,), True),
238
286
             ],
239
287
            True
240
288
            )
241
 
 
 
289
 
 
290
    def test_dotted_revnos_with_simple_merges(self):
 
291
        # A         1
 
292
        # |\
 
293
        # B C       2, 1.1.1
 
294
        # | |\
 
295
        # D E F     3, 1.1.2, 1.2.1
 
296
        # |/ /|
 
297
        # G H I     4, 1.2.2, 1.3.1
 
298
        # |/ /
 
299
        # J K       5, 1.3.2
 
300
        # |/
 
301
        # L         6
 
302
        self.assertSortAndIterate(
 
303
            {'A': [],
 
304
             'B': ['A'],
 
305
             'C': ['A'],
 
306
             'D': ['B'],
 
307
             'E': ['C'],
 
308
             'F': ['C'],
 
309
             'G': ['D', 'E'],
 
310
             'H': ['F'],
 
311
             'I': ['F'],
 
312
             'J': ['G', 'H'],
 
313
             'K': ['I'],
 
314
             'L': ['J', 'K'],
 
315
            }.items(),
 
316
            'L',
 
317
            [(0, 'L', 0, (6,), False),
 
318
             (1, 'K', 1, (1,3,2), False),
 
319
             (2, 'I', 1, (1,3,1), True),
 
320
             (3, 'J', 0, (5,), False),
 
321
             (4, 'H', 1, (1,2,2), False),
 
322
             (5, 'F', 1, (1,2,1), True),
 
323
             (6, 'G', 0, (4,), False),
 
324
             (7, 'E', 1, (1,1,2), False),
 
325
             (8, 'C', 1, (1,1,1), True),
 
326
             (9, 'D', 0, (3,), False),
 
327
             (10, 'B', 0, (2,), False),
 
328
             (11, 'A', 0, (1,),  True),
 
329
             ],
 
330
            True
 
331
            )
 
332
        # Adding a shortcut from the first revision should not change any of
 
333
        # the existing numbers
 
334
        self.assertSortAndIterate(
 
335
            {'A': [],
 
336
             'B': ['A'],
 
337
             'C': ['A'],
 
338
             'D': ['B'],
 
339
             'E': ['C'],
 
340
             'F': ['C'],
 
341
             'G': ['D', 'E'],
 
342
             'H': ['F'],
 
343
             'I': ['F'],
 
344
             'J': ['G', 'H'],
 
345
             'K': ['I'],
 
346
             'L': ['J', 'K'],
 
347
             'M': ['A'],
 
348
             'N': ['L', 'M'],
 
349
            }.items(),
 
350
            'N',
 
351
            [(0, 'N', 0, (7,), False),
 
352
             (1, 'M', 1, (1,4,1), True),
 
353
             (2, 'L', 0, (6,), False),
 
354
             (3, 'K', 1, (1,3,2), False),
 
355
             (4, 'I', 1, (1,3,1), True),
 
356
             (5, 'J', 0, (5,), False),
 
357
             (6, 'H', 1, (1,2,2), False),
 
358
             (7, 'F', 1, (1,2,1), True),
 
359
             (8, 'G', 0, (4,), False),
 
360
             (9, 'E', 1, (1,1,2), False),
 
361
             (10, 'C', 1, (1,1,1), True),
 
362
             (11, 'D', 0, (3,), False),
 
363
             (12, 'B', 0, (2,), False),
 
364
             (13, 'A', 0, (1,),  True),
 
365
             ],
 
366
            True
 
367
            )
 
368
 
242
369
    def test_end_of_merge_not_last_revision_in_branch(self):
243
370
        # within a branch only the last revision gets an
244
371
        # end of merge marker.
311
438
             },
312
439
            'A',
313
440
            [(0, 'A', 0, (2,), False),
314
 
             (1, 'B', 1, (1,2,2), False),
315
 
             (2, 'C', 2, (1,2,1,1,1), True),
316
 
             (3, 'D', 1, (1,2,1), True),
 
441
             (1, 'B', 1, (1,3,2), False),
 
442
             (2, 'C', 2, (1,4,1), True),
 
443
             (3, 'D', 1, (1,3,1), True),
317
444
             (4, 'E', 1, (1,1,2), False),
318
 
             (5, 'F', 2, (1,1,1,1,1), True),
 
445
             (5, 'F', 2, (1,2,1), True),
319
446
             (6, 'G', 1, (1,1,1), True),
320
447
             (7, 'H', 0, (1,), True),
321
448
             ],