Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 15583:926a06f7a353
lock: add mechanism to register post release callback
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 28 Nov 2011 15:05:26 +0100 |
parents | 1eefa4451c56 |
children | 9df9444e96ec |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sat Nov 26 00:10:31 2011 +0100 +++ b/mercurial/localrepo.py Mon Nov 28 15:05:26 2011 +0100 @@ -912,6 +912,15 @@ acquirefn() return l + def _postrelease(self, callback): + """add a callback to the current repository lock. + + The callback will be executed on lock release.""" + l = self._lockref and self._lockref() + assert l is not None + assert l.held + l.postreleasehooks.append(callback) + def lock(self, wait=True): '''Lock the repository store (.hg/store) and return a weak reference to the lock. Use this before modifying the store (e.g. committing or