comparison mercurial/localrepo.py @ 24792:7d0421de8de3

hooks: add a 'txnabort' hook This hook will be called whenever a transaction is aborted. This will make it easy for people to clean up temporary content they may have created during a transaction.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 16 Apr 2015 05:36:49 -0400
parents 59406b8b1303
children 9fbf0a2a72a1
comparison
equal deleted inserted replaced
24791:89c5881d692c 24792:7d0421de8de3
973 def hook(): 973 def hook():
974 reporef().hook('txnclose', throw=False, txnname=desc, 974 reporef().hook('txnclose', throw=False, txnname=desc,
975 **tr2.hookargs) 975 **tr2.hookargs)
976 reporef()._afterlock(hook) 976 reporef()._afterlock(hook)
977 tr.addfinalize('txnclose-hook', txnclosehook) 977 tr.addfinalize('txnclose-hook', txnclosehook)
978 def txnaborthook(tr2):
979 """To be run if transaction is aborted
980 """
981 reporef().hook('txnabort', throw=False, txnname=desc,
982 **tr2.hookargs)
983 tr.addabort('txnabort-hook', txnaborthook)
978 self._transref = weakref.ref(tr) 984 self._transref = weakref.ref(tr)
979 return tr 985 return tr
980 986
981 def _journalfiles(self): 987 def _journalfiles(self):
982 return ((self.svfs, 'journal'), 988 return ((self.svfs, 'journal'),