413
390
self.assertLength(18, self.hpss_calls)
414
391
remote = Branch.open('stacked')
415
392
self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
417
def test_pull_cross_format_warning(self):
418
"""You get a warning for probably slow cross-format pulls.
420
# this is assumed to be going through InterDifferingSerializer
421
from_tree = self.make_branch_and_tree('from', format='2a')
422
to_tree = self.make_branch_and_tree('to', format='1.14-rich-root')
423
from_tree.commit(message='first commit')
424
out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
425
self.assertContainsRe(err,
426
"(?m)Doing on-the-fly conversion")
428
def test_pull_cross_format_warning_no_IDS(self):
429
"""You get a warning for probably slow cross-format pulls.
431
# this simulates what would happen across the network, where
432
# interdifferingserializer is not active
434
debug.debug_flags.add('IDS_never')
435
# TestCase take care of restoring them
437
from_tree = self.make_branch_and_tree('from', format='2a')
438
to_tree = self.make_branch_and_tree('to', format='1.14-rich-root')
439
from_tree.commit(message='first commit')
440
out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
441
self.assertContainsRe(err,
442
"(?m)Doing on-the-fly conversion")
444
def test_pull_cross_format_from_network(self):
445
self.setup_smart_server_with_call_log()
446
from_tree = self.make_branch_and_tree('from', format='2a')
447
to_tree = self.make_branch_and_tree('to', format='1.14-rich-root')
448
self.assertIsInstance(from_tree.branch, remote.RemoteBranch)
449
from_tree.commit(message='first commit')
450
out, err = self.run_bzr(['pull', '-d', 'to',
451
from_tree.branch.bzrdir.root_transport.base])
452
self.assertContainsRe(err,
453
"(?m)Doing on-the-fly conversion")
455
def test_pull_to_experimental_format_warning(self):
456
"""You get a warning for pulling into experimental formats.
458
from_tree = self.make_branch_and_tree('from', format='development-subtree')
459
to_tree = self.make_branch_and_tree('to', format='development-subtree')
460
from_tree.commit(message='first commit')
461
out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
462
self.assertContainsRe(err,
463
"(?m)Fetching into experimental format")
465
def test_pull_cross_to_experimental_format_warning(self):
466
"""You get a warning for pulling into experimental formats.
468
from_tree = self.make_branch_and_tree('from', format='2a')
469
to_tree = self.make_branch_and_tree('to', format='development-subtree')
470
from_tree.commit(message='first commit')
471
out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
472
self.assertContainsRe(err,
473
"(?m)Fetching into experimental format")
475
def test_pull_show_base(self):
476
"""bzr pull supports --show-base
478
see https://bugs.launchpad.net/bzr/+bug/202374"""
479
# create two trees with conflicts, setup conflict, check that
480
# conflicted file looks correct
481
a_tree = self.example_branch('a')
482
b_tree = a_tree.bzrdir.sprout('b').open_workingtree()
484
f = open(pathjoin('a', 'hello'),'wt')
489
f = open(pathjoin('b', 'hello'),'wt')
493
out,err=self.run_bzr(['pull','-d','b','a','--show-base'])
495
# check for message here
496
self.assertEqual(err,
497
' M hello\nText conflict in hello\n1 conflicts encountered.\n')
499
self.assertEqualDiff('<<<<<<< TREE\n'
500
'fie||||||| BASE-REVISION\n'
502
'fee>>>>>>> MERGE-SOURCE\n',
503
open(pathjoin('b', 'hello')).read())
505
def test_pull_show_base_working_tree_only(self):
506
"""--show-base only allowed if there's a working tree
508
see https://bugs.launchpad.net/bzr/+bug/202374"""
509
# create a branch, see that --show-base fails
510
self.make_branch('from')
511
self.make_branch('to')
512
out=self.run_bzr(['pull','-d','to','from','--show-base'],retcode=3)
513
self.assertEqual(out,
514
('','bzr: ERROR: Need working tree for --show-base.\n'))
516
def test_pull_tag_conflicts(self):
517
"""pulling tags with conflicts will change the exit code"""
518
# create a branch, see that --show-base fails
519
from_tree = self.make_branch_and_tree('from')
520
from_tree.branch.tags.set_tag("mytag", "somerevid")
521
to_tree = self.make_branch_and_tree('to')
522
to_tree.branch.tags.set_tag("mytag", "anotherrevid")
523
out = self.run_bzr(['pull','-d','to','from'],retcode=1)
524
self.assertEqual(out,
525
('No revisions to pull.\nConflicting tags:\n mytag\n', ''))