[MERGE] Fix shared BzrDir.create_repository()
John Arbash Meinel
john at arbash-meinel.com
Wed Jul 5 21:06:32 BST 2006
Jelmer Vernooij wrote:
> Hi,
>
> Attached bundle fixes BzrDir.create_repository()'s `shared' argument.
>
> Cheers,
>
> Jelmer
>
>
...
>
> === modified file bzrlib/bzrdir.py
> --- bzrlib/bzrdir.py
> +++ bzrlib/bzrdir.py
> @@ -301,7 +301,7 @@
> that child class desires.
> """
> bzrdir = BzrDir.create(base)
> - return bzrdir.create_repository()
> + return bzrdir.create_repository(shared)
>
> @staticmethod
> def create_standalone_workingtree(base):
>
> === modified file bzrlib/tests/test_bzrdir.py
> --- bzrlib/tests/test_bzrdir.py
> +++ bzrlib/tests/test_bzrdir.py
> @@ -62,7 +62,7 @@
> class SampleBzrDir(bzrdir.BzrDir):
> """A sample BzrDir implementation to allow testing static methods."""
>
> - def create_repository(self):
> + def create_repository(self, shared=False):
> """See BzrDir.create_repository."""
> return "A repository"
>
> @@ -163,6 +163,11 @@
> finally:
> bzrdir.BzrDirFormat.set_default_format(old_format)
>
> + def test_create_repository_shared(self):
> + old_format = bzrdir.BzrDirFormat.get_default_format()
> + repo = bzrdir.BzrDir.create_repository('.', shared=True)
> + self.assertTrue(repo.is_shared())
> +
> def test_create_repository_under_shared(self):
> # an explicit create_repository always does so.
> # we trust the format is right from the 'create_repository test'
>
You should probably also add a test that passing 'shared=False' returns
a repo which isn't shared.
And I'm wondering if this should be a bzrdir_implementations test,
rather than just testing the current preferred bzrdir implementation.
And just catching the IncompatibleFormat and returning. Something like:
try:
self.bzrdir_format.create_repository('.', shared=True)
except errors.IncompatibleFormat:
# Old bzrdir formats don't support shared repositories
# and should raise IncompatbileFormat
return
# Otherwise the format should be shared
self.assertTrue(...
and the matching:
self.bzrdir_format.create_repository('.', shared=False)
# Otherwise the format should be shared
self.assertFalse(...
And put that into:
bzrlib/tests/bzrdir_implementations/test_bzrdir.py
Otherwise, it looks good.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060705/f4b056e0/attachment.pgp
More information about the bazaar
mailing list