diff 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
line wrap: on
line diff
--- a/mercurial/lock.py	Sun Oct 04 20:02:50 2015 -0700
+++ b/mercurial/lock.py	Sun Oct 04 20:04:44 2015 -0700
@@ -221,8 +221,11 @@
                         self.vfs.unlink(self.f)
                     except OSError:
                         pass
-            for callback in self.postrelease:
-                callback()
+            # The postrelease functions typically assume the lock is not held
+            # at all.
+            if not self._parentheld:
+                for callback in self.postrelease:
+                    callback()
 
 def release(*locks):
     for lock in locks: