repo: add a `wcachevfs` to access the `.hg/wcache/` directory
authorBoris Feld <boris.feld@octobus.net>
Thu, 15 Nov 2018 02:55:33 +0100
changeset 40795 e1c3a2e9df59
parent 40794 d5622dfe4ba3
child 40796 03bca908d9fb
repo: add a `wcachevfs` to access the `.hg/wcache/` directory This wvfs will allow us to migrate various cache to the new `wcache` directory. Helping with cache issues with "share".
mercurial/localrepo.py
mercurial/repository.py
--- a/mercurial/localrepo.py	Thu Nov 15 02:46:31 2018 +0100
+++ b/mercurial/localrepo.py	Thu Nov 15 02:55:33 2018 +0100
@@ -508,6 +508,8 @@
     else:
         storebasepath = hgvfs.base
         cachepath = hgvfs.join(b'cache')
+    wcachepath = hgvfs.join(b'wcache')
+
 
     # The store has changed over time and the exact layout is dictated by
     # requirements. The store interface abstracts differences across all
@@ -522,6 +524,9 @@
     # The cache vfs is used to manage cache files.
     cachevfs = vfsmod.vfs(cachepath, cacheaudited=True)
     cachevfs.createmode = store.createmode
+    # The cache vfs is used to manage cache files related to the working copy
+    wcachevfs = vfsmod.vfs(wcachepath, cacheaudited=True)
+    wcachevfs.createmode = store.createmode
 
     # Now resolve the type for the repository object. We do this by repeatedly
     # calling a factory function to produces types for specific aspects of the
@@ -544,6 +549,7 @@
                  storevfs=storevfs,
                  storeoptions=storevfs.options,
                  cachevfs=cachevfs,
+                 wcachevfs=wcachevfs,
                  extensionmodulenames=extensionmodulenames,
                  extrastate=extrastate,
                  baseclasses=bases)
@@ -574,6 +580,7 @@
         sharedpath=storebasepath,
         store=store,
         cachevfs=cachevfs,
+        wcachevfs=wcachevfs,
         features=features,
         intents=intents)
 
@@ -889,7 +896,7 @@
     }
 
     def __init__(self, baseui, ui, origroot, wdirvfs, hgvfs, requirements,
-                 supportedrequirements, sharedpath, store, cachevfs,
+                 supportedrequirements, sharedpath, store, cachevfs, wcachevfs,
                  features, intents=None):
         """Create a new local repository instance.
 
@@ -932,6 +939,9 @@
         cachevfs
            ``vfs.vfs`` used for cache files.
 
+        wcachevfs
+           ``vfs.vfs`` used for cache files related to the working copy.
+
         features
            ``set`` of bytestrings defining features/capabilities of this
            instance.
@@ -954,6 +964,7 @@
         self.sharedpath = sharedpath
         self.store = store
         self.cachevfs = cachevfs
+        self.wcachevfs = wcachevfs
         self.features = features
 
         self.filtername = None
--- a/mercurial/repository.py	Thu Nov 15 02:46:31 2018 +0100
+++ b/mercurial/repository.py	Thu Nov 15 02:55:33 2018 +0100
@@ -1435,6 +1435,12 @@
         Typically .hg/cache.
         """)
 
+    wcachevfs = interfaceutil.Attribute(
+        """A VFS used to access the cache directory dedicated to working copy
+
+        Typically .hg/wcache.
+        """)
+
     filteredrevcache = interfaceutil.Attribute(
         """Holds sets of revisions to be filtered.""")