[PATCH 6 of 8] cachevfs: migration the tags fnode cache to 'cachevfs'
Boris Feld
boris.feld at octobus.net
Sun Jul 16 08:47:51 UTC 2017
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1500154225 -7200
# Sat Jul 15 23:30:25 2017 +0200
# Node ID 6de7b0ec19f57b99fd48093a7f5ae41d1d48347c
# Parent 5582979440455dd992f62b43c7a1e8d706750f96
# EXP-Topic cachevfs
cachevfs: migration the tags fnode cache to 'cachevfs'
This will help sharing the cache between shares.
diff -r 558297944045 -r 6de7b0ec19f5 mercurial/tags.py
--- a/mercurial/tags.py Sat Jul 15 23:30:16 2017 +0200
+++ b/mercurial/tags.py Sat Jul 15 23:30:25 2017 +0200
@@ -617,7 +617,7 @@
return tagnode
-_fnodescachefile = 'cache/hgtagsfnodes1'
+_fnodescachefile = 'hgtagsfnodes1'
_fnodesrecsize = 4 + 20 # changeset fragment + filenode
_fnodesmissingrec = '\xff' * 24
@@ -651,7 +651,7 @@
try:
- data = repo.vfs.read(_fnodescachefile)
+ data = repo.cachevfs.read(_fnodescachefile)
except (OSError, IOError):
data = ""
self._raw = bytearray(data)
@@ -759,13 +759,12 @@
try:
lock = repo.wlock(wait=False)
except error.LockError:
- repo.ui.log('tagscache',
- 'not writing .hg/%s because lock cannot be acquired\n' %
- (_fnodescachefile))
+ repo.ui.log('tagscache', 'not writing .hg/cache/%s because '
+ 'lock cannot be acquired\n' % (_fnodescachefile))
return
try:
- f = repo.vfs.open(_fnodescachefile, 'ab')
+ f = repo.cachevfs.open(_fnodescachefile, 'ab')
try:
# if the file has been truncated
actualoffset = f.tell()
@@ -775,7 +774,7 @@
f.seek(self._dirtyoffset)
f.truncate()
repo.ui.log('tagscache',
- 'writing %d bytes to %s\n' % (
+ 'writing %d bytes to cache/%s\n' % (
len(data), _fnodescachefile))
f.write(data)
self._dirtyoffset = None
@@ -783,7 +782,7 @@
f.close()
except (IOError, OSError) as inst:
repo.ui.log('tagscache',
- "couldn't write %s: %s\n" % (
+ "couldn't write cache/%s: %s\n" % (
_fnodescachefile, inst))
finally:
lock.release()
More information about the Mercurial-devel
mailing list