~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

Merge pt1 hooks branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    remote,
50
50
    repository,
51
51
    revision as _mod_revision,
 
52
    transport as _mod_transport,
52
53
    ui,
53
54
    urlutils,
54
55
    versionedfile,
66
67
    )
67
68
from bzrlib.repofmt import pack_repo
68
69
from bzrlib.smart.client import _SmartClient
69
 
from bzrlib.store.versioned import WeaveStore
 
70
from bzrlib.store.versioned import VersionedFileStore
70
71
from bzrlib.transactions import WriteTransaction
71
72
from bzrlib.transport import (
72
73
    do_catching_redirections,
73
 
    get_transport,
74
74
    local,
75
75
    )
76
 
from bzrlib.weave import Weave
 
76
from bzrlib.weave import (
 
77
    WeaveFile,
 
78
    Weave,
 
79
    )
77
80
""")
78
81
 
79
82
from bzrlib.trace import (
187
190
        :param create_prefix: Create any missing directories leading up to
188
191
            to_transport.
189
192
        :param use_existing_dir: Use an existing directory if one exists.
 
193
        :param no_tree: If set to true prevents creation of a working tree.
190
194
        """
191
195
        # Overview: put together a broad description of what we want to end up
192
196
        # with; then make as few api calls as possible to do it.
275
279
    # TODO: This should be given a Transport, and should chdir up; otherwise
276
280
    # this will open a new connection.
277
281
    def _make_tail(self, url):
278
 
        t = get_transport(url)
 
282
        t = _mod_transport.get_transport(url)
279
283
        t.ensure_base()
280
284
 
281
285
    @staticmethod
465
469
        """
466
470
        if force_new_tree:
467
471
            # check for non local urls
468
 
            t = get_transport(base, possible_transports)
 
472
            t = _mod_transport.get_transport(base, possible_transports)
469
473
            if not isinstance(t, local.LocalTransport):
470
474
                raise errors.NotLocalUrl(base)
471
475
        bzrdir = BzrDir.create(base, format, possible_transports)
493
497
        :param format: Override for the bzrdir format to create.
494
498
        :return: The WorkingTree object.
495
499
        """
496
 
        t = get_transport(base)
 
500
        t = _mod_transport.get_transport(base)
497
501
        if not isinstance(t, local.LocalTransport):
498
502
            raise errors.NotLocalUrl(base)
499
503
        bzrdir = BzrDir.create_branch_and_repo(base,
713
717
 
714
718
        :param _unsupported: a private parameter to the BzrDir class.
715
719
        """
716
 
        t = get_transport(base, possible_transports=possible_transports)
 
720
        t = _mod_transport.get_transport(base, possible_transports)
717
721
        return BzrDir.open_from_transport(t, _unsupported=_unsupported)
718
722
 
719
723
    @staticmethod
758
762
        :param url: url to search from.
759
763
        See open_containing_from_transport for more detail.
760
764
        """
761
 
        transport = get_transport(url, possible_transports)
 
765
        transport = _mod_transport.get_transport(url, possible_transports)
762
766
        return BzrDir.open_containing_from_transport(transport)
763
767
 
764
768
    @staticmethod
920
924
        if cls is not BzrDir:
921
925
            raise AssertionError("BzrDir.create always creates the"
922
926
                "default format, not one of %r" % cls)
923
 
        t = get_transport(base, possible_transports)
 
927
        t = _mod_transport.get_transport(base, possible_transports)
924
928
        t.ensure_base()
925
929
        if format is None:
926
930
            format = controldir.ControlDirFormat.get_default_format()
1843
1847
        return ConvertBzrDir5To6()
1844
1848
 
1845
1849
    def _initialize_for_clone(self, url):
1846
 
        return self.initialize_on_transport(get_transport(url), _cloning=True)
 
1850
        return self.initialize_on_transport(
 
1851
            _mod_transport.get_transport(url), _cloning=True)
1847
1852
 
1848
1853
    def initialize_on_transport(self, transport, _cloning=False):
1849
1854
        """Format 5 dirs always have working tree, branch and repository.
1903
1908
        return ConvertBzrDir6ToMeta()
1904
1909
 
1905
1910
    def _initialize_for_clone(self, url):
1906
 
        return self.initialize_on_transport(get_transport(url), _cloning=True)
 
1911
        return self.initialize_on_transport(
 
1912
            _mod_transport.get_transport(url), _cloning=True)
1907
1913
 
1908
1914
    def initialize_on_transport(self, transport, _cloning=False):
1909
1915
        """Format 6 dirs always have working tree, branch and repository.
2097
2103
        """Circular import protection."""
2098
2104
        if self._repository_format:
2099
2105
            return self._repository_format
2100
 
        from bzrlib.repository import RepositoryFormat
2101
 
        return RepositoryFormat.get_default_format()
 
2106
        from bzrlib.repository import format_registry
 
2107
        return format_registry.get_default()
2102
2108
 
2103
2109
    def _set_repository_format(self, value):
2104
2110
        """Allow changing the repository format for metadir formats."""
2252
2258
            mode=self.bzrdir._get_file_mode())
2253
2259
 
2254
2260
    def _write_all_weaves(self):
2255
 
        controlweaves = WeaveStore(self.bzrdir.transport, prefixed=False)
 
2261
        controlweaves = VersionedFileStore(self.bzrdir.transport, prefixed=False,
 
2262
                                           versionedfile_class=WeaveFile)
2256
2263
        weave_transport = self.bzrdir.transport.clone('weaves')
2257
 
        weaves = WeaveStore(weave_transport, prefixed=False)
 
2264
        weaves = VersionedFileStore(weave_transport, prefixed=False,
 
2265
                            versionedfile_class=WeaveFile)
2258
2266
        transaction = WriteTransaction()
2259
2267
 
2260
2268
        try: