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
37
class TestPull(ExternalBase):
37
class TestPull(TestCaseWithTransport):
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")
457
def test_pull_show_base(self):
458
"""bzr pull supports --show-base
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()
466
f = open(pathjoin('a', 'hello'),'wt')
471
f = open(pathjoin('b', 'hello'),'wt')
475
out,err=self.run_bzr(['pull','-d','b','a','--show-base'])
477
# check for message here
478
self.assertEqual(err,
479
' M hello\nText conflict in hello\n1 conflicts encountered.\n')
481
self.assertEqualDiff('<<<<<<< TREE\n'
482
'fie||||||| BASE-REVISION\n'
484
'fee>>>>>>> MERGE-SOURCE\n',
485
open(pathjoin('b', 'hello')).read())
487
def test_pull_show_base_working_tree_only(self):
488
"""--show-base only allowed if there's a working tree
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'))