922 self.store.createmode) |
922 self.store.createmode) |
923 # note: writing the fncache only during finalize mean that the file is |
923 # note: writing the fncache only during finalize mean that the file is |
924 # outdated when running hooks. As fncache is used for streaming clone, |
924 # outdated when running hooks. As fncache is used for streaming clone, |
925 # this is not expected to break anything that happen during the hooks. |
925 # this is not expected to break anything that happen during the hooks. |
926 tr.addfinalize('flush-fncache', self.store.write) |
926 tr.addfinalize('flush-fncache', self.store.write) |
|
927 # we must avoid cyclic reference between repo and transaction. |
|
928 reporef = weakref.ref(self) |
|
929 def txnclosehook(tr2): |
|
930 """To be run if transaction is successful, will schedule a hook run |
|
931 """ |
|
932 def hook(): |
|
933 reporef().hook('txnclose', throw=False, txnname=desc, |
|
934 **tr2.hookargs) |
|
935 reporef()._afterlock(hook) |
|
936 tr.addfinalize('txnclose-hook', txnclosehook) |
927 self._transref = weakref.ref(tr) |
937 self._transref = weakref.ref(tr) |
928 return tr |
938 return tr |
929 |
939 |
930 def _journalfiles(self): |
940 def _journalfiles(self): |
931 return ((self.svfs, 'journal'), |
941 return ((self.svfs, 'journal'), |