lock.release: do not unlink inherited locks
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances. A subprocess unlinking a lock will lead to potential
corruption from other concurrent processes.
--- a/mercurial/lock.py Thu Sep 24 16:00:41 2015 -0700
+++ b/mercurial/lock.py Thu Sep 24 16:03:26 2015 -0700
@@ -204,10 +204,11 @@
if self.releasefn:
self.releasefn()
finally:
- try:
- self.vfs.unlink(self.f)
- except OSError:
- pass
+ if not self._parentheld:
+ try:
+ self.vfs.unlink(self.f)
+ except OSError:
+ pass
for callback in self.postrelease:
callback()