27
26
revision as _mod_revision,
29
28
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
30
29
from bzrlib.tests import TestCaseWithTransport
31
30
from bzrlib.tests import (
270
268
self.run_bzr('checkout --lightweight a b')
271
269
self.assertLength(2, calls)
271
def test_branch_fetches_all_tags(self):
272
builder = self.make_branch_builder('source')
273
builder.build_commit(message="Rev 1", rev_id='rev-1')
274
builder.build_commit(message="Rev 2", rev_id='rev-2')
275
source = builder.get_branch()
276
source.tags.set_tag('tag-a', 'rev-2')
277
source.set_last_revision_info(1, 'rev-1')
278
# Now source has a tag not in its ancestry. Make a branch from it.
279
self.run_bzr('branch source new-branch')
280
new_branch = branch.Branch.open('new-branch')
281
# The tag is present, and so is its revision.
282
self.assertEqual('rev-2', new_branch.tags.lookup_tag('tag-a'))
283
new_branch.repository.get_revision('rev-2')
274
286
class TestBranchStacked(TestCaseWithTransport):
275
287
"""Tests for branch --stacked"""
451
463
# upwards without agreement from bzr's network support maintainers.
452
464
self.assertLength(14, self.hpss_calls)
466
def test_branch_from_branch_with_tags(self):
467
self.setup_smart_server_with_call_log()
468
builder = self.make_branch_builder('source')
469
builder.build_commit(message="Rev 1", rev_id='rev-1')
470
builder.build_commit(message="Rev 2", rev_id='rev-2')
471
source = builder.get_branch()
472
source.tags.set_tag('tag-a', 'rev-2')
473
source.tags.set_tag('tag-missing', 'missing-rev')
474
source.set_last_revision_info(1, 'rev-1')
475
# Now source has a tag not in its ancestry. Make a branch from it.
476
self.reset_smart_call_log()
477
out, err = self.run_bzr(['branch', self.get_url('source'), 'target'])
478
# This figure represent the amount of work to perform this use case. It
479
# is entirely ok to reduce this number if a test fails due to rpc_count
480
# being too low. If rpc_count increases, more network roundtrips have
481
# become necessary for this use case. Please do not adjust this number
482
# upwards without agreement from bzr's network support maintainers.
483
self.assertLength(9, self.hpss_calls)
455
486
class TestRemoteBranch(TestCaseWithSFTPServer):