changeset 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 0ff6b65afeb0
files mercurial/localrepo.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Dec 04 13:49:45 2014 -0800
+++ b/mercurial/localrepo.py	Thu Dec 04 16:35:03 2014 -0800
@@ -891,7 +891,10 @@
                                      "journal",
                                      aftertrans(renames),
                                      self.store.createmode)
-        tr.addfinalize('repo.store.write', self.store.write)
+        # note: writing the fncache only during finalize mean that the file is
+        # outdated when running hooks. As fncache is used for streaming clone,
+        # this is not expected to break anything that happen during the hooks.
+        tr.addfinalize('flush-fncache', self.store.write)
         self._transref = weakref.ref(tr)
         return tr