~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2007-04-24 05:02:04 UTC
  • mfrom: (2449 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2450.
  • Revision ID: mbp@sourcefrog.net-20070424050204-bfkc1qiq0axt5f14
Merge trunk & fix NEWS conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    gpg,
27
27
    urlutils,
28
28
    transactions,
 
29
    remote,
29
30
    repository,
30
31
    )
31
32
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
352
353
        # config file in the branch.
353
354
        branch.nick = "Aaron's branch"
354
355
        branch.nick = "Aaron's branch"
355
 
        try:
 
356
        if not isinstance(branch, remote.RemoteBranch):
356
357
            controlfilename = branch.control_files.controlfilename
357
 
        except AttributeError:
358
 
            # remote branches don't have control_files
359
 
            pass
360
 
        else:
361
 
            self.failUnless(
362
 
                t.has(t.relpath(controlfilename("branch.conf"))))
 
358
            self.failUnless(t.has(t.relpath(controlfilename("branch.conf"))))
363
359
        # Because the nick has been set explicitly, the nick is now always
364
360
        # "Aaron's branch", regardless of directory name.
365
361
        self.assertEqual(branch.nick, "Aaron's branch")
598
594
class TestFormat(TestCaseWithBranch):
599
595
    """Tests for the format itself."""
600
596
 
 
597
    def test_get_reference(self):
 
598
        """get_reference on all regular branches should return None."""
 
599
        if not self.branch_format.is_supported():
 
600
            # unsupported formats are not loopback testable
 
601
            # because the default open will not open them and
 
602
            # they may not be initializable.
 
603
            return
 
604
        made_branch = self.make_branch('.')
 
605
        self.assertEqual(None,
 
606
            made_branch._format.get_reference(made_branch.bzrdir))
 
607
 
601
608
    def test_format_initialize_find_open(self):
602
609
        # loopback test to check the current format initializes to itself.
603
610
        if not self.branch_format.is_supported():
630
637
        except NotImplementedError:
631
638
            return
632
639
        self.assertEqual(self.branch_format,
633
 
                         branch.BranchFormat.find_format(opened_control))
 
640
                         opened_control.find_branch_format())
634
641
 
635
642
 
636
643
class TestBound(TestCaseWithBranch):