~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge pt1 hooks branch.

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 TestCaseWithTransport
 
32
from bzrlib.tests import (
 
33
    fixtures,
 
34
    TestCaseWithTransport,
 
35
    )
33
36
from bzrlib.uncommit import uncommit
34
37
from bzrlib.workingtree import WorkingTree
35
38
 
142
145
        self.run_bzr('pull -r 4')
143
146
        self.assertEqual(a.revision_history(), b.revision_history())
144
147
 
 
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')
145
163
 
146
164
    def test_overwrite_uptodate(self):
147
165
        # Make sure pull --overwrite overwrites
495
513
        self.assertEqual(out,
496
514
                         ('','bzr: ERROR: Need working tree for --show-base.\n'))
497
515
 
498
 
 
 
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', ''))