[PATCH 4 of 4] repo: add a `wcachevfs` to access the `.hg/wcache/` directory

Boris Feld boris.feld at octobus.net
Mon Dec 3 03:47:00 EST 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1542246933 -3600
#      Thu Nov 15 02:55:33 2018 +0100
# Node ID 6aabbe8269e4fdc7f70d7e1d8549ea39962a7f22
# Parent  d39539fbd375c5948845be87987be90ee8bc703c
# EXP-Topic wcache
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 6aabbe8269e4
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".

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -507,6 +507,8 @@ def makelocalrepository(baseui, path, in
     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
@@ -521,6 +523,9 @@ def makelocalrepository(baseui, path, in
     # 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
@@ -543,6 +548,7 @@ def makelocalrepository(baseui, path, in
                  storevfs=storevfs,
                  storeoptions=storevfs.options,
                  cachevfs=cachevfs,
+                 wcachevfs=wcachevfs,
                  extensionmodulenames=extensionmodulenames,
                  extrastate=extrastate,
                  baseclasses=bases)
@@ -573,6 +579,7 @@ def makelocalrepository(baseui, path, in
         sharedpath=storebasepath,
         store=store,
         cachevfs=cachevfs,
+        wcachevfs=wcachevfs,
         features=features,
         intents=intents)
 
@@ -889,7 +896,7 @@ class localrepository(object):
     }
 
     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 @@ class localrepository(object):
         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 @@ class localrepository(object):
         self.sharedpath = sharedpath
         self.store = store
         self.cachevfs = cachevfs
+        self.wcachevfs = wcachevfs
         self.features = features
 
         self.filtername = None
diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -1435,6 +1435,12 @@ class ilocalrepositorymain(interfaceutil
         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.""")
 


More information about the Mercurial-devel mailing list