399
399
def _get_branch_formats_to_test():
400
400
return [(HgBranchFormat(), HgBranchFormat())]
403
def is_compatible(source, target):
403
def is_compatible(cls, source, target):
404
404
"""See InterBranch.is_compatible()."""
405
405
return (isinstance(source, HgBranch) and isinstance(target, HgBranch))
565
565
return self._lookup_revno(self.new_revid)
568
class InterHgBranch(InterBranch):
571
def _get_branch_formats_to_test():
572
return [(HgBranchFormat(), HgBranchFormat())]
575
def is_compatible(self, source, target):
576
return (isinstance(source, HgBranch) and
577
isinstance(target, HgBranch))
568
580
class InterToHgBranch(InterBranch):
569
581
"""InterBranch implementation that pushes into Hg."""
581
593
def _push_helper(self, stop_revision=None, overwrite=False,
583
graph = self.source.repository.get_graph()
595
interrepo = InterRepository(self.source.repository, self.target.repository)
584
596
if stop_revision is None:
585
597
stop_revision = self.source.last_revision()
586
revs = graph.find_difference(self.target.last_revision(),
588
cg, revidmap = dchangegroup(self.source.repository,
589
self.target.mapping, revs, lossy=lossy)
598
cg, revidmap = interrepo._generate_changegroup(stop_revision, self.target.mapping, lossy=lossy)
590
599
heads = [revidmap[stop_revision]]
591
600
remote = self.target.repository._hgrepo
592
601
if remote.capable('unbundle'):
593
602
remote.unbundle(cg, heads, None)
595
605
remote.addchangegroup(cg, 'push', self.source.base)
598
return dict((k, self.target.mapping.revision_id_foreign_to_bzr(v)) for (k, v) in revidmap.iteritems())
606
return dict((k, self.target.mapping.revision_id_foreign_to_bzr(v)) for (k, v) in revidmap.iteritems())
601
609
def push(self, overwrite=True, stop_revision=None,