/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2006-08-08 23:19:29 UTC
  • mfrom: (1884 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: robertc@robertcollins.net-20060808231929-4e3e298190214b3a
current status

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
 
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
18
18
 
19
19
from cStringIO import StringIO
20
20
import os
21
 
from stat import *
 
21
from stat import S_ISDIR
22
22
import sys
23
23
 
24
24
import bzrlib.branch
25
25
import bzrlib.bzrdir as bzrdir
26
26
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
27
27
from bzrlib.check import check
28
 
from bzrlib.commit import commit
29
28
import bzrlib.errors as errors
30
29
from bzrlib.errors import (FileExists,
31
30
                           NoSuchRevision,
885
884
        made_repo = made_control.create_repository()
886
885
        self.failUnless(isinstance(made_repo, repository.Repository))
887
886
        self.assertEqual(made_control, made_repo.bzrdir)
 
887
 
 
888
    def test_create_repository_shared(self):
 
889
        # a bzrdir can create a shared repository or 
 
890
        # fail appropriately
 
891
        if not self.bzrdir_format.is_supported():
 
892
            # unsupported formats are not loopback testable
 
893
            # because the default open will not open them and
 
894
            # they may not be initializable.
 
895
            return
 
896
        t = get_transport(self.get_url())
 
897
        made_control = self.bzrdir_format.initialize(t.base)
 
898
        try:
 
899
            made_repo = made_control.create_repository(shared=True)
 
900
        except errors.IncompatibleFormat:
 
901
            # Old bzrdir formats don't support shared repositories
 
902
            # and should raise IncompatibleFormat
 
903
            return
 
904
        self.assertTrue(made_repo.is_shared())
 
905
 
 
906
    def test_create_repository_nonshared(self):
 
907
        # a bzrdir can create a non-shared repository 
 
908
        if not self.bzrdir_format.is_supported():
 
909
            # unsupported formats are not loopback testable
 
910
            # because the default open will not open them and
 
911
            # they may not be initializable.
 
912
            return
 
913
        t = get_transport(self.get_url())
 
914
        made_control = self.bzrdir_format.initialize(t.base)
 
915
        made_repo = made_control.create_repository(shared=False)
 
916
        self.assertFalse(made_repo.is_shared())
888
917
        
889
918
    def test_open_repository(self):
890
919
        if not self.bzrdir_format.is_supported():