~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Vincent Ladeuil
  • Date: 2011-08-12 09:49:24 UTC
  • mfrom: (6015.9.10 2.4)
  • mto: This revision was merged to the branch mainline in revision 6066.
  • Revision ID: v.ladeuil+lp@free.fr-20110812094924-knc5s0g7vs31a2f1
Merge 2.4 into trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
from bzrlib.merge import transform_tree, merge_inner, _PlanMerge
38
38
from bzrlib.osutils import basename, pathjoin, file_kind
39
39
from bzrlib.tests import (
 
40
    features,
40
41
    TestCaseWithMemoryTransport,
41
42
    TestCaseWithTransport,
42
43
    test_merge_core,
137
138
 
138
139
    def test_merge_unrelated_retains_root(self):
139
140
        wt = self.make_branch_and_tree('tree')
140
 
        root_id_before_merge = wt.get_root_id()
141
 
        other_tree = self.make_branch_and_tree('other')
142
 
        # Do a commit so there is something to merge
143
 
        other_tree.commit('commit other')
144
 
        self.assertNotEquals(root_id_before_merge, other_tree.get_root_id())
145
 
        wt.merge_from_branch(other_tree.branch,
146
 
                             from_revision=_mod_revision.NULL_REVISION)
147
 
        self.assertEqual(root_id_before_merge, wt.get_root_id())
148
 
 
149
 
    def test_merge_preview_unrelated_retains_root(self):
150
 
        wt = self.make_branch_and_tree('tree')
151
 
        other_tree = self.make_branch_and_tree('other')
152
 
        # Do a commit so there is something to merge
153
 
        other_tree.commit('commit other')
 
141
        other_tree = self.make_branch_and_tree('other')
 
142
        self.addCleanup(other_tree.lock_read().unlock)
154
143
        merger = _mod_merge.Merge3Merger(wt, wt, wt.basis_tree(), other_tree,
155
144
                                         this_branch=wt.branch,
156
145
                                         do_merge=False)
157
 
        with merger.make_preview_transform() as tt:
158
 
            preview = tt.get_preview_tree()
159
 
            self.assertEqual(wt.get_root_id(), preview.get_root_id())
 
146
        with transform.TransformPreview(wt) as merger.tt:
 
147
            merger._compute_transform()
 
148
            new_root_id = merger.tt.final_file_id(merger.tt.root)
 
149
            self.assertEqual(wt.get_root_id(), new_root_id)
160
150
 
161
151
    def test_create_rename(self):
162
152
        """Rename an inventory entry while creating the file"""
2195
2185
        self.assertTrue(wt.is_executable('foo-id'))
2196
2186
 
2197
2187
    def test_create_symlink(self):
2198
 
        self.requireFeature(tests.SymlinkFeature)
 
2188
        self.requireFeature(features.SymlinkFeature)
2199
2189
        #   A
2200
2190
        #  / \
2201
2191
        # B   C
2260
2250
                             wt.get_file_text('foo-id'))
2261
2251
 
2262
2252
    def test_modified_symlink(self):
2263
 
        self.requireFeature(tests.SymlinkFeature)
 
2253
        self.requireFeature(features.SymlinkFeature)
2264
2254
        #   A       Create symlink foo => bar
2265
2255
        #  / \
2266
2256
        # B   C     B relinks foo => baz
2305
2295
        self.assertEqual('bing', wt.get_symlink_target('foo-id'))
2306
2296
 
2307
2297
    def test_renamed_symlink(self):
2308
 
        self.requireFeature(tests.SymlinkFeature)
 
2298
        self.requireFeature(features.SymlinkFeature)
2309
2299
        #   A       Create symlink foo => bar
2310
2300
        #  / \
2311
2301
        # B   C     B renames foo => barry
2361
2351
        self.assertEqual('blah', wt.id2path('foo-id'))
2362
2352
 
2363
2353
    def test_symlink_no_content_change(self):
2364
 
        self.requireFeature(tests.SymlinkFeature)
 
2354
        self.requireFeature(features.SymlinkFeature)
2365
2355
        #   A       Create symlink foo => bar
2366
2356
        #  / \
2367
2357
        # B   C     B relinks foo => baz
2412
2402
        self.assertEqual('bing', wt.get_symlink_target('foo-id'))
2413
2403
 
2414
2404
    def test_symlink_this_changed_kind(self):
2415
 
        self.requireFeature(tests.SymlinkFeature)
 
2405
        self.requireFeature(features.SymlinkFeature)
2416
2406
        #   A       Nothing
2417
2407
        #  / \
2418
2408
        # B   C     B creates symlink foo => bar
2465
2455
 
2466
2456
    def test_symlink_all_wt(self):
2467
2457
        """Check behavior if all trees are Working Trees."""
2468
 
        self.requireFeature(tests.SymlinkFeature)
 
2458
        self.requireFeature(features.SymlinkFeature)
2469
2459
        # The big issue is that entry.symlink_target is None for WorkingTrees.
2470
2460
        # So we need to make sure we handle that case correctly.
2471
2461
        #   A   foo => bar