~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_branch.py

Merge pt1 hooks branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    branch,
24
24
    bzrdir,
25
25
    errors,
26
 
    repository,
27
26
    revision as _mod_revision,
28
27
    )
29
28
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
30
29
from bzrlib.tests import TestCaseWithTransport
31
30
from bzrlib.tests import (
32
 
    KnownFailure,
 
31
    fixtures,
33
32
    HardlinkFeature,
34
33
    test_server,
35
34
    )
270
269
        self.run_bzr('checkout --lightweight a b')
271
270
        self.assertLength(2, calls)
272
271
 
 
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')
 
282
 
273
283
 
274
284
class TestBranchStacked(TestCaseWithTransport):
275
285
    """Tests for branch --stacked"""
451
461
        # upwards without agreement from bzr's network support maintainers.
452
462
        self.assertLength(14, self.hpss_calls)
453
463
 
 
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)
 
479
 
454
480
 
455
481
class TestRemoteBranch(TestCaseWithSFTPServer):
456
482