changeset 3772:73860ffbe798

Handle transcoding of tags
author Matt Mackall <mpm@selenic.com>
date Sun, 03 Dec 2006 16:16:33 -0600
parents 29d91e57d055
children b1eeaeb936ae
files mercurial/commands.py mercurial/localrepo.py
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Dec 03 16:16:33 2006 -0600
+++ b/mercurial/commands.py	Sun Dec 03 16:16:33 2006 -0600
@@ -2210,7 +2210,9 @@
         if ui.quiet:
             ui.write("%s\n" % t)
         else:
-            ui.write("%-30s %s\n" % (t, r))
+            t = util.localsub(t, 30)
+            t += " " * (30 - util.locallen(t))
+            ui.write("%s %s\n" % (t, r))
 
 def tip(ui, repo, **opts):
     """show the tip revision
--- a/mercurial/localrepo.py	Sun Dec 03 16:16:33 2006 -0600
+++ b/mercurial/localrepo.py	Sun Dec 03 16:16:33 2006 -0600
@@ -198,6 +198,7 @@
         self.hook('pretag', throw=True, node=hex(node), tag=name, local=local)
 
         if local:
+            # local tags are stored in the current charset
             self.opener('localtags', 'a').write('%s %s\n' % (hex(node), name))
             self.hook('tag', node=hex(node), tag=name, local=local)
             return
@@ -207,7 +208,9 @@
                 raise util.Abort(_('working copy of .hgtags is changed '
                                    '(please commit .hgtags manually)'))
 
-        self.wfile('.hgtags', 'ab').write('%s %s\n' % (hex(node), name))
+        # committed tags are stored in UTF-8
+        line = '%s %s\n' % (hex(node), util.fromlocal(name))
+        self.wfile('.hgtags', 'ab').write(line)
         if self.dirstate.state('.hgtags') == '?':
             self.add(['.hgtags'])
 
@@ -227,7 +230,7 @@
                     self.ui.warn(_("%s: cannot parse entry\n") % context)
                     return
                 node, key = s
-                key = key.strip()
+                key = util.tolocal(key.strip()) # stored in UTF-8
                 try:
                     bin_n = bin(node)
                 except TypeError:
@@ -256,6 +259,9 @@
                 f = self.opener("localtags")
                 count = 0
                 for l in f:
+                    # localtags are stored in the local character set
+                    # while the internal tag table is stored in UTF-8
+                    l = util.fromlocal(l)
                     count += 1
                     parsetag(l, _("localtags, line %d") % count)
             except IOError: