526
526
class InterGitGitRepository(InterGitRepository):
527
527
"""InterRepository that copies between Git repositories."""
529
def fetch_objects(self, determine_wants, mapping, pb=None):
531
trace.note("git: %s", text)
532
graphwalker = self.target._git.get_graph_walker()
533
if isinstance(self.source, LocalGitRepository) and isinstance(self.target, LocalGitRepository):
534
return self.source._git.fetch(self.target._git, determine_wants,
536
elif isinstance(self.source, LocalGitRepository) and isinstance(self.target, RemoteGitRepository):
537
raise NotImplementedError
538
elif isinstance(self.source, RemoteGitRepository) and isinstance(self.target, LocalGitRepository):
539
f, commit = self.target._git.object_store.add_thin_pack()
541
refs = self.source._git.fetch_pack(determine_wants, graphwalker,
529
551
def fetch_refs(self, revision_id=None, pb=None, find_ghosts=False,
530
552
mapping=None, fetch_spec=None, branches=None):
531
553
if mapping is None:
532
554
mapping = self.source.get_mapping()
534
trace.info("git: %s", text)
535
555
r = self.target._git
536
556
if revision_id is not None:
537
557
args = [mapping.revision_id_bzr_to_foreign(revision_id)[0]]
543
563
determine_wants = r.object_store.determine_wants_all
545
565
determine_wants = lambda x: [y for y in args if not y in r.object_store]
566
return self.fetch_objects(determine_wants, mapping)
547
graphwalker = r.get_graph_walker()
548
f, commit = r.object_store.add_thin_pack()
550
refs = self.source.fetch_pack(determine_wants, graphwalker,
559
570
def is_compatible(source, target):