Patchwork [3,of,5] fakemergerecord: take wlock to write the merge state

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 8, 2016, 10:12 p.m.
Message ID <ba09af443e057760556e.1470694358@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/16217/
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 1470670425 -7200
#      Mon Aug 08 17:33:45 2016 +0200
# Node ID ba09af443e057760556e73a353e2ee28e2af1c34
# Parent  8eefbe50ec3f68844a02dce82c6461a9241c1138
# EXP-Topic vfs.ward
fakemergerecord: take wlock to write the merge state

The merge state is supposed to be covered by the wlock. We fix the test
extensions to comply to that.

Patch

diff -r 8eefbe50ec3f -r ba09af443e05 tests/fakemergerecord.py
--- a/tests/fakemergerecord.py	Sun Aug 07 17:10:47 2016 +0200
+++ b/tests/fakemergerecord.py	Mon Aug 08 17:33:45 2016 +0200
@@ -16,10 +16,11 @@  command = cmdutil.command(cmdtable)
          [('X', 'mandatory', None, 'add a fake mandatory record'),
           ('x', 'advisory', None, 'add a fake advisory record')], '')
 def fakemergerecord(ui, repo, *pats, **opts):
-    ms = merge.mergestate.read(repo)
-    records = ms._makerecords()
-    if opts.get('mandatory'):
-        records.append(('X', 'mandatory record'))
-    if opts.get('advisory'):
-        records.append(('x', 'advisory record'))
-    ms._writerecords(records)
+    with repo.wlock():
+        ms = merge.mergestate.read(repo)
+        records = ms._makerecords()
+        if opts.get('mandatory'):
+            records.append(('X', 'mandatory record'))
+        if opts.get('advisory'):
+            records.append(('x', 'advisory record'))
+        ms._writerecords(records)