Git development
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v3 3/9] remote-bzr: fix bad state issue
Date: Fri, 26 Apr 2013 16:12:33 -0500	[thread overview]
Message-ID: <1367010759-17928-4-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1367010759-17928-1-git-send-email-felipe.contreras@gmail.com>

Carried from remote-hg.

The problem reportedly happened after doing a push that fails, the abort
causes the state of remote-hg to go bad, this happens because
remote-hg's marks are not stored, but 'git fast-export' marks are.

Ensure that the marks are _always_ stored.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/git-remote-bzr | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index 87c54bf..7b6584e 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -32,6 +32,7 @@ import os
 import json
 import re
 import StringIO
+import atexit
 
 NAME_RE = re.compile('^([^<>]+)')
 AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
@@ -728,6 +729,7 @@ def main(args):
     blob_marks = {}
     parsed_refs = {}
     files_cache = {}
+    marks = None
 
     gitdir = os.environ['GIT_DIR']
     dirname = os.path.join(gitdir, 'bzr', alias)
@@ -754,6 +756,10 @@ def main(args):
             die('unhandled command: %s' % line)
         sys.stdout.flush()
 
+def bye():
+    if not marks:
+        return
     marks.store()
 
+atexit.register(bye)
 sys.exit(main(sys.argv))
-- 
1.8.2.1.1031.g2ee5873

  parent reply	other threads:[~2013-04-26 21:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 21:12 [PATCH v3 0/9] remote-helpers: fixes and cleanups Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 1/9] remote-helpers: trivial cleanups Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 2/9] remote-hg: remove extra check Felipe Contreras
2013-04-26 21:12 ` Felipe Contreras [this message]
2013-04-26 21:12 ` [PATCH v3 4/9] remote-bzr: add support to push URLs Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 5/9] remote-hg: use hashlib instead of hg sha1 util Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 6/9] remote-bzr: store converted URL Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 7/9] remote-bzr: tell bazaar to be quiet Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 8/9] remote-bzr: strip extra newline Felipe Contreras
2013-04-26 21:12 ` [PATCH v3 9/9] remote-bzr: use proper push method Felipe Contreras
2013-04-26 22:16 ` [PATCH v3 0/9] remote-helpers: fixes and cleanups Junio C Hamano
2013-04-26 22:23   ` Junio C Hamano
2013-04-26 22:40     ` Felipe Contreras
2013-04-26 23:04     ` Junio C Hamano
2013-04-27  2:56 ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367010759-17928-4-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox