/breezy/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/trunk

« back to all changes in this revision

Viewing changes to breezy/tests/test_merge.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
            tree_a.conflicts())
227
227
 
228
228
    def test_nested_merge(self):
 
229
        self.knownFailure(
 
230
            'iter_changes doesn\'t work with changes in nested trees')
229
231
        tree = self.make_branch_and_tree('tree',
230
232
            format='development-subtree')
231
233
        sub_tree = self.make_branch_and_tree('tree/sub-tree',
371
373
 
372
374
    def test_weave_cherrypick(self):
373
375
        this_tree, other_tree = self.prepare_cherrypick()
374
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
376
        merger = _mod_merge.Merger.from_revision_ids(
375
377
            this_tree, 'rev3b', 'rev2b', other_tree.branch)
376
378
        merger.merge_type = _mod_merge.WeaveMerger
377
379
        merger.do_merge()
379
381
 
380
382
    def test_weave_cannot_reverse_cherrypick(self):
381
383
        this_tree, other_tree = self.prepare_cherrypick()
382
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
384
        merger = _mod_merge.Merger.from_revision_ids(
383
385
            this_tree, 'rev2b', 'rev3b', other_tree.branch)
384
386
        merger.merge_type = _mod_merge.WeaveMerger
385
387
        self.assertRaises(errors.CannotReverseCherrypick, merger.do_merge)
386
388
 
387
389
    def test_merge3_can_reverse_cherrypick(self):
388
390
        this_tree, other_tree = self.prepare_cherrypick()
389
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
391
        merger = _mod_merge.Merger.from_revision_ids(
390
392
            this_tree, 'rev2b', 'rev3b', other_tree.branch)
391
393
        merger.merge_type = _mod_merge.Merge3Merger
392
394
        merger.do_merge()
404
406
        this_tree.lock_write()
405
407
        self.addCleanup(this_tree.unlock)
406
408
 
407
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
409
        merger = _mod_merge.Merger.from_revision_ids(
408
410
            this_tree, 'rev3b', 'rev2b', other_tree.branch)
409
411
        merger.merge_type = _mod_merge.Merge3Merger
410
412
        merger.do_merge()
422
424
        self.build_tree(['a'])
423
425
        tree.add('a')
424
426
        first_rev = tree.commit("added a")
425
 
        merger = _mod_merge.Merger.from_revision_ids(None, tree,
 
427
        merger = _mod_merge.Merger.from_revision_ids(tree,
426
428
                                          _mod_revision.NULL_REVISION,
427
429
                                          first_rev)
428
430
        merger.merge_type = _mod_merge.Merge3Merger
442
444
        other_tree.commit('rev2', rev_id='rev2b')
443
445
        this_tree.lock_write()
444
446
        self.addCleanup(this_tree.unlock)
445
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
447
        merger = _mod_merge.Merger.from_revision_ids(
446
448
            this_tree, 'rev2b', other_branch=other_tree.branch)
447
449
        merger.merge_type = _mod_merge.Merge3Merger
448
450
        tree_merger = merger.make_merger()
465
467
        other_tree.commit('rev2', rev_id='rev2b')
466
468
        this_tree.lock_write()
467
469
        self.addCleanup(this_tree.unlock)
468
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
470
        merger = _mod_merge.Merger.from_revision_ids(
469
471
            this_tree, 'rev2b', other_branch=other_tree.branch)
470
472
        merger.merge_type = _mod_merge.Merge3Merger
471
473
        tree_merger = merger.make_merger()
495
497
        other_tree.commit('rev2', rev_id='rev2b')
496
498
        this_tree.lock_write()
497
499
        self.addCleanup(this_tree.unlock)
498
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
500
        merger = _mod_merge.Merger.from_revision_ids(
499
501
            this_tree, 'rev2b', other_branch=other_tree.branch)
500
502
        merger.merge_type = _mod_merge.Merge3Merger
501
503
        tree_merger = merger.make_merger()
514
516
        tree.add('a')
515
517
        first_rev = tree.commit("added a")
516
518
        old_root_id = tree.get_root_id()
517
 
        merger = _mod_merge.Merger.from_revision_ids(None, tree,
 
519
        merger = _mod_merge.Merger.from_revision_ids(tree,
518
520
                                          _mod_revision.NULL_REVISION,
519
521
                                          first_rev)
520
522
        merger.merge_type = _mod_merge.Merge3Merger
1268
1270
        mem_tree = memorytree.MemoryTree.create_on_branch(builder.get_branch())
1269
1271
        mem_tree.lock_write()
1270
1272
        self.addCleanup(mem_tree.unlock)
1271
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
1273
        merger = _mod_merge.Merger.from_revision_ids(
1272
1274
            mem_tree, other_revision_id)
1273
1275
        merger.set_interesting_files(interesting_files)
1274
1276
        # It seems there is no matching function for set_interesting_ids
2070
2072
 
2071
2073
    def do_merge(self, builder, other_revision_id):
2072
2074
        wt = self.get_wt_from_builder(builder)
2073
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
2075
        merger = _mod_merge.Merger.from_revision_ids(
2074
2076
            wt, other_revision_id)
2075
2077
        merger.merge_type = _mod_merge.Merge3Merger
2076
2078
        return wt, merger.do_merge()
2336
2338
        wt.commit('D merges B & C', rev_id='D-id')
2337
2339
        self.assertEqual('barry', wt.id2path('foo-id'))
2338
2340
        # Check the output of the Merger object directly
2339
 
        merger = _mod_merge.Merger.from_revision_ids(None,
2340
 
            wt, 'F-id')
 
2341
        merger = _mod_merge.Merger.from_revision_ids(wt, 'F-id')
2341
2342
        merger.merge_type = _mod_merge.Merge3Merger
2342
2343
        merge_obj = merger.make_merger()
2343
2344
        root_id = wt.path2id('')
2392
2393
        wt.commit('F foo => bing', rev_id='F-id')
2393
2394
 
2394
2395
        # Check the output of the Merger object directly
2395
 
        merger = _mod_merge.Merger.from_revision_ids(None,
2396
 
            wt, 'E-id')
 
2396
        merger = _mod_merge.Merger.from_revision_ids(wt, 'E-id')
2397
2397
        merger.merge_type = _mod_merge.Merge3Merger
2398
2398
        merge_obj = merger.make_merger()
2399
2399
        # Nothing interesting happened in OTHER relative to BASE
2443
2443
        list(wt.iter_changes(wt.basis_tree()))
2444
2444
        wt.commit('D merges B & C, makes it a file', rev_id='D-id')
2445
2445
 
2446
 
        merger = _mod_merge.Merger.from_revision_ids(None,
2447
 
            wt, 'E-id')
 
2446
        merger = _mod_merge.Merger.from_revision_ids(wt, 'E-id')
2448
2447
        merger.merge_type = _mod_merge.Merge3Merger
2449
2448
        merge_obj = merger.make_merger()
2450
2449
        entries = list(merge_obj._entries_lca())
2658
2657
        wt.branch.set_last_revision_info(2, 'B-id')
2659
2658
        wt.commit('D', rev_id='D-id', recursive=None)
2660
2659
 
2661
 
        merger = _mod_merge.Merger.from_revision_ids(None,
2662
 
            wt, 'E-id')
 
2660
        merger = _mod_merge.Merger.from_revision_ids(wt, 'E-id')
2663
2661
        merger.merge_type = _mod_merge.Merge3Merger
2664
2662
        merge_obj = merger.make_merger()
2665
2663
        entries = list(merge_obj._entries_lca())
2695
2693
        wt.branch.set_last_revision_info(2, 'B-id')
2696
2694
        wt.commit('D', rev_id='D-id', recursive=None)
2697
2695
 
2698
 
        merger = _mod_merge.Merger.from_revision_ids(None,
2699
 
            wt, 'E-id')
 
2696
        merger = _mod_merge.Merger.from_revision_ids(wt, 'E-id')
2700
2697
        merger.merge_type = _mod_merge.Merge3Merger
2701
2698
        merge_obj = merger.make_merger()
2702
2699
        entries = list(merge_obj._entries_lca())
2735
2732
        wt.branch.set_last_revision_info(2, 'B-id')
2736
2733
        wt.commit('D', rev_id='D-id', recursive=None)
2737
2734
 
2738
 
        merger = _mod_merge.Merger.from_revision_ids(None,
2739
 
            wt, 'E-id')
 
2735
        merger = _mod_merge.Merger.from_revision_ids(wt, 'E-id')
2740
2736
        merger.merge_type = _mod_merge.Merge3Merger
2741
2737
        merge_obj = merger.make_merger()
2742
2738
        entries = list(merge_obj._entries_lca())
2780
2776
        wt.branch.set_last_revision_info(2, 'B-id')
2781
2777
        wt.commit('D', rev_id='D-id', recursive=None)
2782
2778
 
2783
 
        merger = _mod_merge.Merger.from_revision_ids(None,
2784
 
            wt, 'E-id')
 
2779
        merger = _mod_merge.Merger.from_revision_ids(wt, 'E-id')
2785
2780
        merger.merge_type = _mod_merge.Merge3Merger
2786
2781
        merge_obj = merger.make_merger()
2787
2782
        entries = list(merge_obj._entries_lca())