[Request] [+ ] D10851: vfs: add a `register_file` method on the vfs class

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Wed Jun 9 14:38:38 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is used by the fncache vfs to register new file. Until now, `fncache` have
  been doing this "automatically" by monitoring write pattern. However this is
  fragile and when we copy files in place by other means, we need something more
  robuts. So we add an explicit method to do so.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10851

AFFECTED FILES
  mercurial/store.py
  mercurial/vfs.py

CHANGE DETAILS

diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -329,6 +329,9 @@
                     None  # pytype: disable=attribute-error
                 )
 
+    def register_file(self, path):
+        """generic hook point to lets fncache steer its stew"""
+
 
 class vfs(abstractvfs):
     """Operate files relative to a base directory
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -730,6 +730,11 @@
         else:
             return self.vfs.join(path)
 
+    def register_file(self, path):
+        """generic hook point to lets fncache steer its stew"""
+        if path.startswith(b'data/') or path.startswith(b'meta/'):
+            self.fncache.add(path)
+
 
 class fncachestore(basicstore):
     def __init__(self, path, vfstype, dotencode):



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210609/16a306cf/attachment.html>


More information about the Mercurial-patches mailing list