~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2011-01-06 06:26:23 UTC
  • mto: This revision was merged to the branch mainline in revision 5612.
  • Revision ID: andrew.bennetts@canonical.com-20110106062623-43tda58mqroybjui
Start of a developer doc describing how fetch works.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from bzrlib.branch import Branch
30
30
from bzrlib.directory_service import directories
31
31
from bzrlib.osutils import pathjoin
32
 
from bzrlib.tests.blackbox import ExternalBase
 
32
from bzrlib.tests import TestCaseWithTransport
33
33
from bzrlib.uncommit import uncommit
34
34
from bzrlib.workingtree import WorkingTree
35
35
 
36
36
 
37
 
class TestPull(ExternalBase):
 
37
class TestPull(TestCaseWithTransport):
38
38
 
39
39
    def example_branch(self, path='.'):
40
40
        tree = self.make_branch_and_tree(path)
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