mercurial/tags.py
changeset 33536 ddacd0e453ae
parent 33255 4f3f08262eb4
child 33537 709dde1c5dd5
equal deleted inserted replaced
33535:755e6532e81d 33536:ddacd0e453ae
   360         ahist.extend([n for n in bhist if n not in ahist])
   360         ahist.extend([n for n in bhist if n not in ahist])
   361         alltags[name] = anode, ahist
   361         alltags[name] = anode, ahist
   362 
   362 
   363 def _filename(repo):
   363 def _filename(repo):
   364     """name of a tagcache file for a given repo or repoview"""
   364     """name of a tagcache file for a given repo or repoview"""
   365     filename = 'cache/tags2'
   365     filename = 'tags2'
   366     if repo.filtername:
   366     if repo.filtername:
   367         filename = '%s-%s' % (filename, repo.filtername)
   367         filename = '%s-%s' % (filename, repo.filtername)
   368     return filename
   368     return filename
   369 
   369 
   370 def _readtagcache(ui, repo):
   370 def _readtagcache(ui, repo):
   384 
   384 
   385     If the cache is not up to date, the caller is responsible for reading tag
   385     If the cache is not up to date, the caller is responsible for reading tag
   386     info from each returned head. (See findglobaltags().)
   386     info from each returned head. (See findglobaltags().)
   387     '''
   387     '''
   388     try:
   388     try:
   389         cachefile = repo.vfs(_filename(repo), 'r')
   389         cachefile = repo.cachevfs(_filename(repo), 'r')
   390         # force reading the file for static-http
   390         # force reading the file for static-http
   391         cachelines = iter(cachefile)
   391         cachelines = iter(cachefile)
   392     except IOError:
   392     except IOError:
   393         cachefile = None
   393         cachefile = None
   394 
   394 
   484     return cachefnode
   484     return cachefnode
   485 
   485 
   486 def _writetagcache(ui, repo, valid, cachetags):
   486 def _writetagcache(ui, repo, valid, cachetags):
   487     filename = _filename(repo)
   487     filename = _filename(repo)
   488     try:
   488     try:
   489         cachefile = repo.vfs(filename, 'w', atomictemp=True)
   489         cachefile = repo.cachevfs(filename, 'w', atomictemp=True)
   490     except (OSError, IOError):
   490     except (OSError, IOError):
   491         return
   491         return
   492 
   492 
   493     ui.log('tagscache', 'writing .hg/%s with %d tags\n',
   493     ui.log('tagscache', 'writing .hg/cache/%s with %d tags\n',
   494            filename, len(cachetags))
   494            filename, len(cachetags))
   495 
   495 
   496     if valid[2]:
   496     if valid[2]:
   497         cachefile.write('%d %s %s\n' % (valid[0], hex(valid[1]), hex(valid[2])))
   497         cachefile.write('%d %s %s\n' % (valid[0], hex(valid[1]), hex(valid[2])))
   498     else:
   498     else: