~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

UnfuckĀ upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
747
747
 
748
748
    def push_stores(self, branch_to):
749
749
        """See Branch.push_stores."""
750
 
        if (self._branch_format != branch_to._branch_format
751
 
            or self._branch_format != 4):
 
750
        if (not isinstance(self._branch_format, BzrBranchFormat4) or
 
751
            self._branch_format != branch_to._branch_format):
752
752
            from bzrlib.fetch import greedy_fetch
753
 
            mutter("falling back to fetch logic to push between %s(%s) and %s(%s)",
 
753
            mutter("Using fetch logic to push between %s(%s) and %s(%s)",
754
754
                   self, self._branch_format, branch_to, branch_to._branch_format)
755
755
            greedy_fetch(to_branch=branch_to, from_branch=self,
756
756
                         revision=self.last_revision())
757
757
            return
758
758
 
 
759
        # format 4 to format 4 logic only.
759
760
        store_pairs = ((self.text_store,      branch_to.text_store),
760
761
                       (self.inventory_store, branch_to.inventory_store),
761
762
                       (self.revision_store,  branch_to.revision_store))
802
803
                 "Please use Branch.open_downlevel, or a BzrBranchFormat's "
803
804
                 "open() method.", DeprecationWarning)
804
805
            if (not relax_version_check
805
 
                and self._branch_format not in (5, 6)):
806
 
                # and not self._branch_format.is_supported()
 
806
                and not self._branch_format.is_supported()):
807
807
                raise errors.UnsupportedFormatError(
808
808
                        'sorry, branch format %r not supported' % fmt,
809
809
                        ['use a different bzr version',
829
829
                ws.enable_cache = True
830
830
            return ws
831
831
 
832
 
        if self._branch_format == 4:
 
832
        if isinstance(self._branch_format, BzrBranchFormat4):
833
833
            self.inventory_store = get_store('inventory-store')
834
834
            self.text_store = get_store('text-store')
835
835
            self.revision_store = get_store('revision-store')
836
 
        elif self._branch_format == 5:
 
836
        elif isinstance(self._branch_format, BzrBranchFormat5):
837
837
            self.control_weaves = get_weave(u'')
838
838
            self.weave_store = get_weave(u'weaves')
839
839
            self.revision_store = get_store(u'revision-store', compressed=False)
840
 
        elif self._branch_format == 6:
 
840
        elif isinstance(self._branch_format, BzrBranchFormat6):
841
841
            self.control_weaves = get_weave(u'')
842
842
            self.weave_store = get_weave(u'weaves', prefixed=True)
843
843
            self.revision_store = get_store(u'revision-store', compressed=False,
1023
1023
            self._file_mode = None
1024
1024
 
1025
1025
    def _check_format(self, format):
1026
 
        """Check this branch format is supported.
 
1026
        """Identify the branch format if needed.
1027
1027
 
1028
 
        The format level is stored, as an integer, in
 
1028
        The format is stored as a reference to the format object in
1029
1029
        self._branch_format for code that needs to check it later.
1030
1030
 
1031
 
        In the future, we might need different in-memory Branch
1032
 
        classes to support downlevel branches.  But not yet.
1033
 
 
1034
1031
        The format parameter is either None or the branch format class
1035
1032
        used to open this branch.
1036
1033
        """
1037
1034
        if format is None:
1038
1035
            format = BzrBranchFormat.find_format(self._transport)
1039
 
        fmt = format.get_format_string()
1040
 
        mutter("got branch format %r", fmt)
1041
 
        if fmt == BZR_BRANCH_FORMAT_6:
1042
 
            self._branch_format = 6
1043
 
        elif fmt == BZR_BRANCH_FORMAT_5:
1044
 
            self._branch_format = 5
1045
 
        elif fmt == BZR_BRANCH_FORMAT_4:
1046
 
            self._branch_format = 4
 
1036
        self._branch_format = format
 
1037
        mutter("got branch format %s", self._branch_format)
1047
1038
 
1048
1039
    @needs_read_lock
1049
1040
    def get_root_id(self):