locking: grab the wlock before touching the dirstate in `perfdirstatewrite`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 05 Feb 2023 16:54:26 +0100
changeset 50008 e859f440daa9
parent 50007 2aacd560cf59
child 50009 115510658219
locking: grab the wlock before touching the dirstate in `perfdirstatewrite` If we touch the dirstate, we should hold the `wlock`.
contrib/perf.py
--- a/contrib/perf.py	Tue Dec 13 04:22:19 2022 +0100
+++ b/contrib/perf.py	Sun Feb 05 16:54:26 2023 +0100
@@ -235,6 +235,7 @@
 
 cmdtable = {}
 
+
 # for "historical portability":
 # define parsealiases locally, because cmdutil.parsealiases has been
 # available since 1.5 (or 6252852b4332)
@@ -573,7 +574,6 @@
 
 
 def formatone(fm, timings, title=None, result=None, displayall=False):
-
     count = len(timings)
 
     fm.startitem()
@@ -1474,7 +1474,8 @@
     def d():
         ds.write(repo.currenttransaction())
 
-    timer(d, setup=setup)
+    with repo.wlock():
+        timer(d, setup=setup)
     fm.end()