diff 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
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jul 16 10:39:42 2009 -0400
+++ b/mercurial/localrepo.py	Thu Jul 16 10:41:19 2009 -0400
@@ -265,11 +265,17 @@
         tags_.findglobaltags(self.ui, self, alltags, tagtypes)
         tags_.readlocaltags(self.ui, self, alltags, tagtypes)
 
+        # Build the return dicts.  Have to re-encode tag names because
+        # the tags module always uses UTF-8 (in order not to lose info
+        # writing to the cache), but the rest of Mercurial wants them in
+        # local encoding.
         tags = {}
         for (name, (node, hist)) in alltags.iteritems():
             if node != nullid:
-                tags[name] = node
+                tags[encoding.tolocal(name)] = node
         tags['tip'] = self.changelog.tip()
+        tagtypes = dict([(encoding.tolocal(name), value)
+                         for (name, value) in tagtypes.iteritems()])
         return (tags, tagtypes)
 
     def tagtype(self, tagname):