/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to fetch.py

Reoncile InterGitRepository objects.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        return None
60
60
 
61
61
 
62
 
def import_git_pack(repo, pack):
63
 
    raise NotImplementedError(import_git_pack)
 
62
def import_git_object(repo, object):
 
63
    raise NotImplementedError(import_git_object)
64
64
 
65
65
 
66
66
class InterGitRepository(InterRepository):
67
67
 
 
68
    _matching_repo_format = GitFormat()
 
69
 
 
70
    @staticmethod
 
71
    def _get_repo_format_to_test():
 
72
        return None
 
73
 
68
74
    def copy_content(self, revision_id=None, pb=None):
69
75
        """See InterRepository.copy_content."""
70
76
        self.fetch(revision_id, pb, find_ghosts=False)
84
90
            else:
85
91
                ret = [mapping.revision_id_bzr_to_foreign(revision_id)]
86
92
            return [rev for rev in ret if not self.target.has_revision(mapping.revision_id_foreign_to_bzr(revision_id))]
87
 
        self._fetch_packs(determine_wants, BzrFetchGraphWalker(self.target, mapping), progress)
88
 
 
89
 
 
90
 
class InterFromLocalGitRepository(InterGitRepository):
91
 
 
92
 
    _matching_repo_format = GitFormat()
93
 
 
94
 
    @staticmethod
95
 
    def _get_repo_format_to_test():
96
 
        return None
97
 
 
98
 
    def _fetch_packs(self, determine_wants, graph_walker, progress):
 
93
        graph_walker = BzrFetchGraphWalker(self.target, mapping)
99
94
        self.target.lock_write()
100
95
        try:
101
 
            stream = StringIO()
102
 
            self.source.fetch_pack(determine_wants, graph_walker, stream.write, progress)
103
 
            import_git_pack(self.target, stream)
 
96
            for o in self.source.fetch_objects(determine_wants, graph_walker, progress):
 
97
                import_git_object(o)
104
98
        finally:
105
99
            self.target.unlock()
106
100
 
109
103
        """Be compatible with GitRepository."""
110
104
        # FIXME: Also check target uses VersionedFile
111
105
        return isinstance(source, LocalGitRepository) and target.supports_rich_root()
112
 
 
113
 
 
114
 
class InterFromRemoteGitRepository(InterGitRepository):
115
 
 
116
 
    _matching_repo_format = GitFormat()
117
 
 
118
 
    @staticmethod
119
 
    def _get_repo_format_to_test():
120
 
        return None
121
 
 
122
 
    def _fetch_packs(self, determine_wants, graph_walker, progress):
123
 
        self.target.lock_write()
124
 
        try:
125
 
            stream = StringIO()
126
 
            self.source.fetch_pack(determine_wants, graph_walker, stream.write, progress)
127
 
            import_git_pack(self.target, stream)
128
 
        finally:
129
 
            self.target.unlock()
130
 
 
131
 
    @staticmethod
132
 
    def is_compatible(source, target):
133
 
        """Be compatible with GitRepository."""
134
 
        # FIXME: Also check target uses VersionedFile
135
 
        return isinstance(source, RemoteGitRepository) and target.supports_rich_root()
136
 
 
137
 
 
138