Skip to content

Commit d6bb913

Browse files
Felipe Contrerasgitster
authored andcommitted
remote-bzr: fix bad state issue
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 23df5e4 commit d6bb913

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

contrib/remote-helpers/git-remote-bzr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import os
3232
import json
3333
import re
3434
import StringIO
35+
import atexit
3536

3637
NAME_RE = re.compile('^([^<>]+)')
3738
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
@@ -728,6 +729,7 @@ def main(args):
728729
blob_marks = {}
729730
parsed_refs = {}
730731
files_cache = {}
732+
marks = None
731733

732734
gitdir = os.environ['GIT_DIR']
733735
dirname = os.path.join(gitdir, 'bzr', alias)
@@ -754,6 +756,10 @@ def main(args):
754756
die('unhandled command: %s' % line)
755757
sys.stdout.flush()
756758

759+
def bye():
760+
if not marks:
761+
return
757762
marks.store()
758763

764+
atexit.register(bye)
759765
sys.exit(main(sys.argv))

0 commit comments

Comments
 (0)