~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from StringIO import StringIO
19
19
 
20
20
from bzrlib import (
21
 
    branch as _mod_branch,
22
 
    cleanup,
23
21
    conflicts,
24
22
    errors,
25
 
    inventory,
26
23
    knit,
27
24
    memorytree,
28
25
    merge as _mod_merge,
29
26
    option,
30
 
    revision as _mod_revision,
 
27
    progress,
31
28
    tests,
32
29
    transform,
33
30
    versionedfile,
35
32
from bzrlib.conflicts import ConflictList, TextConflict
36
33
from bzrlib.errors import UnrelatedBranches, NoCommits
37
34
from bzrlib.merge import transform_tree, merge_inner, _PlanMerge
38
 
from bzrlib.osutils import basename, pathjoin, file_kind
 
35
from bzrlib.osutils import pathjoin, file_kind
39
36
from bzrlib.tests import (
40
37
    TestCaseWithMemoryTransport,
41
38
    TestCaseWithTransport,
298
295
        tree_a.commit('commit 2')
299
296
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
300
297
        tree_b.rename_one('file_1', 'renamed')
301
 
        merger = _mod_merge.Merger.from_uncommitted(tree_a, tree_b)
 
298
        merger = _mod_merge.Merger.from_uncommitted(tree_a, tree_b,
 
299
                                                    progress.DummyProgress())
302
300
        merger.merge_type = _mod_merge.Merge3Merger
303
301
        merger.do_merge()
304
302
        self.assertEqual(tree_a.get_parent_ids(), [tree_b.last_revision()])
312
310
        tree_a.commit('commit 2')
313
311
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
314
312
        tree_b.rename_one('file_1', 'renamed')
315
 
        merger = _mod_merge.Merger.from_uncommitted(tree_a, tree_b)
 
313
        merger = _mod_merge.Merger.from_uncommitted(tree_a, tree_b,
 
314
                                                    progress.DummyProgress())
316
315
        merger.merge_type = _mod_merge.WeaveMerger
317
316
        merger.do_merge()
318
317
        self.assertEqual(tree_a.get_parent_ids(), [tree_b.last_revision()])
319
318
 
 
319
    def test_Merger_defaults_to_DummyProgress(self):
 
320
        branch = self.make_branch('branch')
 
321
        merger = _mod_merge.Merger(branch, pb=None)
 
322
        self.assertIsInstance(merger._pb, progress.DummyProgress)
 
323
 
320
324
    def prepare_cherrypick(self):
321
325
        """Prepare a pair of trees for cherrypicking tests.
322
326
 
343
347
 
344
348
    def test_weave_cherrypick(self):
345
349
        this_tree, other_tree = self.prepare_cherrypick()
346
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
350
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
347
351
            this_tree, 'rev3b', 'rev2b', other_tree.branch)
348
352
        merger.merge_type = _mod_merge.WeaveMerger
349
353
        merger.do_merge()
351
355
 
352
356
    def test_weave_cannot_reverse_cherrypick(self):
353
357
        this_tree, other_tree = self.prepare_cherrypick()
354
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
358
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
355
359
            this_tree, 'rev2b', 'rev3b', other_tree.branch)
356
360
        merger.merge_type = _mod_merge.WeaveMerger
357
361
        self.assertRaises(errors.CannotReverseCherrypick, merger.do_merge)
358
362
 
359
363
    def test_merge3_can_reverse_cherrypick(self):
360
364
        this_tree, other_tree = self.prepare_cherrypick()
361
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
365
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
362
366
            this_tree, 'rev2b', 'rev3b', other_tree.branch)
363
367
        merger.merge_type = _mod_merge.Merge3Merger
364
368
        merger.do_merge()
376
380
        this_tree.lock_write()
377
381
        self.addCleanup(this_tree.unlock)
378
382
 
379
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
383
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
380
384
            this_tree, 'rev3b', 'rev2b', other_tree.branch)
381
385
        merger.merge_type = _mod_merge.Merge3Merger
382
386
        merger.do_merge()
395
399
        other_tree.commit('rev2', rev_id='rev2b')
396
400
        this_tree.lock_write()
397
401
        self.addCleanup(this_tree.unlock)
398
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
402
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress,
399
403
            this_tree, 'rev2b', other_branch=other_tree.branch)
400
404
        merger.merge_type = _mod_merge.Merge3Merger
401
405
        tree_merger = merger.make_merger()
415
419
        other_tree.commit('rev2', rev_id='rev2b')
416
420
        this_tree.lock_write()
417
421
        self.addCleanup(this_tree.unlock)
418
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
422
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
419
423
            this_tree, 'rev2b', other_branch=other_tree.branch)
420
424
        merger.merge_type = _mod_merge.Merge3Merger
421
425
        tree_merger = merger.make_merger()
445
449
        other_tree.commit('rev2', rev_id='rev2b')
446
450
        this_tree.lock_write()
447
451
        self.addCleanup(this_tree.unlock)
448
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
452
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
449
453
            this_tree, 'rev2b', other_branch=other_tree.branch)
450
454
        merger.merge_type = _mod_merge.Merge3Merger
451
455
        tree_merger = merger.make_merger()
1201
1205
        mem_tree = memorytree.MemoryTree.create_on_branch(builder.get_branch())
1202
1206
        mem_tree.lock_write()
1203
1207
        self.addCleanup(mem_tree.unlock)
1204
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
1208
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
1205
1209
            mem_tree, other_revision_id)
1206
1210
        merger.set_interesting_files(interesting_files)
1207
1211
        # It seems there is no matching function for set_interesting_ids
1981
1985
 
1982
1986
    def do_merge(self, builder, other_revision_id):
1983
1987
        wt = self.get_wt_from_builder(builder)
1984
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
1988
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
1985
1989
            wt, other_revision_id)
1986
1990
        merger.merge_type = _mod_merge.Merge3Merger
1987
1991
        return wt, merger.do_merge()
2247
2251
        wt.commit('D merges B & C', rev_id='D-id')
2248
2252
        self.assertEqual('barry', wt.id2path('foo-id'))
2249
2253
        # Check the output of the Merger object directly
2250
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
2254
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
2251
2255
            wt, 'F-id')
2252
2256
        merger.merge_type = _mod_merge.Merge3Merger
2253
2257
        merge_obj = merger.make_merger()
2303
2307
        wt.commit('F foo => bing', rev_id='F-id')
2304
2308
 
2305
2309
        # Check the output of the Merger object directly
2306
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
2310
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
2307
2311
            wt, 'E-id')
2308
2312
        merger.merge_type = _mod_merge.Merge3Merger
2309
2313
        merge_obj = merger.make_merger()
2354
2358
        list(wt.iter_changes(wt.basis_tree()))
2355
2359
        wt.commit('D merges B & C, makes it a file', rev_id='D-id')
2356
2360
 
2357
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
2361
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
2358
2362
            wt, 'E-id')
2359
2363
        merger.merge_type = _mod_merge.Merge3Merger
2360
2364
        merge_obj = merger.make_merger()
2569
2573
        wt.branch.set_last_revision_info(2, 'B-id')
2570
2574
        wt.commit('D', rev_id='D-id', recursive=None)
2571
2575
 
2572
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
2576
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
2573
2577
            wt, 'E-id')
2574
2578
        merger.merge_type = _mod_merge.Merge3Merger
2575
2579
        merge_obj = merger.make_merger()
2606
2610
        wt.branch.set_last_revision_info(2, 'B-id')
2607
2611
        wt.commit('D', rev_id='D-id', recursive=None)
2608
2612
 
2609
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
2613
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
2610
2614
            wt, 'E-id')
2611
2615
        merger.merge_type = _mod_merge.Merge3Merger
2612
2616
        merge_obj = merger.make_merger()
2646
2650
        wt.branch.set_last_revision_info(2, 'B-id')
2647
2651
        wt.commit('D', rev_id='D-id', recursive=None)
2648
2652
 
2649
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
2653
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
2650
2654
            wt, 'E-id')
2651
2655
        merger.merge_type = _mod_merge.Merge3Merger
2652
2656
        merge_obj = merger.make_merger()
2691
2695
        wt.branch.set_last_revision_info(2, 'B-id')
2692
2696
        wt.commit('D', rev_id='D-id', recursive=None)
2693
2697
 
2694
 
        merger = _mod_merge.Merger.from_revision_ids(None,
 
2698
        merger = _mod_merge.Merger.from_revision_ids(progress.DummyProgress(),
2695
2699
            wt, 'E-id')
2696
2700
        merger.merge_type = _mod_merge.Merge3Merger
2697
2701
        merge_obj = merger.make_merger()
2890
2894
                        base=False, other=False)
2891
2895
        return builder
2892
2896
 
2893
 
    def test_uses_this_branch(self):
2894
 
        builder = self.make_text_conflict()
2895
 
        tt = builder.make_preview_transform()
2896
 
        self.addCleanup(tt.finalize)
2897
 
 
2898
2897
    def test_affected_files_cached(self):
2899
2898
        """Ensures that the config variable is cached"""
2900
2899
        builder = self.make_text_conflict()
2920
2919
        conflicts = builder.merge()
2921
2920
        # The hook should not call the merge_text() method
2922
2921
        self.assertEqual([], self.calls)
2923
 
 
2924
 
 
2925
 
class TestMergeIntoBase(tests.TestCaseWithTransport):
2926
 
 
2927
 
    def setup_simple_branch(self, relpath, shape=None, root_id=None):
2928
 
        """One commit, containing tree specified by optional shape.
2929
 
        
2930
 
        Default is empty tree (just root entry).
2931
 
        """
2932
 
        if root_id is None:
2933
 
            root_id = '%s-root-id' % (relpath,)
2934
 
        wt = self.make_branch_and_tree(relpath)
2935
 
        wt.set_root_id(root_id)
2936
 
        if shape is not None:
2937
 
            adjusted_shape = [relpath + '/' + elem for elem in shape]
2938
 
            self.build_tree(adjusted_shape)
2939
 
            ids = ['%s-%s-id' % (relpath, basename(elem.rstrip('/')))
2940
 
                   for elem in shape]
2941
 
            wt.add(shape, ids=ids)
2942
 
        rev_id = 'r1-%s' % (relpath,)
2943
 
        wt.commit("Initial commit of %s" % (relpath,), rev_id=rev_id)
2944
 
        self.assertEqual(root_id, wt.path2id(''))
2945
 
        return wt
2946
 
 
2947
 
    def setup_two_branches(self, custom_root_ids=True):
2948
 
        """Setup 2 branches, one will be a library, the other a project."""
2949
 
        if custom_root_ids:
2950
 
            root_id = None
2951
 
        else:
2952
 
            root_id = inventory.ROOT_ID
2953
 
        project_wt = self.setup_simple_branch(
2954
 
            'project', ['README', 'dir/', 'dir/file.c'],
2955
 
            root_id)
2956
 
        lib_wt = self.setup_simple_branch(
2957
 
            'lib1', ['README', 'Makefile', 'foo.c'], root_id)
2958
 
 
2959
 
        return project_wt, lib_wt
2960
 
 
2961
 
    def do_merge_into(self, location, merge_as):
2962
 
        """Helper for using MergeIntoMerger.
2963
 
        
2964
 
        :param location: location of directory to merge from, either the
2965
 
            location of a branch or of a path inside a branch.
2966
 
        :param merge_as: the path in a tree to add the new directory as.
2967
 
        :returns: the conflicts from 'do_merge'.
2968
 
        """
2969
 
        operation = cleanup.OperationWithCleanups(self._merge_into)
2970
 
        return operation.run(location, merge_as)
2971
 
 
2972
 
    def _merge_into(self, op, location, merge_as):
2973
 
        # Open and lock the various tree and branch objects
2974
 
        wt, subdir_relpath = WorkingTree.open_containing(merge_as)
2975
 
        op.add_cleanup(wt.lock_write().unlock)
2976
 
        branch_to_merge, subdir_to_merge = _mod_branch.Branch.open_containing(
2977
 
            location)
2978
 
        op.add_cleanup(branch_to_merge.lock_read().unlock)
2979
 
        other_tree = branch_to_merge.basis_tree()
2980
 
        op.add_cleanup(other_tree.lock_read().unlock)
2981
 
        # Perform the merge
2982
 
        merger = _mod_merge.MergeIntoMerger(this_tree=wt, other_tree=other_tree,
2983
 
            other_branch=branch_to_merge, target_subdir=subdir_relpath,
2984
 
            source_subpath=subdir_to_merge)
2985
 
        merger.set_base_revision(_mod_revision.NULL_REVISION, branch_to_merge)
2986
 
        conflicts = merger.do_merge()
2987
 
        merger.set_pending()
2988
 
        return conflicts
2989
 
 
2990
 
    def assertTreeEntriesEqual(self, expected_entries, tree):
2991
 
        """Assert that 'tree' contains the expected inventory entries.
2992
 
 
2993
 
        :param expected_entries: sequence of (path, file-id) pairs.
2994
 
        """
2995
 
        files = [(path, ie.file_id) for path, ie in tree.iter_entries_by_dir()]
2996
 
        self.assertEqual(expected_entries, files)
2997
 
 
2998
 
 
2999
 
class TestMergeInto(TestMergeIntoBase):
3000
 
 
3001
 
    def test_newdir_with_unique_roots(self):
3002
 
        """Merge a branch with a unique root into a new directory."""
3003
 
        project_wt, lib_wt = self.setup_two_branches()
3004
 
        self.do_merge_into('lib1', 'project/lib1')
3005
 
        project_wt.lock_read()
3006
 
        self.addCleanup(project_wt.unlock)
3007
 
        # The r1-lib1 revision should be merged into this one
3008
 
        self.assertEqual(['r1-project', 'r1-lib1'], project_wt.get_parent_ids())
3009
 
        self.assertTreeEntriesEqual(
3010
 
            [('', 'project-root-id'),
3011
 
             ('README', 'project-README-id'),
3012
 
             ('dir', 'project-dir-id'),
3013
 
             ('lib1', 'lib1-root-id'),
3014
 
             ('dir/file.c', 'project-file.c-id'),
3015
 
             ('lib1/Makefile', 'lib1-Makefile-id'),
3016
 
             ('lib1/README', 'lib1-README-id'),
3017
 
             ('lib1/foo.c', 'lib1-foo.c-id'),
3018
 
            ], project_wt)
3019
 
 
3020
 
    def test_subdir(self):
3021
 
        """Merge a branch into a subdirectory of an existing directory."""
3022
 
        project_wt, lib_wt = self.setup_two_branches()
3023
 
        self.do_merge_into('lib1', 'project/dir/lib1')
3024
 
        project_wt.lock_read()
3025
 
        self.addCleanup(project_wt.unlock)
3026
 
        # The r1-lib1 revision should be merged into this one
3027
 
        self.assertEqual(['r1-project', 'r1-lib1'], project_wt.get_parent_ids())
3028
 
        self.assertTreeEntriesEqual(
3029
 
            [('', 'project-root-id'),
3030
 
             ('README', 'project-README-id'),
3031
 
             ('dir', 'project-dir-id'),
3032
 
             ('dir/file.c', 'project-file.c-id'),
3033
 
             ('dir/lib1', 'lib1-root-id'),
3034
 
             ('dir/lib1/Makefile', 'lib1-Makefile-id'),
3035
 
             ('dir/lib1/README', 'lib1-README-id'),
3036
 
             ('dir/lib1/foo.c', 'lib1-foo.c-id'),
3037
 
            ], project_wt)
3038
 
 
3039
 
    def test_newdir_with_repeat_roots(self):
3040
 
        """If the file-id of the dir to be merged already exists a new ID will
3041
 
        be allocated to let the merge happen.
3042
 
        """
3043
 
        project_wt, lib_wt = self.setup_two_branches(custom_root_ids=False)
3044
 
        root_id = project_wt.path2id('')
3045
 
        self.do_merge_into('lib1', 'project/lib1')
3046
 
        project_wt.lock_read()
3047
 
        self.addCleanup(project_wt.unlock)
3048
 
        # The r1-lib1 revision should be merged into this one
3049
 
        self.assertEqual(['r1-project', 'r1-lib1'], project_wt.get_parent_ids())
3050
 
        new_lib1_id = project_wt.path2id('lib1')
3051
 
        self.assertNotEqual(None, new_lib1_id)
3052
 
        self.assertTreeEntriesEqual(
3053
 
            [('', root_id),
3054
 
             ('README', 'project-README-id'),
3055
 
             ('dir', 'project-dir-id'),
3056
 
             ('lib1', new_lib1_id),
3057
 
             ('dir/file.c', 'project-file.c-id'),
3058
 
             ('lib1/Makefile', 'lib1-Makefile-id'),
3059
 
             ('lib1/README', 'lib1-README-id'),
3060
 
             ('lib1/foo.c', 'lib1-foo.c-id'),
3061
 
            ], project_wt)
3062
 
 
3063
 
    def test_name_conflict(self):
3064
 
        """When the target directory name already exists a conflict is
3065
 
        generated and the original directory is renamed to foo.moved.
3066
 
        """
3067
 
        dest_wt = self.setup_simple_branch('dest', ['dir/', 'dir/file.txt'])
3068
 
        src_wt = self.setup_simple_branch('src', ['README'])
3069
 
        conflicts = self.do_merge_into('src', 'dest/dir')
3070
 
        self.assertEqual(1, conflicts)
3071
 
        dest_wt.lock_read()
3072
 
        self.addCleanup(dest_wt.unlock)
3073
 
        # The r1-lib1 revision should be merged into this one
3074
 
        self.assertEqual(['r1-dest', 'r1-src'], dest_wt.get_parent_ids())
3075
 
        self.assertTreeEntriesEqual(
3076
 
            [('', 'dest-root-id'),
3077
 
             ('dir', 'src-root-id'),
3078
 
             ('dir.moved', 'dest-dir-id'),
3079
 
             ('dir/README', 'src-README-id'),
3080
 
             ('dir.moved/file.txt', 'dest-file.txt-id'),
3081
 
            ], dest_wt)
3082
 
 
3083
 
    def test_file_id_conflict(self):
3084
 
        """A conflict is generated if the merge-into adds a file (or other
3085
 
        inventory entry) with a file-id that already exists in the target tree.
3086
 
        """
3087
 
        dest_wt = self.setup_simple_branch('dest', ['file.txt'])
3088
 
        # Make a second tree with a file-id that will clash with file.txt in
3089
 
        # dest.
3090
 
        src_wt = self.make_branch_and_tree('src')
3091
 
        self.build_tree(['src/README'])
3092
 
        src_wt.add(['README'], ids=['dest-file.txt-id'])
3093
 
        src_wt.commit("Rev 1 of src.", rev_id='r1-src')
3094
 
        conflicts = self.do_merge_into('src', 'dest/dir')
3095
 
        # This is an edge case that shouldn't happen to users very often.  So
3096
 
        # we don't care really about the exact presentation of the conflict,
3097
 
        # just that there is one.
3098
 
        self.assertEqual(1, conflicts)
3099
 
 
3100
 
    def test_only_subdir(self):
3101
 
        """When the location points to just part of a tree, merge just that
3102
 
        subtree.
3103
 
        """
3104
 
        dest_wt = self.setup_simple_branch('dest')
3105
 
        src_wt = self.setup_simple_branch(
3106
 
            'src', ['hello.txt', 'dir/', 'dir/foo.c'])
3107
 
        conflicts = self.do_merge_into('src/dir', 'dest/dir')
3108
 
        dest_wt.lock_read()
3109
 
        self.addCleanup(dest_wt.unlock)
3110
 
        # The r1-lib1 revision should NOT be merged into this one (this is a
3111
 
        # partial merge).
3112
 
        self.assertEqual(['r1-dest'], dest_wt.get_parent_ids())
3113
 
        self.assertTreeEntriesEqual(
3114
 
            [('', 'dest-root-id'),
3115
 
             ('dir', 'src-dir-id'),
3116
 
             ('dir/foo.c', 'src-foo.c-id'),
3117
 
            ], dest_wt)
3118
 
 
3119
 
    def test_only_file(self):
3120
 
        """An edge case: merge just one file, not a whole dir."""
3121
 
        dest_wt = self.setup_simple_branch('dest')
3122
 
        two_file_wt = self.setup_simple_branch(
3123
 
            'two-file', ['file1.txt', 'file2.txt'])
3124
 
        conflicts = self.do_merge_into('two-file/file1.txt', 'dest/file1.txt')
3125
 
        dest_wt.lock_read()
3126
 
        self.addCleanup(dest_wt.unlock)
3127
 
        # The r1-lib1 revision should NOT be merged into this one
3128
 
        self.assertEqual(['r1-dest'], dest_wt.get_parent_ids())
3129
 
        self.assertTreeEntriesEqual(
3130
 
            [('', 'dest-root-id'), ('file1.txt', 'two-file-file1.txt-id')],
3131
 
            dest_wt)
3132
 
 
3133
 
    def test_no_such_source_path(self):
3134
 
        """PathNotInTree is raised if the specified path in the source tree
3135
 
        does not exist.
3136
 
        """
3137
 
        dest_wt = self.setup_simple_branch('dest')
3138
 
        two_file_wt = self.setup_simple_branch('src', ['dir/'])
3139
 
        self.assertRaises(_mod_merge.PathNotInTree, self.do_merge_into,
3140
 
            'src/no-such-dir', 'dest/foo')
3141
 
        dest_wt.lock_read()
3142
 
        self.addCleanup(dest_wt.unlock)
3143
 
        # The dest tree is unmodified.
3144
 
        self.assertEqual(['r1-dest'], dest_wt.get_parent_ids())
3145
 
        self.assertTreeEntriesEqual([('', 'dest-root-id')], dest_wt)
3146
 
 
3147
 
    def test_no_such_target_path(self):
3148
 
        """PathNotInTree is also raised if the specified path in the target
3149
 
        tree does not exist.
3150
 
        """
3151
 
        dest_wt = self.setup_simple_branch('dest')
3152
 
        two_file_wt = self.setup_simple_branch('src', ['file.txt'])
3153
 
        self.assertRaises(_mod_merge.PathNotInTree, self.do_merge_into,
3154
 
            'src', 'dest/no-such-dir/foo')
3155
 
        dest_wt.lock_read()
3156
 
        self.addCleanup(dest_wt.unlock)
3157
 
        # The dest tree is unmodified.
3158
 
        self.assertEqual(['r1-dest'], dest_wt.get_parent_ids())
3159
 
        self.assertTreeEntriesEqual([('', 'dest-root-id')], dest_wt)