def test_branch_fetches_all_tags(self): builder = self.make_branch_builder('source') source = fixtures.build_branch_with_non_ancestral_rev(builder) source.tags.set_tag('tag-a', 'rev-2') source.get_config_stack().set('branch.fetch_tags', True) # Now source has a tag not in its ancestry. Make a branch from it. self.run_bzr('branch source new-branch') new_branch = branch.Branch.open('new-branch') # The tag is present, and so is its revision. self.assertEqual('rev-2', new_branch.tags.lookup_tag('tag-a')) new_branch.repository.get_revision('rev-2')
def test_unstack_fetches(self): """Removing the stacked-on branch pulls across all data""" try: builder = self.make_branch_builder('trunk') except errors.UninitializableFormat: raise TestNotApplicable('uninitializeable format') # We have a mainline trunk = fixtures.build_branch_with_non_ancestral_rev(builder) mainline_revid = 'rev-1' # and make branch from it which is stacked (with no tags) try: new_dir = trunk.bzrdir.sprout(self.get_url('newbranch'), stacked=True) except unstackable_format_errors, e: raise TestNotApplicable(e)
def test_pull_tags(self): """Tags are updated by pull, and revisions named in those tags are fetched. """ # Make a source, sprout a target off it builder = self.make_branch_builder('source') source = fixtures.build_branch_with_non_ancestral_rev(builder) source.get_config_stack().set('branch.fetch_tags', True) target_bzrdir = source.bzrdir.sprout('target') source.tags.set_tag('tag-a', 'rev-2') # Pull from source self.run_bzr('pull -d target source') target = target_bzrdir.open_branch() # The tag is present, and so is its revision. self.assertEqual('rev-2', target.tags.lookup_tag('tag-a')) target.repository.get_revision('rev-2')
def test_branch_from_branch_with_tags(self): self.setup_smart_server_with_call_log() builder = self.make_branch_builder('source') source = fixtures.build_branch_with_non_ancestral_rev(builder) source.get_config_stack().set('branch.fetch_tags', True) source.tags.set_tag('tag-a', 'rev-2') source.tags.set_tag('tag-missing', 'missing-rev') # Now source has a tag not in its ancestry. Make a branch from it. self.reset_smart_call_log() out, err = self.run_bzr(['branch', self.get_url('source'), 'target']) # This figure represent the amount of work to perform this use case. It # is entirely ok to reduce this number if a test fails due to rpc_count # being too low. If rpc_count increases, more network roundtrips have # become necessary for this use case. Please do not adjust this number # upwards without agreement from bzr's network support maintainers. self.assertLength(10, self.hpss_calls) self.assertThat(self.hpss_calls, ContainsNoVfsCalls) self.assertLength(1, self.hpss_connections)
def test_pull_stop_revision_merges_and_fetches_tags(self): """br.pull(source, stop_revision=REV) updates and fetches tags.""" # Make a source, sprout a target off it try: builder = self.make_branch_builder('source') except errors.UninitializableFormat: raise TestNotApplicable('uninitializeable format') source = fixtures.build_branch_with_non_ancestral_rev(builder) target = source.bzrdir.sprout('target').open_branch() # Add a new commit to the ancestry builder.build_commit(message="Rev 2 again", rev_id='rev-2-again') # Add a tag to the source, then pull rev-2-again from source try: source.tags.set_tag('tag-a', 'rev-2') except errors.TagsNotSupported: raise TestNotApplicable('format does not support tags.') source.get_config_stack().set('branch.fetch_tags', True) target.pull(source, 'rev-2-again') # The tag is present, and so is its revision. self.assertEqual('rev-2', target.tags.lookup_tag('tag-a')) target.repository.get_revision('rev-2')
def test_pull_merges_and_fetches_tags(self): """Tags are updated by br.pull(source), and revisions named in those tags are fetched. """ # Make a source, sprout a target off it try: builder = self.make_branch_builder('source') except errors.UninitializableFormat: raise TestNotApplicable('uninitializeable format') source = fixtures.build_branch_with_non_ancestral_rev(builder) target = source.bzrdir.sprout('target').open_branch() # Add a tag to the source, then pull from source try: source.tags.set_tag('tag-a', 'rev-2') except errors.TagsNotSupported: raise TestNotApplicable('format does not support tags.') source.tags.set_tag('tag-a', 'rev-2') source.get_config_stack().set('branch.fetch_tags', True) target.pull(source) # The tag is present, and so is its revision. self.assertEqual('rev-2', target.tags.lookup_tag('tag-a')) target.repository.get_revision('rev-2')