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

login
register
mail settings
Submitter Boris Feld
Date July 16, 2017, 8:47 a.m.
Message ID <b275e24438be8853ba54.1500194868@FB>
Download mbox | patch
Permalink /patch/22426/
State Accepted
Headers show

Comments

Boris Feld - July 16, 2017, 8:47 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@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.

Patch

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))