~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_merge.py

  • Committer: Martin Pool
  • Date: 2011-04-15 07:01:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5789.
  • Revision ID: mbp@sourcefrog.net-20110415070122-7x24skeadcm7wvut
Switch away from using failUnlessExists and failIfExists

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        b_tree.commit(message='Modified a.txt')
204
204
        os.chdir('b')
205
205
        self.run_bzr('merge ../a/', retcode=1)
206
 
        self.failUnlessExists('sub/a.txt.THIS')
207
 
        self.failUnlessExists('sub/a.txt.BASE')
 
206
        self.assertPathExists('sub/a.txt.THIS')
 
207
        self.assertPathExists('sub/a.txt.BASE')
208
208
        os.chdir('../a')
209
209
        self.run_bzr('merge ../b/', retcode=1)
210
 
        self.failUnlessExists('sub/a.txt.OTHER')
211
 
        self.failUnlessExists('sub/a.txt.BASE')
 
210
        self.assertPathExists('sub/a.txt.OTHER')
 
211
        self.assertPathExists('sub/a.txt.BASE')
212
212
 
213
213
    def test_conflict_leaves_base_this_other_files(self):
214
214
        tree, other = self.create_conflicting_branches()
325
325
        tree_a.add(['file_1', 'file_2'])
326
326
        tree_a.commit('commit 1')
327
327
        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
328
 
        self.failUnlessExists('b/file_1')
 
328
        self.assertPathExists('b/file_1')
329
329
        tree_a.rename_one('file_1', 'file_i')
330
330
        tree_a.commit('commit 2')
331
331
        tree_a.rename_one('file_2', 'file_ii')
332
332
        ## os.chdir('b')
333
333
        self.run_bzr('merge a --uncommitted -d b')
334
 
        self.failUnlessExists('b/file_1')
335
 
        self.failUnlessExists('b/file_ii')
 
334
        self.assertPathExists('b/file_1')
 
335
        self.assertPathExists('b/file_ii')
336
336
        tree_b.revert()
337
337
        self.run_bzr_error(('Cannot use --uncommitted and --revision',),
338
338
                           'merge /a --uncommitted -r1 -d b')
346
346
        tree_a.add(['file1', 'file2'])
347
347
        os.chdir('tree_b')
348
348
        self.run_bzr(['merge', '--uncommitted', '../tree_a/file1'])
349
 
        self.failUnlessExists('file1')
350
 
        self.failIfExists('file2')
 
349
        self.assertPathExists('file1')
 
350
        self.assertPathDoesNotExist('file2')
351
351
 
352
352
    def pullable_branch(self):
353
353
        tree_a = self.make_branch_and_tree('a')
407
407
        self.write_directive('directive', source.branch, 'target', 'rev2',
408
408
                             'rev1')
409
409
        out, err = self.run_bzr('merge -d target directive')
410
 
        self.failIfExists('target/a')
411
 
        self.failUnlessExists('target/b')
 
410
        self.assertPathDoesNotExist('target/a')
 
411
        self.assertPathExists('target/b')
412
412
        self.assertContainsRe(err, 'Performing cherrypick')
413
413
 
414
414
    def write_directive(self, filename, source, target, revision_id,
449
449
        branch_b.add('file2')
450
450
        branch_b.commit('added file2', rev_id='rev2b')
451
451
        branch_b.merge_from_branch(branch_a.branch)
452
 
        self.failUnlessExists('branch_b/file1')
 
452
        self.assertPathExists('branch_b/file1')
453
453
        branch_b.commit('merged branch_a', rev_id='rev3b')
454
454
 
455
455
        # It works if the revid has an interger revno
456
456
        self.run_bzr('merge -d target -r revid:rev2a branch_a')
457
 
        self.failUnlessExists('target/file1')
458
 
        self.failIfExists('target/file2')
 
457
        self.assertPathExists('target/file1')
 
458
        self.assertPathDoesNotExist('target/file2')
459
459
        target.revert()
460
460
 
461
461
        # It should work if the revid has no integer revno
462
462
        self.run_bzr('merge -d target -r revid:rev2a branch_b')
463
 
        self.failUnlessExists('target/file1')
464
 
        self.failIfExists('target/file2')
 
463
        self.assertPathExists('target/file1')
 
464
        self.assertPathDoesNotExist('target/file2')
465
465
 
466
466
    def assertDirectoryContent(self, directory, entries, message=''):
467
467
        """Assert whether entries (file or directories) exist in a directory.
602
602
        other.add('other_file')
603
603
        other.commit('rev1b')
604
604
        self.run_bzr('merge -d this other -r0..')
605
 
        self.failUnlessExists('this/other_file')
 
605
        self.assertPathExists('this/other_file')
606
606
 
607
607
    def test_merge_interactive_unlocks_branch(self):
608
608
        this = self.make_branch_and_tree('this')
620
620
            tree.commit("added "+f)
621
621
        for context in (".", "", "a"):
622
622
            self.run_bzr("merge -r 1..0 " + context)
623
 
            self.failIfExists("a")
 
623
            self.assertPathDoesNotExist("a")
624
624
            tree.revert()
625
 
            self.failUnlessExists("a")
 
625
            self.assertPathExists("a")
626
626
 
627
627
    def test_merge_fetches_tags(self):
628
628
        """Tags are updated by merge, and revisions named in those tags are