135
135
self.assertEqual(tree_b.branch.revision_history(),
136
136
tree_a.branch.revision_history())
138
def test_pull_merges_and_fetches_tags(self):
139
"""Tags are updated by br.pull(source), and revisions named in those
142
# Make a source, sprout a target off it
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')
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')
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')
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
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')
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')
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')
139
189
class TestPullHook(per_branch.TestCaseWithBranch):