~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge extra repo branch.

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
 
28
from bzrlib.tests import per_branch, TestNotApplicable
29
29
 
30
30
 
31
31
class TestPull(per_branch.TestCaseWithBranch):
135
135
        self.assertEqual(tree_b.branch.revision_history(),
136
136
                         tree_a.branch.revision_history())
137
137
 
 
138
    def test_pull_merges_and_fetches_tags(self):
 
139
        """Tags are updated by br.pull(source), and revisions named in those
 
140
        tags are fetched.
 
141
        """
 
142
        # Make a source, sprout a target off it
 
143
        try:
 
144
            builder = self.make_branch_builder('source')
 
145
        except errors.UninitializableFormat:
 
146
            raise TestNotApplicable('uninitializeable format')
 
147
        builder.build_commit(message="Rev 1", rev_id='rev-1')
 
148
        source = builder.get_branch()
 
149
        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')
 
152
        try:
 
153
            source.tags.set_tag('tag-a', 'rev-2')
 
154
        except errors.TagsNotSupported:
 
155
            raise TestNotApplicable('format does not support tags.')
 
156
        source.set_last_revision_info(1, 'rev-1')
 
157
        # Pull from source
 
158
        target.pull(source)
 
159
        # The tag is present, and so is its revision.
 
160
        self.assertEqual('rev-2', target.tags.lookup_tag('tag-a'))
 
161
        target.repository.get_revision('rev-2')
 
162
 
 
163
    def test_pull_stop_revision_merges_and_fetches_tags(self):
 
164
        """br.pull(source, stop_revision=REV) updates and fetches tags."""
 
165
        # Make a source, sprout a target off it
 
166
        try:
 
167
            builder = self.make_branch_builder('source')
 
168
        except errors.UninitializableFormat:
 
169
            raise TestNotApplicable('uninitializeable format')
 
170
        builder.build_commit(message="Rev 1", rev_id='rev-1')
 
171
        source = builder.get_branch()
 
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
        # Add a new commit to the ancestry
 
181
        builder.build_commit(message="Rev 2 again", rev_id='rev-2-again')
 
182
        # Pull from source
 
183
        target.pull(source, 'rev-2-again')
 
184
        # The tag is present, and so is its revision.
 
185
        self.assertEqual('rev-2', target.tags.lookup_tag('tag-a'))
 
186
        target.repository.get_revision('rev-2')
 
187
 
138
188
 
139
189
class TestPullHook(per_branch.TestCaseWithBranch):
140
190