[MERGE] Fix shared BzrDir.create_repository()

Jelmer Vernooij jelmer at samba.org
Wed Jul 5 22:04:52 BST 2006


On Wed, 2006-07-05 at 15:06 -0500, John Arbash Meinel wrote:
> Jelmer Vernooij wrote: 
> > === 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.
Makes sense - fixed.

> 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(...

Fixed as well, updated bundle attached.

Cheers,

Jelmer

-- 
Jelmer Vernooij <jelmer at samba.org> - http://samba.org/~jelmer/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzr-fix-create-repos.bundle.diff
Type: text/x-patch
Size: 6219 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060705/d587e00a/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060705/d587e00a/attachment.pgp 


More information about the bazaar mailing list