~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_bzrdir/test_bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-23 19:08:05 UTC
  • mfrom: (6437.3.20 2.5)
  • mto: This revision was merged to the branch mainline in revision 6450.
  • Revision ID: jelmer@samba.org-20120123190805-hlcuihkt2dep44cw
merge bzr 2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import bzrlib.branch
23
23
from bzrlib import (
 
24
    branch,
24
25
    bzrdir,
25
26
    errors,
26
27
    repository,
375
376
        referenced_branch = self.make_branch('referencced')
376
377
        dir = self.make_bzrdir('source')
377
378
        try:
378
 
            reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
379
 
                target_branch=referenced_branch)
 
379
            dir.set_branch_reference(referenced_branch)
380
380
        except errors.IncompatibleFormat:
381
381
            # this is ok too, not all formats have to support references.
382
382
            return
419
419
        referenced_branch = self.make_branch('referencced')
420
420
        dir = self.make_bzrdir('source')
421
421
        try:
422
 
            reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
423
 
                target_branch=referenced_branch)
 
422
            dir.set_branch_reference(referenced_branch)
424
423
        except errors.IncompatibleFormat:
425
424
            # this is ok too, not all formats have to support references.
426
425
            return
683
682
        self.assertEquals(
684
683
            branch.bzrdir.user_transport.list_dir("."),
685
684
            [".bzr"])
 
685
 
 
686
    def test_get_branches(self):
 
687
        repo = self.make_repository('branch-1')
 
688
        try:
 
689
            target_branch = repo.bzrdir.create_branch(name='foo')
 
690
        except errors.NoColocatedBranchSupport:
 
691
            raise TestNotApplicable('Format does not support colocation')
 
692
        repo.bzrdir.set_branch_reference(target_branch)
 
693
        self.assertEqual(set(["", 'foo']),
 
694
                         set(repo.bzrdir.get_branches().keys()))