~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-11 02:48:31 UTC
  • mfrom: (5847.1.6 2.4-uncommit-faster)
  • Revision ID: pqm@pqm.ubuntu.com-20110511024831-tm38ubce8znnq351
(jameinel) Make set_parent_trees() ~5% faster by improving the sort key
 function. (John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
        os.chdir('branch2')
91
91
        self.run_bzr('merge ../branch1/baz', retcode=3)
92
92
        self.run_bzr('merge ../branch1/foo')
93
 
        self.failUnlessExists('foo')
94
 
        self.failIfExists('bar')
 
93
        self.assertPathExists('foo')
 
94
        self.assertPathDoesNotExist('bar')
95
95
        wt2 = WorkingTree.open('.') # opens branch2
96
96
        self.assertEqual([tip], wt2.get_parent_ids())
97
97
 
157
157
        log = StringIO()
158
158
        merge_inner(tree_b.branch, tree_a, tree_b.basis_tree(),
159
159
                    this_tree=tree_b, ignore_zero=True)
160
 
        self.failUnless('All changes applied successfully.\n' not in
 
160
        self.assertTrue('All changes applied successfully.\n' not in
161
161
            self.get_log())
162
162
        tree_b.revert()
163
163
        merge_inner(tree_b.branch, tree_a, tree_b.basis_tree(),
164
164
                    this_tree=tree_b, ignore_zero=False)
165
 
        self.failUnless('All changes applied successfully.\n' in self.get_log())
 
165
        self.assertTrue('All changes applied successfully.\n' in self.get_log())
166
166
 
167
167
    def test_merge_inner_conflicts(self):
168
168
        tree_a = self.make_branch_and_tree('a')
1270
1270
        self.assertEqual(['B-id', 'C-id', 'F-id'],
1271
1271
                         [t.get_revision_id() for t in merger._lca_trees])
1272
1272
 
 
1273
    def test_find_base_new_root_criss_cross(self):
 
1274
        # A   B
 
1275
        # |\ /|
 
1276
        # | X |
 
1277
        # |/ \|
 
1278
        # C   D
 
1279
        
 
1280
        builder = self.get_builder()
 
1281
        builder.build_snapshot('A-id', None,
 
1282
            [('add', ('', None, 'directory', None))])
 
1283
        builder.build_snapshot('B-id', [],
 
1284
            [('add', ('', None, 'directory', None))])
 
1285
        builder.build_snapshot('D-id', ['A-id', 'B-id'], [])
 
1286
        builder.build_snapshot('C-id', ['A-id', 'B-id'], [])
 
1287
        merger = self.make_Merger(builder, 'D-id')
 
1288
        self.assertEqual('A-id', merger.base_rev_id)
 
1289
        self.assertTrue(merger._is_criss_cross)
 
1290
        self.assertEqual(['A-id', 'B-id'], [t.get_revision_id()
 
1291
                                            for t in merger._lca_trees])
 
1292
 
1273
1293
    def test_no_criss_cross_passed_to_merge_type(self):
1274
1294
        class LCATreesMerger(LoggingMerger):
1275
1295
            supports_lca_trees = True