remote-bzr: use proper push method

Do not just randomly synchronize the revisions with no checks at all. I don't have any evidence that there's anything wrong with the current code, which Bazaar seems to use, but for different purposes. Let's use the logic Bazaar UI uses to avoid surprises. Also, add a non-ff check. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Apr 25, 2013 at 06:25 UTC fbd3f0e53ca9b88709ceadea48d9383c7ffa9382
1 file changed +5 -5
contrib/remote-helpers/git-remote-bzr
+5 -5
@@ -630,12 +630,12 @@ def do_export(parser):
630 for ref, revid in parsed_refs.iteritems():
631 if ref == 'refs/heads/master':
632 repo.generate_revision_history(revid, marks.get_tip('master'))
633 - revno, revid = repo.last_revision_info()
633 if peer:
635 - if hasattr(peer, "import_last_revision_info_and_tags"):
636 - peer.import_last_revision_info_and_tags(repo, revno, revid)
637 - else:
638 - peer.import_last_revision_info(repo.repository, revno, revid)
634 + try:
635 + repo.push(peer, stop_revision=revid)
636 + except bzrlib.errors.DivergedBranches:
637 + print "error %s non-fast forward" % ref
638 + continue
639 else:
640 wt = repo.bzrdir.open_workingtree()
641 wt.update()