Patchwork [5,of,5] journal: take wlock for writting the 'shared' file

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 8, 2016, 10:12 p.m.
Message ID <2d243d858834fe435df8.1470694360@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/16216/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 8, 2016, 10:12 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1470672310 -7200
#      Mon Aug 08 18:05:10 2016 +0200
# Node ID 2d243d858834fe435df867698c8f95011b744cec
# Parent  2e645d93a1c75f43d02942272345f81f6ab5233d
# EXP-Topic vfs.ward
journal: take wlock for writting the 'shared' file

As we did for the shared extension itself, we add some locking around the write
of the 'shared' file.
timeless - Aug. 11, 2016, 7 a.m.
Pierre-Yves David wrote:
> journal: take wlock for writting the 'shared' file

writing

Patch

diff -r 2e645d93a1c7 -r 2d243d858834 hgext/journal.py
--- a/hgext/journal.py	Sun Aug 07 17:15:19 2016 +0200
+++ b/hgext/journal.py	Mon Aug 08 18:05:10 2016 +0200
@@ -165,9 +165,10 @@  def _mergeentriesiter(*iterables, **kwar
 
 def wrappostshare(orig, sourcerepo, destrepo, **kwargs):
     """Mark this shared working copy as sharing journal information"""
-    orig(sourcerepo, destrepo, **kwargs)
-    with destrepo.vfs('shared', 'a') as fp:
-        fp.write('journal\n')
+    with destrepo.wlock():
+        orig(sourcerepo, destrepo, **kwargs)
+        with destrepo.vfs('shared', 'a') as fp:
+            fp.write('journal\n')
 
 def unsharejournal(orig, ui, repo, repopath):
     """Copy shared journal entries into this repo when unsharing"""