~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/weave_fmt/bzrdir.py

(jelmer) Make "bzr branches" support our shared-repo style of "sibling
 branches" too. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    BzrDirMetaFormat1,
25
25
    )
26
26
from bzrlib.controldir import (
27
 
    ControlDir,
28
27
    Converter,
29
28
    format_registry,
30
29
    )
67
66
        create_prefix=False, force_new_repo=False, stacked_on=None,
68
67
        stack_on_pwd=None, repo_format_name=None, make_working_trees=None,
69
68
        shared_repo=False):
70
 
        """See ControlDir.initialize_on_transport_ex."""
 
69
        """See BzrDirFormat.initialize_on_transport_ex."""
71
70
        require_stacking = (stacked_on is not None)
72
71
        # Format 5 cannot stack, but we've been asked to - actually init
73
72
        # a Meta1Dir
117
116
        return BzrBranchFormat4()
118
117
 
119
118
    def get_format_description(self):
120
 
        """See ControlDirFormat.get_format_description()."""
 
119
        """See BzrDirFormat.get_format_description()."""
121
120
        return "All-in-one format 5"
122
121
 
123
122
    def get_converter(self, format=None):
124
 
        """See ControlDirFormat.get_converter()."""
 
123
        """See BzrDirFormat.get_converter()."""
125
124
        # there is one and only one upgrade path here.
126
125
        return ConvertBzrDir5To6()
127
126
 
177
176
        return "Bazaar-NG branch, format 6\n"
178
177
 
179
178
    def get_format_description(self):
180
 
        """See ControlDirFormat.get_format_description()."""
 
179
        """See BzrDirFormat.get_format_description()."""
181
180
        return "All-in-one format 6"
182
181
 
183
182
    def get_branch_format(self):
185
184
        return BzrBranchFormat4()
186
185
 
187
186
    def get_converter(self, format=None):
188
 
        """See ControlDirFormat.get_converter()."""
 
187
        """See BzrDirFormat.get_converter()."""
189
188
        # there is one and only one upgrade path here.
190
189
        return ConvertBzrDir6ToMeta()
191
190
 
241
240
            if isinstance(self.bzrdir.transport, local.LocalTransport):
242
241
                self.bzrdir.get_workingtree_transport(None).delete('stat-cache')
243
242
            self._convert_to_weaves()
244
 
            return ControlDir.open(self.bzrdir.user_url)
 
243
            return BzrDir.open(self.bzrdir.user_url)
245
244
        finally:
246
245
            self.pb.finished()
247
246
 
506
505
        try:
507
506
            ui.ui_factory.note(gettext('starting upgrade from format 5 to 6'))
508
507
            self._convert_to_prefixed()
509
 
            return ControlDir.open(self.bzrdir.user_url)
 
508
            return BzrDir.open(self.bzrdir.user_url)
510
509
        finally:
511
510
            pb.finished()
512
511
 
634
633
            BzrDirMetaFormat1().get_format_string(),
635
634
            mode=self.file_mode)
636
635
        self.pb.finished()
637
 
        return ControlDir.open(self.bzrdir.user_url)
 
636
        return BzrDir.open(self.bzrdir.user_url)
638
637
 
639
638
    def make_lock(self, name):
640
639
        """Make a lock for the new control dir name."""
686
685
        return "Bazaar-NG branch, format 0.0.4\n"
687
686
 
688
687
    def get_format_description(self):
689
 
        """See ControlDirFormat.get_format_description()."""
 
688
        """See BzrDirFormat.get_format_description()."""
690
689
        return "All-in-one format 4"
691
690
 
692
691
    def get_converter(self, format=None):
693
 
        """See ControlDirFormat.get_converter()."""
 
692
        """See BzrDirFormat.get_converter()."""
694
693
        # there is one and only one upgrade path here.
695
694
        return ConvertBzrDir4To5()
696
695
 
731
730
    """A common class for the all-in-one formats."""
732
731
 
733
732
    def __init__(self, _transport, _format):
734
 
        """See ControlDir.__init__."""
 
733
        """See BzrDir.__init__."""
735
734
        super(BzrDirPreSplitOut, self).__init__(_transport, _format)
736
735
        self._control_files = lockable_files.LockableFiles(
737
736
                                            self.get_branch_transport(None),
750
749
 
751
750
    def clone(self, url, revision_id=None, force_new_repo=False,
752
751
              preserve_stacking=False):
753
 
        """See ControlDir.clone().
 
752
        """See BzrDir.clone().
754
753
 
755
754
        force_new_repo has no effect, since this family of formats always
756
755
        require a new repository.
773
772
 
774
773
    def create_branch(self, name=None, repository=None,
775
774
                      append_revisions_only=None):
776
 
        """See ControlDir.create_branch."""
 
775
        """See BzrDir.create_branch."""
777
776
        if repository is not None:
778
777
            raise NotImplementedError(
779
778
                "create_branch(repository=<not None>) on %r" % (self,))
781
780
            append_revisions_only=append_revisions_only)
782
781
 
783
782
    def destroy_branch(self, name=None):
784
 
        """See ControlDir.destroy_branch."""
 
783
        """See BzrDir.destroy_branch."""
785
784
        raise errors.UnsupportedOperation(self.destroy_branch, self)
786
785
 
787
786
    def create_repository(self, shared=False):
788
 
        """See ControlDir.create_repository."""
 
787
        """See BzrDir.create_repository."""
789
788
        if shared:
790
789
            raise errors.IncompatibleFormat('shared repository', self._format)
791
790
        return self.open_repository()
792
791
 
793
792
    def destroy_repository(self):
794
 
        """See ControlDir.destroy_repository."""
 
793
        """See BzrDir.destroy_repository."""
795
794
        raise errors.UnsupportedOperation(self.destroy_repository, self)
796
795
 
797
796
    def create_workingtree(self, revision_id=None, from_branch=None,
798
797
                           accelerator_tree=None, hardlink=False):
799
 
        """See ControlDir.create_workingtree."""
 
798
        """See BzrDir.create_workingtree."""
800
799
        # The workingtree is sometimes created when the bzrdir is created,
801
800
        # but not when cloning.
802
801
 
834
833
                self.transport, self._control_files._file_mode)
835
834
 
836
835
    def destroy_workingtree(self):
837
 
        """See ControlDir.destroy_workingtree."""
 
836
        """See BzrDir.destroy_workingtree."""
838
837
        raise errors.UnsupportedOperation(self.destroy_workingtree, self)
839
838
 
840
839
    def destroy_workingtree_metadata(self):
841
 
        """See ControlDir.destroy_workingtree_metadata."""
 
840
        """See BzrDir.destroy_workingtree_metadata."""
842
841
        raise errors.UnsupportedOperation(self.destroy_workingtree_metadata,
843
842
                                          self)
844
843
 
875
874
        raise errors.IncompatibleFormat(workingtree_format, self._format)
876
875
 
877
876
    def needs_format_conversion(self, format=None):
878
 
        """See ControlDir.needs_format_conversion()."""
 
877
        """See BzrDir.needs_format_conversion()."""
879
878
        # if the format is not the same as the system default,
880
879
        # an upgrade is needed.
881
880
        if format is None:
886
885
 
887
886
    def open_branch(self, name=None, unsupported=False,
888
887
                    ignore_fallbacks=False, possible_transports=None):
889
 
        """See ControlDir.open_branch."""
 
888
        """See BzrDir.open_branch."""
890
889
        from bzrlib.plugins.weave_fmt.branch import BzrBranchFormat4
891
890
        format = BzrBranchFormat4()
892
891
        format.check_support_status(unsupported)
897
896
               possible_transports=None, accelerator_tree=None,
898
897
               hardlink=False, stacked=False, create_tree_if_local=True,
899
898
               source_branch=None):
900
 
        """See ControlDir.sprout()."""
 
899
        """See BzrDir.sprout()."""
901
900
        if source_branch is not None:
902
901
            my_branch = self.open_branch()
903
902
            if source_branch.base != my_branch.base:
942
941
    """
943
942
 
944
943
    def create_repository(self, shared=False):
945
 
        """See ControlDir.create_repository."""
 
944
        """See BzrDir.create_repository."""
946
945
        return self._format.repository_format.initialize(self, shared)
947
946
 
948
947
    def needs_format_conversion(self, format=None):
953
952
        return True
954
953
 
955
954
    def open_repository(self):
956
 
        """See ControlDir.open_repository."""
 
955
        """See BzrDir.open_repository."""
957
956
        from bzrlib.plugins.weave_fmt.repository import RepositoryFormat4
958
957
        return RepositoryFormat4().open(self, _found=True)
959
958
 
965
964
    """
966
965
 
967
966
    def has_workingtree(self):
968
 
        """See ControlDir.has_workingtree."""
 
967
        """See BzrDir.has_workingtree."""
969
968
        return True
970
969
    
971
970
    def open_repository(self):
972
 
        """See ControlDir.open_repository."""
 
971
        """See BzrDir.open_repository."""
973
972
        from bzrlib.plugins.weave_fmt.repository import RepositoryFormat5
974
973
        return RepositoryFormat5().open(self, _found=True)
975
974
 
976
975
    def open_workingtree(self, unsupported=False,
977
976
            recommend_upgrade=True):
978
 
        """See ControlDir.create_workingtree."""
 
977
        """See BzrDir.create_workingtree."""
979
978
        from bzrlib.plugins.weave_fmt.workingtree import WorkingTreeFormat2
980
979
        wt_format = WorkingTreeFormat2()
981
980
        # we don't warn here about upgrades; that ought to be handled for the
990
989
    """
991
990
 
992
991
    def has_workingtree(self):
993
 
        """See ControlDir.has_workingtree."""
 
992
        """See BzrDir.has_workingtree."""
994
993
        return True
995
994
 
996
995
    def open_repository(self):
997
 
        """See ControlDir.open_repository."""
 
996
        """See BzrDir.open_repository."""
998
997
        from bzrlib.plugins.weave_fmt.repository import RepositoryFormat6
999
998
        return RepositoryFormat6().open(self, _found=True)
1000
999
 
1001
1000
    def open_workingtree(self, unsupported=False, recommend_upgrade=True):
1002
 
        """See ControlDir.create_workingtree."""
 
1001
        """See BzrDir.create_workingtree."""
1003
1002
        # we don't warn here about upgrades; that ought to be handled for the
1004
1003
        # bzrdir as a whole
1005
1004
        from bzrlib.plugins.weave_fmt.workingtree import WorkingTreeFormat2