Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 42323:c2b83c957621 stable
localrepo: grab mixedrepostorecache class from 526750cdd02d
On default, Martin von Zweigbergk <martinvonz@google.com> introduced a more
advance filecache decorator. I need this decorator to fix a bug on stable. So I
am grafting the relevant part of 526750cdd02d.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 20 May 2019 10:08:17 +0200 |
parents | 0e41f40b01cc |
children | 2338bdea4474 |
comparison
equal
deleted
inserted
replaced
42322:d2c871b78c36 | 42323:c2b83c957621 |
---|---|
119 for path in paths: | 119 for path in paths: |
120 _cachedfiles.add((path, '')) | 120 _cachedfiles.add((path, '')) |
121 | 121 |
122 def join(self, obj, fname): | 122 def join(self, obj, fname): |
123 return obj.sjoin(fname) | 123 return obj.sjoin(fname) |
124 | |
125 class mixedrepostorecache(_basefilecache): | |
126 """filecache for a mix files in .hg/store and outside""" | |
127 def __init__(self, *pathsandlocations): | |
128 # scmutil.filecache only uses the path for passing back into our | |
129 # join(), so we can safely pass a list of paths and locations | |
130 super(mixedrepostorecache, self).__init__(*pathsandlocations) | |
131 for path, location in pathsandlocations: | |
132 _cachedfiles.update(pathsandlocations) | |
133 | |
134 def join(self, obj, fnameandlocation): | |
135 fname, location = fnameandlocation | |
136 if location == '': | |
137 return obj.vfs.join(fname) | |
138 else: | |
139 if location != 'store': | |
140 raise error.ProgrammingError('unexpected location: %s' % | |
141 location) | |
142 return obj.sjoin(fname) | |
124 | 143 |
125 def isfilecached(repo, name): | 144 def isfilecached(repo, name): |
126 """check if a repo has already cached "name" filecache-ed property | 145 """check if a repo has already cached "name" filecache-ed property |
127 | 146 |
128 This returns (cachedobj-or-None, iscached) tuple. | 147 This returns (cachedobj-or-None, iscached) tuple. |