comparison mercurial/localrepo.py @ 33176:edb7f628ef8b

localrepo: factor out base of filecache annotation class It isn't needed that storecache is derived from repofilecache. Changes in this patch allow repofilecache and storecache to do in own __init__() differently from each other.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 30 Jun 2017 01:47:49 +0900
parents 05c213cd8ab8
children 895ecec31c70
comparison
equal deleted inserted replaced
33175:3b85c474cbcf 33176:edb7f628ef8b
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 class repofilecache(scmutil.filecache): 69 class _basefilecache(scmutil.filecache):
70 """All filecache usage on repo are done for logic that should be unfiltered 70 """All filecache usage on repo are done for logic that should be unfiltered
71 """ 71 """
72
73 def join(self, obj, fname):
74 return obj.vfs.join(fname)
75 def __get__(self, repo, type=None): 72 def __get__(self, repo, type=None):
76 if repo is None: 73 if repo is None:
77 return self 74 return self
78 return super(repofilecache, self).__get__(repo.unfiltered(), type) 75 return super(_basefilecache, self).__get__(repo.unfiltered(), type)
79 def __set__(self, repo, value): 76 def __set__(self, repo, value):
80 return super(repofilecache, self).__set__(repo.unfiltered(), value) 77 return super(_basefilecache, self).__set__(repo.unfiltered(), value)
81 def __delete__(self, repo): 78 def __delete__(self, repo):
82 return super(repofilecache, self).__delete__(repo.unfiltered()) 79 return super(_basefilecache, self).__delete__(repo.unfiltered())
83 80
84 class storecache(repofilecache): 81 class repofilecache(_basefilecache):
82 """filecache for files in .hg but outside of .hg/store"""
83 def join(self, obj, fname):
84 return obj.vfs.join(fname)
85
86 class storecache(_basefilecache):
85 """filecache for files in the store""" 87 """filecache for files in the store"""
86 def join(self, obj, fname): 88 def join(self, obj, fname):
87 return obj.sjoin(fname) 89 return obj.sjoin(fname)
88 90
89 class unfilteredpropertycache(util.propertycache): 91 class unfilteredpropertycache(util.propertycache):