~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(gz) Enable use of 3-way conflict markers in pull and update by adding
 --show-base option (Rory Yorke)

Show diffs side-by-side

added added

removed removed

Lines of Context:
453
453
        out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
454
454
        self.assertContainsRe(err,
455
455
            "(?m)Fetching into experimental format")
 
456
 
 
457
    def test_pull_show_base(self):
 
458
        """bzr pull supports --show-base
 
459
 
 
460
        see https://bugs.launchpad.net/bzr/+bug/202374"""
 
461
        # create two trees with conflicts, setup conflict, check that
 
462
        # conflicted file looks correct
 
463
        a_tree = self.example_branch('a')
 
464
        b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
 
465
 
 
466
        f = open(pathjoin('a', 'hello'),'wt')
 
467
        f.write('fee')
 
468
        f.close()
 
469
        a_tree.commit('fee')
 
470
 
 
471
        f = open(pathjoin('b', 'hello'),'wt')
 
472
        f.write('fie')
 
473
        f.close()
 
474
 
 
475
        out,err=self.run_bzr(['pull','-d','b','a','--show-base'])
 
476
 
 
477
        # check for message here
 
478
        self.assertEqual(err,
 
479
                         ' M  hello\nText conflict in hello\n1 conflicts encountered.\n')
 
480
 
 
481
        self.assertEqualDiff('<<<<<<< TREE\n'
 
482
                             'fie||||||| BASE-REVISION\n'
 
483
                             'foo=======\n'
 
484
                             'fee>>>>>>> MERGE-SOURCE\n',
 
485
                             open(pathjoin('b', 'hello')).read())
 
486
 
 
487
    def test_pull_show_base_working_tree_only(self):
 
488
        """--show-base only allowed if there's a working tree
 
489
 
 
490
        see https://bugs.launchpad.net/bzr/+bug/202374"""
 
491
        # create a branch, see that --show-base fails
 
492
        self.make_branch('from')
 
493
        self.make_branch('to')
 
494
        out=self.run_bzr(['pull','-d','to','from','--show-base'],retcode=3)
 
495
        self.assertEqual(out,
 
496
                         ('','bzr: ERROR: Need working tree for --show-base.\n'))
 
497
 
 
498