1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2006-2011 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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
269
self.run_bzr('checkout --lightweight a b')
271
270
self.assertLength(2, calls)
272
def test_branch_fetches_all_tags(self):
273
builder = self.make_branch_builder('source')
274
source = fixtures.build_branch_with_non_ancestral_rev(builder)
275
source.tags.set_tag('tag-a', 'rev-2')
276
# Now source has a tag not in its ancestry. Make a branch from it.
277
self.run_bzr('branch source new-branch')
278
new_branch = branch.Branch.open('new-branch')
279
# The tag is present, and so is its revision.
280
self.assertEqual('rev-2', new_branch.tags.lookup_tag('tag-a'))
281
new_branch.repository.get_revision('rev-2')
274
284
class TestBranchStacked(TestCaseWithTransport):
275
285
"""Tests for branch --stacked"""
414
424
# being too low. If rpc_count increases, more network roundtrips have
415
425
# become necessary for this use case. Please do not adjust this number
416
426
# upwards without agreement from bzr's network support maintainers.
417
self.assertLength(38, self.hpss_calls)
427
self.assertLength(36, self.hpss_calls)
419
429
def test_branch_from_trivial_branch_streaming_acceptance(self):
420
430
self.setup_smart_server_with_call_log()
429
439
# being too low. If rpc_count increases, more network roundtrips have
430
440
# become necessary for this use case. Please do not adjust this number
431
441
# upwards without agreement from bzr's network support maintainers.
432
self.assertLength(10, self.hpss_calls)
442
self.assertLength(9, self.hpss_calls)
434
444
def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
435
445
self.setup_smart_server_with_call_log()
449
459
# being too low. If rpc_count increases, more network roundtrips have
450
460
# become necessary for this use case. Please do not adjust this number
451
461
# upwards without agreement from bzr's network support maintainers.
452
self.assertLength(15, self.hpss_calls)
462
self.assertLength(14, self.hpss_calls)
464
def test_branch_from_branch_with_tags(self):
465
self.setup_smart_server_with_call_log()
466
builder = self.make_branch_builder('source')
467
source = fixtures.build_branch_with_non_ancestral_rev(builder)
468
source.tags.set_tag('tag-a', 'rev-2')
469
source.tags.set_tag('tag-missing', 'missing-rev')
470
# Now source has a tag not in its ancestry. Make a branch from it.
471
self.reset_smart_call_log()
472
out, err = self.run_bzr(['branch', self.get_url('source'), 'target'])
473
# This figure represent the amount of work to perform this use case. It
474
# is entirely ok to reduce this number if a test fails due to rpc_count
475
# being too low. If rpc_count increases, more network roundtrips have
476
# become necessary for this use case. Please do not adjust this number
477
# upwards without agreement from bzr's network support maintainers.
478
self.assertLength(9, self.hpss_calls)
455
481
class TestRemoteBranch(TestCaseWithSFTPServer):