[PATCH 3 of 8] cachevfs: use the new vfs in when computing branchmap cache

Boris Feld boris.feld at octobus.net
Sun Jul 16 04:47:48 EDT 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1500151351 -7200
#      Sat Jul 15 22:42:31 2017 +0200
# Node ID b275e24438be8853ba545a6ee1dd2e5fa1580cd3
# Parent  76e3839204e5bacf6e894a695853a9498ebe22d7
# EXP-Topic cachevfs
cachevfs: use the new vfs in when computing branchmap cache

This will help sharing the cache between shares.

diff -r 76e3839204e5 -r b275e24438be mercurial/branchmap.py
--- a/mercurial/branchmap.py	Sat Jul 15 23:05:04 2017 +0200
+++ b/mercurial/branchmap.py	Sat Jul 15 22:42:31 2017 +0200
@@ -28,14 +28,14 @@
 
 def _filename(repo):
     """name of a branchcache file for a given repo or repoview"""
-    filename = "cache/branch2"
+    filename = "branch2"
     if repo.filtername:
         filename = '%s-%s' % (filename, repo.filtername)
     return filename
 
 def read(repo):
     try:
-        f = repo.vfs(_filename(repo))
+        f = repo.cachevfs(_filename(repo))
         lines = f.read().split('\n')
         f.close()
     except (IOError, OSError):
@@ -228,7 +228,7 @@
 
     def write(self, repo):
         try:
-            f = repo.vfs(_filename(repo), "w", atomictemp=True)
+            f = repo.cachevfs(_filename(repo), "w", atomictemp=True)
             cachekey = [hex(self.tipnode), '%d' % self.tiprev]
             if self.filteredhash is not None:
                 cachekey.append(hex(self.filteredhash))


More information about the Mercurial-devel mailing list