~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Martin Pool
  • Date: 2011-07-04 21:10:37 UTC
  • mto: (6034.1.1 filter-tree)
  • mto: This revision was merged to the branch mainline in revision 6035.
  • Revision ID: mbp@canonical.com-20110704211037-ro3417imj3oqnqxp
Support exporting tarballs from ContentFilterTree

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,
41
40
    TestCaseWithMemoryTransport,
42
41
    TestCaseWithTransport,
43
42
    test_merge_core,
136
135
            preview = tt.get_preview_tree()
137
136
            self.assertEqual(wt.get_root_id(), preview.get_root_id())
138
137
 
139
 
    def test_merge_unrelated_retains_root(self):
140
 
        wt = self.make_branch_and_tree('tree')
141
 
        other_tree = self.make_branch_and_tree('other')
142
 
        self.addCleanup(other_tree.lock_read().unlock)
143
 
        merger = _mod_merge.Merge3Merger(wt, wt, wt.basis_tree(), other_tree,
144
 
                                         this_branch=wt.branch,
145
 
                                         do_merge=False)
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)
150
 
 
151
138
    def test_create_rename(self):
152
139
        """Rename an inventory entry while creating the file"""
153
140
        tree =self.make_branch_and_tree('.')
1892
1879
        builder.build_snapshot('C-id', ['A-id'], [])
1893
1880
        builder.build_snapshot('E-id', ['C-id', 'B-id'],
1894
1881
            [('unversion', 'a-id'),
1895
 
             ('flush', None),
1896
1882
             ('add', (u'a', 'a-id', 'directory', None))])
1897
1883
        builder.build_snapshot('D-id', ['B-id', 'C-id'], [])
1898
1884
        merge_obj = self.make_merge_obj(builder, 'E-id')
1916
1902
        builder.build_snapshot('E-id', ['C-id', 'B-id'], [])
1917
1903
        builder.build_snapshot('D-id', ['B-id', 'C-id'],
1918
1904
            [('unversion', 'a-id'),
1919
 
             ('flush', None),
1920
1905
             ('add', (u'a', 'a-id', 'directory', None))])
1921
1906
        merge_obj = self.make_merge_obj(builder, 'E-id')
1922
1907
        entries = list(merge_obj._entries_lca())
2185
2170
        self.assertTrue(wt.is_executable('foo-id'))
2186
2171
 
2187
2172
    def test_create_symlink(self):
2188
 
        self.requireFeature(features.SymlinkFeature)
 
2173
        self.requireFeature(tests.SymlinkFeature)
2189
2174
        #   A
2190
2175
        #  / \
2191
2176
        # B   C
2250
2235
                             wt.get_file_text('foo-id'))
2251
2236
 
2252
2237
    def test_modified_symlink(self):
2253
 
        self.requireFeature(features.SymlinkFeature)
 
2238
        self.requireFeature(tests.SymlinkFeature)
2254
2239
        #   A       Create symlink foo => bar
2255
2240
        #  / \
2256
2241
        # B   C     B relinks foo => baz
2295
2280
        self.assertEqual('bing', wt.get_symlink_target('foo-id'))
2296
2281
 
2297
2282
    def test_renamed_symlink(self):
2298
 
        self.requireFeature(features.SymlinkFeature)
 
2283
        self.requireFeature(tests.SymlinkFeature)
2299
2284
        #   A       Create symlink foo => bar
2300
2285
        #  / \
2301
2286
        # B   C     B renames foo => barry
2351
2336
        self.assertEqual('blah', wt.id2path('foo-id'))
2352
2337
 
2353
2338
    def test_symlink_no_content_change(self):
2354
 
        self.requireFeature(features.SymlinkFeature)
 
2339
        self.requireFeature(tests.SymlinkFeature)
2355
2340
        #   A       Create symlink foo => bar
2356
2341
        #  / \
2357
2342
        # B   C     B relinks foo => baz
2402
2387
        self.assertEqual('bing', wt.get_symlink_target('foo-id'))
2403
2388
 
2404
2389
    def test_symlink_this_changed_kind(self):
2405
 
        self.requireFeature(features.SymlinkFeature)
 
2390
        self.requireFeature(tests.SymlinkFeature)
2406
2391
        #   A       Nothing
2407
2392
        #  / \
2408
2393
        # B   C     B creates symlink foo => bar
2455
2440
 
2456
2441
    def test_symlink_all_wt(self):
2457
2442
        """Check behavior if all trees are Working Trees."""
2458
 
        self.requireFeature(features.SymlinkFeature)
 
2443
        self.requireFeature(tests.SymlinkFeature)
2459
2444
        # The big issue is that entry.symlink_target is None for WorkingTrees.
2460
2445
        # So we need to make sure we handle that case correctly.
2461
2446
        #   A   foo => bar