git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] remote-bzr: use proper push method

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 25, 2013, 11:25 UTC
Message-ID
<1366889137-19700-1-git-send-email-felipe.contreras@gmail.com>

Not just randomly synchronize the revisions with no checks at all. This is the way bazaar's UI does it.

Also, add a non-ff check.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
This patch should probably go to maint, as the results of pushing the way we
currently push are not really understood. Perhaps it's similar to a 'git push
 --force', or perhaps it can potentially screw the repository.
It's better to be safe and just do what bazaar does.
 contrib/remote-helpers/git-remote-bzr | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index 8c316fe..cb8d081 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -639,12 +639,12 @@ def do_export(parser):
     for ref, revid in parsed_refs.iteritems():
         if ref == 'refs/heads/master':
             repo.generate_revision_history(revid, marks.get_tip('master'))
-            revno, revid = repo.last_revision_info()
             if peer:
-                if hasattr(peer, "import_last_revision_info_and_tags"):
-                    peer.import_last_revision_info_and_tags(repo, revno, revid)
-                else:
-                    peer.import_last_revision_info(repo.repository, revno, revid)
+                try:
+                    repo.push(peer, stop_revision=revid)
+                except bzrlib.errors.DivergedBranches:
+                    print "error %s non-fast forward" % ref
+                    continue
             else:
                 wt = repo.bzrdir.open_workingtree()
                 wt.update()
-- 
1.8.2.1
Next: Thomas Rast
Message 1 of 6 in “remote-bzr: use proper push method”
  1. remote-bzr: use proper push methodFelipe Contreras, Apr 25, 2013
  2. Thomas RastApr 25, 2013
  3. Junio C HamanoApr 25, 2013
  4. Felipe ContrerasApr 25, 2013
  5. Felipe ContrerasApr 25, 2013
  6. Junio C HamanoApr 25, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.