~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

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