comparison mercurial/tags.py @ 23877:7cc77030c557

localrepo: remove all external users of localrepo.opener This change touches every module in which repository.opener was being used, and changes it for the equivalent repository.vfs. This is meant to make it easier to split the repository.vfs into several separate vfs. It should now be possible to remove localrepo.opener.
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Thu, 15 Jan 2015 23:17:12 +0100
parents e53f6b72a0e4
children 7b09dbbbd502
comparison
equal deleted inserted replaced
23876:48fd1dfb99aa 23877:7cc77030c557
60 _writetagcache(ui, repo, heads, tagfnode, alltags) 60 _writetagcache(ui, repo, heads, tagfnode, alltags)
61 61
62 def readlocaltags(ui, repo, alltags, tagtypes): 62 def readlocaltags(ui, repo, alltags, tagtypes):
63 '''Read local tags in repo. Update alltags and tagtypes.''' 63 '''Read local tags in repo. Update alltags and tagtypes.'''
64 try: 64 try:
65 data = repo.opener.read("localtags") 65 data = repo.vfs.read("localtags")
66 except IOError, inst: 66 except IOError, inst:
67 if inst.errno != errno.ENOENT: 67 if inst.errno != errno.ENOENT:
68 raise 68 raise
69 return 69 return
70 70
191 heads currently in the repository (ordered from tip to oldest) and 191 heads currently in the repository (ordered from tip to oldest) and
192 fnodes is a mapping from head to .hgtags filenode. If those two are 192 fnodes is a mapping from head to .hgtags filenode. If those two are
193 set, caller is responsible for reading tag info from each head.''' 193 set, caller is responsible for reading tag info from each head.'''
194 194
195 try: 195 try:
196 cachefile = repo.opener('cache/tags', 'r') 196 cachefile = repo.vfs('cache/tags', 'r')
197 # force reading the file for static-http 197 # force reading the file for static-http
198 cachelines = iter(cachefile) 198 cachelines = iter(cachefile)
199 except IOError: 199 except IOError:
200 cachefile = None 200 cachefile = None
201 201
301 return (repoheads, cachefnode, None, True) 301 return (repoheads, cachefnode, None, True)
302 302
303 def _writetagcache(ui, repo, heads, tagfnode, cachetags): 303 def _writetagcache(ui, repo, heads, tagfnode, cachetags):
304 304
305 try: 305 try:
306 cachefile = repo.opener('cache/tags', 'w', atomictemp=True) 306 cachefile = repo.vfs('cache/tags', 'w', atomictemp=True)
307 except (OSError, IOError): 307 except (OSError, IOError):
308 return 308 return
309 309
310 ui.log('tagscache', 'writing tags cache file with %d heads and %d tags\n', 310 ui.log('tagscache', 'writing tags cache file with %d heads and %d tags\n',
311 len(heads), len(cachetags)) 311 len(heads), len(cachetags))