mercurial/localrepo.py
changeset 24744 bedefc611f25
parent 24740 d283517b260b
child 24745 bc34b286781f
equal deleted inserted replaced
24743:a2ef1dc3b59b 24744:bedefc611f25
  1202 
  1202 
  1203     def wlock(self, wait=True):
  1203     def wlock(self, wait=True):
  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()
  1210             if l is not None and l.held:
  1215             if l is not None and l.held:
  1211                 msg = '"lock" taken before "wlock"\n'
  1216                 msg = '"lock" taken before "wlock"\n'
  1212                 if self.ui.tracebackflag:
  1217                 if self.ui.tracebackflag:
  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():
  1223                 self.dirstate.invalidate()
  1224                 self.dirstate.invalidate()
  1224             else:
  1225             else: