~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Robert Collins
  • Date: 2006-04-18 22:41:16 UTC
  • mto: (1711.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1671.
  • Revision ID: robertc@robertcollins.net-20060418224116-9b723440fa56e404
 * 'Metadir' is now the default disk format. This improves behaviour in
   SFTP using circumstances and allows binding and rebinding and easier
   use of repositories. (Robert Collins, Aaron Bentley).

Show diffs side-by-side

added added

removed removed

Lines of Context:
793
793
        self.assertTrue(t.is_readonly())
794
794
        return t
795
795
 
796
 
    def make_branch(self, relpath):
 
796
    def make_branch(self, relpath, format=None):
797
797
        """Create a branch on the transport at relpath."""
798
 
        repo = self.make_repository(relpath)
 
798
        repo = self.make_repository(relpath, format=format)
799
799
        return repo.bzrdir.create_branch()
800
800
 
801
 
    def make_bzrdir(self, relpath):
 
801
    def make_bzrdir(self, relpath, format=None):
802
802
        try:
803
803
            url = self.get_url(relpath)
804
804
            segments = relpath.split('/')
809
809
                    t.mkdir(segments[-1])
810
810
                except errors.FileExists:
811
811
                    pass
812
 
            return bzrlib.bzrdir.BzrDir.create(url)
 
812
            if format is None:
 
813
                format=bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
814
            # FIXME: make this use a single transport someday. RBC 20060418
 
815
            return format.initialize_on_transport(get_transport(relpath))
813
816
        except errors.UninitializableFormat:
814
817
            raise TestSkipped("Format %s is not initializable.")
815
818
 
816
 
    def make_repository(self, relpath, shared=False):
 
819
    def make_repository(self, relpath, shared=False, format=None):
817
820
        """Create a repository on our default transport at relpath."""
818
 
        made_control = self.make_bzrdir(relpath)
 
821
        made_control = self.make_bzrdir(relpath, format=format)
819
822
        return made_control.create_repository(shared=shared)
820
823
 
821
 
    def make_branch_and_tree(self, relpath):
 
824
    def make_branch_and_tree(self, relpath, format=None):
822
825
        """Create a branch on the transport and a tree locally.
823
826
 
824
827
        Returns the tree.
827
830
        # this obviously requires a format that supports branch references
828
831
        # so check for that by checking bzrdir.BzrDirFormat.get_default_format()
829
832
        # RBC 20060208
830
 
        b = self.make_branch(relpath)
 
833
        b = self.make_branch(relpath, format=format)
831
834
        try:
832
835
            return b.bzrdir.create_workingtree()
833
836
        except errors.NotLocalUrl:
941
944
                   'bzrlib.tests.test_annotate',
942
945
                   'bzrlib.tests.test_api',
943
946
                   'bzrlib.tests.test_bad_files',
944
 
                   'bzrlib.tests.test_basis_inventory',
945
947
                   'bzrlib.tests.test_branch',
946
948
                   'bzrlib.tests.test_bzrdir',
947
949
                   'bzrlib.tests.test_command',