Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 23511:acc73273b27e
fncache: document the fact fncache is outdate at hook run time
Using 'addfinalize' to generate 'fncache' means that no pending version of the
file will be generated for the hooks. We would have to use the
'addfilegenerator' method to get such result. However the 'fncachevfs' (who
decide that a write is necessary) have no access to the transaction to register
such file generation at add time. Having the transaction accessible to the 'vfs'
is too much trouble for no benefit. This outdated 'fncache' file at hook time is
not expected to be an issue.
The previous move from 'onclose' to 'addfinalize' had no impact on this timing.
I'm documenting it now because I looked at it.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 04 Dec 2014 16:35:03 -0800 |
parents | 065c0334846f |
children | deabbe7ed54b |
comparison
equal
deleted
inserted
replaced
23510:065c0334846f | 23511:acc73273b27e |
---|---|
889 vfsmap = {'plain': self.opener} # root of .hg/ | 889 vfsmap = {'plain': self.opener} # root of .hg/ |
890 tr = transaction.transaction(rp, self.sopener, vfsmap, | 890 tr = transaction.transaction(rp, self.sopener, vfsmap, |
891 "journal", | 891 "journal", |
892 aftertrans(renames), | 892 aftertrans(renames), |
893 self.store.createmode) | 893 self.store.createmode) |
894 tr.addfinalize('repo.store.write', self.store.write) | 894 # note: writing the fncache only during finalize mean that the file is |
895 # outdated when running hooks. As fncache is used for streaming clone, | |
896 # this is not expected to break anything that happen during the hooks. | |
897 tr.addfinalize('flush-fncache', self.store.write) | |
895 self._transref = weakref.ref(tr) | 898 self._transref = weakref.ref(tr) |
896 return tr | 899 return tr |
897 | 900 |
898 def _journalfiles(self): | 901 def _journalfiles(self): |
899 return ((self.svfs, 'journal'), | 902 return ((self.svfs, 'journal'), |