comparison mercurial/lock.py @ 26474:431094a3b21f

lock.release: don't call postrelease functions for inherited locks Review feedback from Pierre-Yves David. The postrelease functions typically assume the lock is not held at all.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 04 Oct 2015 20:04:44 -0700
parents 5f94e64f182c
children e8564e04382d
comparison
equal deleted inserted replaced
26473:5f94e64f182c 26474:431094a3b21f
219 if not self._parentheld: 219 if not self._parentheld:
220 try: 220 try:
221 self.vfs.unlink(self.f) 221 self.vfs.unlink(self.f)
222 except OSError: 222 except OSError:
223 pass 223 pass
224 for callback in self.postrelease: 224 # The postrelease functions typically assume the lock is not held
225 callback() 225 # at all.
226 if not self._parentheld:
227 for callback in self.postrelease:
228 callback()
226 229
227 def release(*locks): 230 def release(*locks):
228 for lock in locks: 231 for lock in locks:
229 if lock is not None: 232 if lock is not None:
230 lock.release() 233 lock.release()