changeset 5794:4c16020d1172

convert: print commit log message with local encoding correctly.
author Shun-ichi GOTO <shunichi.goto@gmail.com>
date Thu, 03 Jan 2008 06:25:30 +0900
parents 68f5bf9aa582
children 520a8d9d92ed
files hgext/convert/convcmd.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/convcmd.py	Thu Jan 03 06:25:30 2008 +0900
+++ b/hgext/convert/convcmd.py	Thu Jan 03 06:25:30 2008 +0900
@@ -248,6 +248,10 @@
                 desc = self.commitcache[c].desc
                 if "\n" in desc:
                     desc = desc.splitlines()[0]
+                # convert log message to local encoding without using
+                # tolocal() because util._encoding conver() use it as
+                # 'utf-8'
+                desc = desc.decode('utf-8').encode(orig_encoding, 'replace')
                 self.ui.status("%d %s\n" % (num, desc))
                 self.copy(c)
 
@@ -276,7 +280,11 @@
             self.source.after()
         self.map.close()
 
+orig_encoding = 'ascii'
+
 def convert(ui, src, dest=None, revmapfile=None, **opts):
+    global orig_encoding
+    orig_encoding = util._encoding
     util._encoding = 'UTF-8'
 
     if not dest: