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

[PATCH 3/8] remote-{hg,bzr}: store marks only on success

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 29, 2014, 09:04 UTC
Message-ID
<1398762275-346-4-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1398762275-346-1-git-send-email-felipe.contreras@gmail.com>

Commit 2594a79 (remote-hg: fix bad state issue) originally introduced this code in order to avoid synchronization issues while pushing, because `git fast-export` might end up writing the marks before a crash in the remote helper occurs.

However, the problem is in `git fast-export`; the marks should only be written after both have finished successfully.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 git-remote-bzr.py | 8 +++-----
 git-remote-hg.py  | 8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/git-remote-bzr.py b/git-remote-bzr.py
index 9abb58e..71b138e 100755
--- a/git-remote-bzr.py
+++ b/git-remote-bzr.py
@@ -971,12 +971,10 @@ def main(args):
             die('unhandled command: %s' % line)
         sys.stdout.flush()
 
+    marks.store()
+
 def bye():
-    if not marks:
-        return
-    if not is_tmp:
-        marks.store()
-    else:
+    if is_tmp:
         shutil.rmtree(dirname)
 
 atexit.register(bye)
diff --git a/git-remote-hg.py b/git-remote-hg.py
index 204ceeb..8aca6dd 100755
--- a/git-remote-hg.py
+++ b/git-remote-hg.py
@@ -1258,12 +1258,10 @@ def main(args):
             die('unhandled command: %s' % line)
         sys.stdout.flush()
 
+    marks.store()
+
 def bye():
-    if not marks:
-        return
-    if not is_tmp:
-        marks.store()
-    else:
+    if is_tmp:
         shutil.rmtree(dirname)
 
 atexit.register(bye)
-- 
1.9.2+fc1.3.gade8541
Previous: Felipe ContrerasNext: Felipe Contreras
Message 4 of 10 in “remote-helper: fixes”
  1. 0/8 remote-helper: fixesFelipe Contreras, Apr 29, 2014
  2. 1/8 remote-hg: fix parsing of custom committerFelipe Contreras, Apr 29, 2014
  3. 2/8 remote-hg: update to 'public' phase when pushingFelipe Contreras, Apr 29, 2014
  4. 3/8 remote-{hg,bzr}: store marks only on successFelipe Contreras, Apr 29, 2014
  5. 4/8 remote-hg: properly detect missing contextsFelipe Contreras, Apr 29, 2014
  6. 5/8 t: remote-hg: split into setup testFelipe Contreras, Apr 29, 2014
  7. 6/8 git-remote-hg: use internal clone's hgrcFelipe Contreras, Apr 29, 2014
  8. 7/8 remote-hg: make sure we omit multiple headsFelipe Contreras, Apr 29, 2014
  9. 8/8 remote-hg: trivial cleanupsFelipe Contreras, Apr 29, 2014
  10. Philip OakleyApr 29, 2014

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.