##// END OF EJS Templates
wlock: only issue devel warning when actually acquiring the lock...
Pierre-Yves David -
r24744:bedefc61 default
parent child Browse files
Show More
@@ -1204,6 +1204,11 b' class localrepository(object):'
1204 '''Lock the non-store parts of the repository (everything under
1204 '''Lock the non-store parts of the repository (everything under
1205 .hg except .hg/store) and return a weak reference to the lock.
1205 .hg except .hg/store) and return a weak reference to the lock.
1206 Use this before modifying files in .hg.'''
1206 Use this before modifying files in .hg.'''
1207 l = self._wlockref and self._wlockref()
1208 if l is not None and l.held:
1209 l.lock()
1210 return l
1211
1207 if (self.ui.configbool('devel', 'all')
1212 if (self.ui.configbool('devel', 'all')
1208 or self.ui.configbool('devel', 'check-locks')):
1213 or self.ui.configbool('devel', 'check-locks')):
1209 l = self._lockref and self._lockref()
1214 l = self._lockref and self._lockref()
@@ -1213,10 +1218,6 b' class localrepository(object):'
1213 util.debugstacktrace(msg, 1)
1218 util.debugstacktrace(msg, 1)
1214 else:
1219 else:
1215 self.ui.write_err(msg)
1220 self.ui.write_err(msg)
1216 l = self._wlockref and self._wlockref()
1217 if l is not None and l.held:
1218 l.lock()
1219 return l
1220
1221
1221 def unlock():
1222 def unlock():
1222 if self.dirstate.pendingparentchange():
1223 if self.dirstate.pendingparentchange():
@@ -15,6 +15,22 b''
15 > wl = repo.wlock()
15 > wl = repo.wlock()
16 > wl.release()
16 > wl.release()
17 > lo.release()
17 > lo.release()
18 >
19 > @command('properlocking', [], '')
20 > def properlocking(ui, repo):
21 > """check that reentrance is fine"""
22 > wl = repo.wlock()
23 > lo = repo.lock()
24 > tr = repo.transaction('proper')
25 > tr2 = repo.transaction('proper')
26 > lo2 = repo.lock()
27 > wl2 = repo.wlock()
28 > wl2.release()
29 > lo2.release()
30 > tr2.close()
31 > tr.close()
32 > lo.release()
33 > wl.release()
18 > EOF
34 > EOF
19
35
20 $ cat << EOF >> $HGRCPATH
36 $ cat << EOF >> $HGRCPATH
@@ -64,4 +80,5 b''
64 */mercurial/dispatch.py:* in <lambda> (glob)
80 */mercurial/dispatch.py:* in <lambda> (glob)
65 */mercurial/util.py:* in check (glob)
81 */mercurial/util.py:* in check (glob)
66 $TESTTMP/buggylocking.py:* in buggylocking (glob)
82 $TESTTMP/buggylocking.py:* in buggylocking (glob)
83 $ hg properlocking
67 $ cd ..
84 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now