~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    memorytree,
26
26
    revision,
27
27
    )
28
 
from bzrlib.tests import per_branch, TestNotApplicable
 
28
from bzrlib.tests import (
 
29
    fixtures,
 
30
    per_branch,
 
31
    TestNotApplicable,
 
32
    )
29
33
 
30
34
 
31
35
class TestPull(per_branch.TestCaseWithBranch):
144
148
            builder = self.make_branch_builder('source')
145
149
        except errors.UninitializableFormat:
146
150
            raise TestNotApplicable('uninitializeable format')
147
 
        builder.build_commit(message="Rev 1", rev_id='rev-1')
148
 
        source = builder.get_branch()
 
151
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
149
152
        target = source.bzrdir.sprout('target').open_branch()
150
 
        # Add a non-ancestry tag to source
151
 
        builder.build_commit(message="Rev 2", rev_id='rev-2')
 
153
        # Add a tag to the source, then pull from source
152
154
        try:
153
155
            source.tags.set_tag('tag-a', 'rev-2')
154
156
        except errors.TagsNotSupported:
155
157
            raise TestNotApplicable('format does not support tags.')
156
 
        source.set_last_revision_info(1, 'rev-1')
157
 
        # Pull from source
 
158
        source.tags.set_tag('tag-a', 'rev-2')
158
159
        target.pull(source)
159
160
        # The tag is present, and so is its revision.
160
161
        self.assertEqual('rev-2', target.tags.lookup_tag('tag-a'))
167
168
            builder = self.make_branch_builder('source')
168
169
        except errors.UninitializableFormat:
169
170
            raise TestNotApplicable('uninitializeable format')
170
 
        builder.build_commit(message="Rev 1", rev_id='rev-1')
171
 
        source = builder.get_branch()
 
171
        source = fixtures.build_branch_with_non_ancestral_rev(builder)
172
172
        target = source.bzrdir.sprout('target').open_branch()
173
 
        # Add a non-ancestry tag to source
174
 
        builder.build_commit(message="Rev 2", rev_id='rev-2')
175
 
        try:
176
 
            source.tags.set_tag('tag-a', 'rev-2')
177
 
        except errors.TagsNotSupported:
178
 
            raise TestNotApplicable('format does not support tags.')
179
 
        source.set_last_revision_info(1, 'rev-1')
180
173
        # Add a new commit to the ancestry
181
174
        builder.build_commit(message="Rev 2 again", rev_id='rev-2-again')
182
 
        # Pull from source
 
175
        # Add a tag to the source, then pull rev-2-again from source
 
176
        try:
 
177
            source.tags.set_tag('tag-a', 'rev-2')
 
178
        except errors.TagsNotSupported:
 
179
            raise TestNotApplicable('format does not support tags.')
183
180
        target.pull(source, 'rev-2-again')
184
181
        # The tag is present, and so is its revision.
185
182
        self.assertEqual('rev-2', target.tags.lookup_tag('tag-a'))