[PATCH] convert: print commit log message with local encoding correctly
Shun-ichi Goto
shunichi.goto at gmail.com
Wed Jan 2 15:28:21 CST 2008
# HG changeset patch
# User Shun-ichi GOTO <shunichi.goto at gmail.com>
# Date 1199309130 -32400
# Node ID c88b358ada8ed175b0d373d92e799e4834419ee9
# Parent 4ac65e6416cfee69c7ac492960aabcc3ca1a87ab
convert: print commit log message with local encoding correctly.
diff -r 4ac65e6416cf -r c88b358ada8e hgext/convert/convcmd.py
--- 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 @@ class converter(object):
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 @@ class converter(object):
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:
More information about the Mercurial
mailing list