Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 16680:d0e419b0f7de stable
tag: run commit hook when lock is released (issue3344)
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sat, 12 May 2012 20:06:02 +0200 |
parents | 2950d186a927 |
children | d947e1da1259 9a99224a6409 |
comparison
equal
deleted
inserted
replaced
16679:2950d186a927 | 16680:d0e419b0f7de |
---|---|
918 | 918 |
919 The callback will be executed on lock release.""" | 919 The callback will be executed on lock release.""" |
920 l = self._lockref and self._lockref() | 920 l = self._lockref and self._lockref() |
921 if l: | 921 if l: |
922 l.postrelease.append(callback) | 922 l.postrelease.append(callback) |
923 else: | |
924 callback() | |
923 | 925 |
924 def lock(self, wait=True): | 926 def lock(self, wait=True): |
925 '''Lock the repository store (.hg/store) and return a weak reference | 927 '''Lock the repository store (.hg/store) and return a weak reference |
926 to the lock. Use this before modifying the store (e.g. committing or | 928 to the lock. Use this before modifying the store (e.g. committing or |
927 stripping). If you are opening a transaction, get a lock as well.)''' | 929 stripping). If you are opening a transaction, get a lock as well.)''' |
1207 self.dirstate.setparents(ret) | 1209 self.dirstate.setparents(ret) |
1208 ms.reset() | 1210 ms.reset() |
1209 finally: | 1211 finally: |
1210 wlock.release() | 1212 wlock.release() |
1211 | 1213 |
1212 self.hook("commit", node=hex(ret), parent1=hookp1, parent2=hookp2) | 1214 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2): |
1215 self.hook("commit", node=node, parent1=parent1, parent2=parent2) | |
1216 self._afterlock(commithook) | |
1213 return ret | 1217 return ret |
1214 | 1218 |
1215 def commitctx(self, ctx, error=False): | 1219 def commitctx(self, ctx, error=False): |
1216 """Add a new revision to current repository. | 1220 """Add a new revision to current repository. |
1217 Revision information is passed via the context argument. | 1221 Revision information is passed via the context argument. |