mercurial/lock.py
changeset 26474 431094a3b21f
parent 26473 5f94e64f182c
child 26498 e8564e04382d
--- 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: