Mercurial > hg
changeset 28959:518c3e392f75
lock: clear postrelease hooks list after usage
Post release hooks should only be called once. Setting the
list to None after usage will prevent accidental usage after
they are used.
In addition, it is easy for reference cycles to sneak into hook
functions. Clearing the hooks after usage helps prevent these
cycles.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 16 Apr 2016 09:00:15 -0700 |
parents | 77e566fe31ec |
children | 14e683d6b273 |
files | mercurial/lock.py |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/lock.py Sun Mar 27 21:05:55 2016 +0900 +++ b/mercurial/lock.py Sat Apr 16 09:00:15 2016 -0700 @@ -234,6 +234,8 @@ if not self._parentheld: for callback in self.postrelease: callback() + # Prevent double usage and help clear cycles. + self.postrelease = None def release(*locks): for lock in locks: