~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-04-16 11:08:11 UTC
  • mfrom: (6521 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6522.
  • Revision ID: jelmer@samba.org-20120416110811-0y996ihqy9o2bb1t
Merge bzr.dev.

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