Patchwork [4,of,5] debugbuilddag: take wlock to cover '.hg/localtags'

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 8, 2016, 10:12 p.m.
Message ID <2e645d93a1c75f43d029.1470694359@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/16219/
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 1470582919 -7200
#      Sun Aug 07 17:15:19 2016 +0200
# Node ID 2e645d93a1c75f43d02942272345f81f6ab5233d
# Parent  ba09af443e057760556e73a353e2ee28e2af1c34
# EXP-Topic vfs.ward
debugbuilddag: take wlock to cover '.hg/localtags'

This debug command can write local tags. local tags are in the .hgdirectory and
should be covered by the 'wlock'. This is now covered.

Patch

diff -r ba09af443e05 -r 2e645d93a1c7 mercurial/commands.py
--- a/mercurial/commands.py	Mon Aug 08 17:33:45 2016 +0200
+++ b/mercurial/commands.py	Sun Aug 07 17:15:19 2016 +0200
@@ -1987,8 +1987,9 @@  def debugbuilddag(ui, repo, text=None,
 
     tags = []
 
-    lock = tr = None
+    wlock = lock = tr = None
     try:
+        wlock = repo.wlock()
         lock = repo.lock()
         tr = repo.transaction("builddag")
 
@@ -2073,7 +2074,7 @@  def debugbuilddag(ui, repo, text=None,
             repo.vfs.write("localtags", "".join(tags))
     finally:
         ui.progress(_('building'), None)
-        release(tr, lock)
+        release(tr, lock, wlock)
 
 @command('debugbundle',
         [('a', 'all', None, _('show all details')),