comparison mercurial/localrepo.py @ 33277:4470508eb6f2

localrepo: store path and vfs location of cached properties This information is used to make transaction handle these files specially, in order to avoid file stat ambiguity of them. Gathering information about cached files via annotation classes can avoid overlooking properties newly introduced in the future.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 04 Jul 2017 23:13:46 +0900
parents 85d1ac011582
children 87bca10a06ed
comparison
equal deleted inserted replaced
33276:89796a25d4bb 33277:4470508eb6f2
64 64
65 release = lockmod.release 65 release = lockmod.release
66 urlerr = util.urlerr 66 urlerr = util.urlerr
67 urlreq = util.urlreq 67 urlreq = util.urlreq
68 68
69 # set of (path, vfs-location) tuples. vfs-location is:
70 # - 'plain for vfs relative paths
71 # - '' for svfs relative paths
72 _cachedfiles = set()
73
69 class _basefilecache(scmutil.filecache): 74 class _basefilecache(scmutil.filecache):
70 """All filecache usage on repo are done for logic that should be unfiltered 75 """All filecache usage on repo are done for logic that should be unfiltered
71 """ 76 """
72 def __get__(self, repo, type=None): 77 def __get__(self, repo, type=None):
73 if repo is None: 78 if repo is None:
78 def __delete__(self, repo): 83 def __delete__(self, repo):
79 return super(_basefilecache, self).__delete__(repo.unfiltered()) 84 return super(_basefilecache, self).__delete__(repo.unfiltered())
80 85
81 class repofilecache(_basefilecache): 86 class repofilecache(_basefilecache):
82 """filecache for files in .hg but outside of .hg/store""" 87 """filecache for files in .hg but outside of .hg/store"""
88 def __init__(self, *paths):
89 super(repofilecache, self).__init__(*paths)
90 for path in paths:
91 _cachedfiles.add((path, 'plain'))
92
83 def join(self, obj, fname): 93 def join(self, obj, fname):
84 return obj.vfs.join(fname) 94 return obj.vfs.join(fname)
85 95
86 class storecache(_basefilecache): 96 class storecache(_basefilecache):
87 """filecache for files in the store""" 97 """filecache for files in the store"""
98 def __init__(self, *paths):
99 super(storecache, self).__init__(*paths)
100 for path in paths:
101 _cachedfiles.add((path, ''))
102
88 def join(self, obj, fname): 103 def join(self, obj, fname):
89 return obj.sjoin(fname) 104 return obj.sjoin(fname)
90 105
91 class unfilteredpropertycache(util.propertycache): 106 class unfilteredpropertycache(util.propertycache):
92 """propertycache that apply to unfiltered repo only""" 107 """propertycache that apply to unfiltered repo only"""