Patchwork [2,of,4] fncache: document the fact fncache is outdate at hook run time

mail settings
Submitter Pierre-Yves David
Date Dec. 9, 2014, 1:26 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/7023/
State Accepted
Commit acc73273b27e8d8b9599e4b20e486400b5026fbe
Headers show


Pierre-Yves David - Dec. 9, 2014, 1:26 a.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1417739703 28800
#      Thu Dec 04 16:35:03 2014 -0800
# Node ID 4e336e79c48b48dda748198dde5a66ecc56edd2a
# Parent  46c541236d6aa784fe3d863589b9eec1ff9c644b
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.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -889,11 +889,14 @@  class localrepository(object):
         vfsmap = {'plain': self.opener} # root of .hg/
         tr = transaction.transaction(rp, self.sopener, vfsmap,
-        tr.addfinalize('',
+        # 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._transref = weakref.ref(tr)
         return tr
     def _journalfiles(self):
         return ((self.svfs, 'journal'),