~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Aaron Bentley
  • Date: 2006-08-23 15:21:19 UTC
  • mto: (1910.2.43 format-bumps)
  • mto: This revision was merged to the branch mainline in revision 1997.
  • Revision ID: abentley@panoramicfeedback.com-20060823152119-7b8e92f344f65b35
Got intra-repository fetch working between model1 and 2 for all types

Show diffs side-by-side

added added

removed removed

Lines of Context:
2019
2019
            return self.source._eliminate_revisions_not_present(required_topo_revisions)
2020
2020
 
2021
2021
 
 
2022
class InterModel1and2(InterRepository):
 
2023
 
 
2024
    _matching_repo_format = None
 
2025
 
 
2026
    @staticmethod
 
2027
    def is_compatible(source, target):
 
2028
        if not isinstance(source, Repository):
 
2029
            return False
 
2030
        if not isinstance(target, Repository):
 
2031
            return False
 
2032
        if not source._format.rich_root_data and target._format.rich_root_data:
 
2033
            return True
 
2034
        else:
 
2035
            return False
 
2036
 
 
2037
    @needs_write_lock
 
2038
    def fetch(self, revision_id=None, pb=None):
 
2039
        """See InterRepository.fetch()."""
 
2040
        from bzrlib.fetch import Model1toKnit2Fetcher
 
2041
        f = Model1toKnit2Fetcher(to_repository=self.target,
 
2042
                                 from_repository=self.source,
 
2043
                                 last_revision=revision_id,
 
2044
                                 pb=pb)
 
2045
        return f.count_copied, f.failed_revisions
 
2046
 
 
2047
 
2022
2048
class InterKnit1and2(InterKnitRepo):
2023
2049
 
 
2050
    _matching_repo_format = None
 
2051
 
2024
2052
    @staticmethod
2025
2053
    def is_compatible(source, target):
2026
2054
        """Be compatible with Knit1 source and Knit2 target"""
2050
2078
InterRepository.register_optimiser(InterSameDataRepository)
2051
2079
InterRepository.register_optimiser(InterWeaveRepo)
2052
2080
InterRepository.register_optimiser(InterKnitRepo)
 
2081
InterRepository.register_optimiser(InterModel1and2)
2053
2082
InterRepository.register_optimiser(InterKnit1and2)
2054
2083
 
2055
2084
 
2121
2150
        # default format.
2122
2151
        # XXX: robertc 20060220 reinstate this when there are two supported
2123
2152
        # formats which do not have an optimal code path between them.
2124
 
        result.append((InterRepository,
2125
 
                       RepositoryFormat6(),
2126
 
                       RepositoryFormatKnit1()))
 
2153
        #result.append((InterRepository,
 
2154
        #               RepositoryFormat6(),
 
2155
        #               RepositoryFormatKnit1()))
2127
2156
        for optimiser in InterRepository._optimisers:
2128
 
            result.append((optimiser,
2129
 
                           optimiser._matching_repo_format,
2130
 
                           optimiser._matching_repo_format
2131
 
                           ))
 
2157
            if optimiser._matching_repo_format is not None:
 
2158
                result.append((optimiser,
 
2159
                               optimiser._matching_repo_format,
 
2160
                               optimiser._matching_repo_format
 
2161
                               ))
2132
2162
        # if there are specific combinations we want to use, we can add them 
2133
2163
        # here.
 
2164
        result.append((InterModel1and2, RepositoryFormat5(),
 
2165
                       RepositoryFormatKnit2()))
 
2166
        result.append((InterKnit1and2, RepositoryFormatKnit1(),
 
2167
                       RepositoryFormatKnit2()))
2134
2168
        return result
2135
2169
 
2136
2170