1
# (C) 2005, 2006 Canonical Ltd
1
# Copyright (C) 2005, 2006 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
19
19
from cStringIO import StringIO
21
from stat import S_ISDIR
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,
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)
888
def test_create_repository_shared(self):
889
# a bzrdir can create a shared repository or
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.
896
t = get_transport(self.get_url())
897
made_control = self.bzrdir_format.initialize(t.base)
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
904
self.assertTrue(made_repo.is_shared())
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.
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())
889
918
def test_open_repository(self):
890
919
if not self.bzrdir_format.is_supported():