Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 9152:4017291c4c48
tags: support 'instant' tag retrieval (issue548)
- modify _readtagcache() and _writetagcache() to read/write tag->node
mapping for global tags
- if (and only if) tip unchanged, use that cached mapping to avoid
reading any revisions of .hgtags
- change so tag names are UTF-8 in memory in tags.py, and converted to
local encoding as late as possible (in localrepository._findtags())
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Thu, 16 Jul 2009 10:41:19 -0400 |
parents | f528d1a93491 |
children | cfdcb7a465af |
comparison
equal
deleted
inserted
replaced
9151:f528d1a93491 | 9152:4017291c4c48 |
---|---|
263 tagtypes = {} | 263 tagtypes = {} |
264 | 264 |
265 tags_.findglobaltags(self.ui, self, alltags, tagtypes) | 265 tags_.findglobaltags(self.ui, self, alltags, tagtypes) |
266 tags_.readlocaltags(self.ui, self, alltags, tagtypes) | 266 tags_.readlocaltags(self.ui, self, alltags, tagtypes) |
267 | 267 |
268 # Build the return dicts. Have to re-encode tag names because | |
269 # the tags module always uses UTF-8 (in order not to lose info | |
270 # writing to the cache), but the rest of Mercurial wants them in | |
271 # local encoding. | |
268 tags = {} | 272 tags = {} |
269 for (name, (node, hist)) in alltags.iteritems(): | 273 for (name, (node, hist)) in alltags.iteritems(): |
270 if node != nullid: | 274 if node != nullid: |
271 tags[name] = node | 275 tags[encoding.tolocal(name)] = node |
272 tags['tip'] = self.changelog.tip() | 276 tags['tip'] = self.changelog.tip() |
277 tagtypes = dict([(encoding.tolocal(name), value) | |
278 for (name, value) in tagtypes.iteritems()]) | |
273 return (tags, tagtypes) | 279 return (tags, tagtypes) |
274 | 280 |
275 def tagtype(self, tagname): | 281 def tagtype(self, tagname): |
276 ''' | 282 ''' |
277 return the type of the given tag. result can be: | 283 return the type of the given tag. result can be: |