Patchwork [5,of,8] cachevfs: migrate tagscache to 'cachevfs'

login
register
mail settings
Submitter Boris Feld
Date July 16, 2017, 8:47 a.m.
Message ID <5582979440455dd992f6.1500194870@FB>
Download mbox | patch
Permalink /patch/22429/
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 1500154216 -7200
#      Sat Jul 15 23:30:16 2017 +0200
# Node ID 5582979440455dd992f62b43c7a1e8d706750f96
# Parent  f15c2ae73d8ee3719ad01c9749da6ece504bc1c4
# EXP-Topic cachevfs
cachevfs: migrate tagscache to 'cachevfs'

This will help sharing the cache between shares.

Patch

diff -r f15c2ae73d8e -r 558297944045 mercurial/tags.py
--- a/mercurial/tags.py	Sat Jul 15 22:42:50 2017 +0200
+++ b/mercurial/tags.py	Sat Jul 15 23:30:16 2017 +0200
@@ -362,7 +362,7 @@ 
 
 def _filename(repo):
     """name of a tagcache file for a given repo or repoview"""
-    filename = 'cache/tags2'
+    filename = 'tags2'
     if repo.filtername:
         filename = '%s-%s' % (filename, repo.filtername)
     return filename
@@ -386,7 +386,7 @@ 
     info from each returned head. (See findglobaltags().)
     '''
     try:
-        cachefile = repo.vfs(_filename(repo), 'r')
+        cachefile = repo.cachevfs(_filename(repo), 'r')
         # force reading the file for static-http
         cachelines = iter(cachefile)
     except IOError:
@@ -486,11 +486,11 @@ 
 def _writetagcache(ui, repo, valid, cachetags):
     filename = _filename(repo)
     try:
-        cachefile = repo.vfs(filename, 'w', atomictemp=True)
+        cachefile = repo.cachevfs(filename, 'w', atomictemp=True)
     except (OSError, IOError):
         return
 
-    ui.log('tagscache', 'writing .hg/%s with %d tags\n',
+    ui.log('tagscache', 'writing .hg/cache/%s with %d tags\n',
            filename, len(cachetags))
 
     if valid[2]: