~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2010-09-14 09:47:23 UTC
  • mto: (5452.4.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 5476.
  • Revision ID: mbp@sourcefrog.net-20100914094723-2dn6e9q5ktpa1m8r
Update existing script tests to not ignore their output

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 import (
33
 
    fixtures,
34
 
    TestCaseWithTransport,
35
 
    )
 
32
from bzrlib.tests import TestCaseWithTransport
36
33
from bzrlib.uncommit import uncommit
37
34
from bzrlib.workingtree import WorkingTree
38
35
 
145
142
        self.run_bzr('pull -r 4')
146
143
        self.assertEqual(a.revision_history(), b.revision_history())
147
144
 
148
 
    def test_pull_tags(self):
149
 
        """Tags are updated by pull, and revisions named in those tags are
150
 
        fetched.
151
 
        """
152
 
        # Make a source, sprout a target off it
153
 
        builder = self.make_branch_builder('source')
154
 
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
155
 
        target_bzrdir = source.bzrdir.sprout('target')
156
 
        source.tags.set_tag('tag-a', 'rev-2')
157
 
        # Pull from source
158
 
        self.run_bzr('pull -d target source')
159
 
        target = target_bzrdir.open_branch()
160
 
        # The tag is present, and so is its revision.
161
 
        self.assertEqual('rev-2', target.tags.lookup_tag('tag-a'))
162
 
        target.repository.get_revision('rev-2')
163
145
 
164
146
    def test_overwrite_uptodate(self):
165
147
        # Make sure pull --overwrite overwrites
471
453
        out, err = self.run_bzr(['pull', '-d', 'to', 'from'])
472
454
        self.assertContainsRe(err,
473
455
            "(?m)Fetching into experimental format")
474
 
 
475
 
    def test_pull_show_base(self):
476
 
        """bzr pull supports --show-base
477
 
 
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()
483
 
 
484
 
        f = open(pathjoin('a', 'hello'),'wt')
485
 
        f.write('fee')
486
 
        f.close()
487
 
        a_tree.commit('fee')
488
 
 
489
 
        f = open(pathjoin('b', 'hello'),'wt')
490
 
        f.write('fie')
491
 
        f.close()
492
 
 
493
 
        out,err=self.run_bzr(['pull','-d','b','a','--show-base'])
494
 
 
495
 
        # check for message here
496
 
        self.assertEqual(err,
497
 
                         ' M  hello\nText conflict in hello\n1 conflicts encountered.\n')
498
 
 
499
 
        self.assertEqualDiff('<<<<<<< TREE\n'
500
 
                             'fie||||||| BASE-REVISION\n'
501
 
                             'foo=======\n'
502
 
                             'fee>>>>>>> MERGE-SOURCE\n',
503
 
                             open(pathjoin('b', 'hello')).read())
504
 
 
505
 
    def test_pull_show_base_working_tree_only(self):
506
 
        """--show-base only allowed if there's a working tree
507
 
 
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'))
515
 
 
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', ''))