161
162
return objects[sha]
162
163
return reconstruct_git_object(repo, mapping, sha)
163
164
parent_invs = [repo.get_inventory(r) for r in rev.parent_ids]
164
import_git_tree(repo, mapping, "", root_tree, inv, parent_invs, lookup_object)
165
import_git_tree(repo, mapping, "", root_tree, inv, parent_invs,
165
167
repo.add_revision(rev.revision_id, rev, inv)
233
235
"""Be compatible with GitRepository."""
234
236
# FIXME: Also check target uses VersionedFile
235
237
return (isinstance(source, GitRepository) and
236
target.supports_rich_root())
238
target.supports_rich_root() and
239
not isinstance(target, GitRepository))
242
class InterGitRepository(InterRepository):
244
_matching_repo_format = GitFormat()
247
def _get_repo_format_to_test():
250
def copy_content(self, revision_id=None, pb=None):
251
"""See InterRepository.copy_content."""
252
self.fetch(revision_id, pb, find_ghosts=False)
254
def fetch(self, revision_id=None, pb=None, find_ghosts=False,
257
mapping = self.source.get_mapping()
259
info("git: %s", text)
261
if revision_id is None:
262
determine_wants = lambda x: [y for y in x.values() if not y in r.object_store]
264
args = [mapping.revision_id_bzr_to_foreign(revision_id)]
265
determine_wants = lambda x: [y for y in args if not y in r.object_store]
267
graphwalker = SimpleFetchGraphWalker(r.heads().values(), r.get_parents)
268
f, commit = r.object_store.add_pack()
270
self.source._git.fetch_pack(path, determine_wants, graphwalker, f.write, progress)
278
def is_compatible(source, target):
279
"""Be compatible with GitRepository."""
280
return (isinstance(source, GitRepository) and
281
isinstance(target, GitRepository))