Mercurial > hg
comparison mercurial/store.py @ 47443:9ab54aa56982
vfs: add a `register_file` method on the vfs class
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.
Differential Revision: https://phab.mercurial-scm.org/D10851
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 08 Jun 2021 02:05:05 +0200 |
parents | e6292eb33384 |
children | f030c7d22032 |
comparison
equal
deleted
inserted
replaced
47442:d1c1fd7ac46d | 47443:9ab54aa56982 |
---|---|
728 if path: | 728 if path: |
729 return self.vfs.join(self.encode(path)) | 729 return self.vfs.join(self.encode(path)) |
730 else: | 730 else: |
731 return self.vfs.join(path) | 731 return self.vfs.join(path) |
732 | 732 |
733 def register_file(self, path): | |
734 """generic hook point to lets fncache steer its stew""" | |
735 if path.startswith(b'data/') or path.startswith(b'meta/'): | |
736 self.fncache.add(path) | |
737 | |
733 | 738 |
734 class fncachestore(basicstore): | 739 class fncachestore(basicstore): |
735 def __init__(self, path, vfstype, dotencode): | 740 def __init__(self, path, vfstype, dotencode): |
736 if dotencode: | 741 if dotencode: |
737 encode = _pathencode | 742 encode = _pathencode |