[PATCH stable v2] convert: by default use original local encoding when converting from Perforce

Eugene Baranov eug.baranov at gmail.com
Sun Jul 26 12:32:30 CDT 2015


# HG changeset patch
# User Eugene Baranov <eug.baranov at gmail.com>
# Date 1437580631 -3600
#      Wed Jul 22 16:57:11 2015 +0100
# Branch stable
# Node ID 351ce5f90215399f1d6f702861fa58bb744d6d1b
# Parent  3de48ff627338a8abab1efc85e2a52add7f90abc
convert: by default use original local encoding when converting from Perforce

On Windows Perforce command line client uses default system locale to encode
output. Using 'latin_1' causes locale-specific characters to be replaces with
question marks. With this patch we will use default locale by default whilst
allowing to specify it explicity with 'convert.p4.encoding' config option.

diff -r 3de48ff62733 -r 351ce5f90215 hgext/convert/p4.py
--- a/hgext/convert/p4.py	Fri Jul 24 16:44:52 2015 -0700
+++ b/hgext/convert/p4.py	Wed Jul 22 16:57:11 2015 +0100
@@ -9,6 +9,7 @@
 from mercurial.i18n import _
 
 from common import commit, converter_source, checktool, NoRepo
+import convcmd
 import marshal
 import re
 
@@ -54,7 +55,8 @@
         self.tags = {}
         self.lastbranch = {}
         self.parent = {}
-        self.encoding = "latin_1"
+        self.encoding = self.ui.config('convert', 'p4.encoding',
+                                       default=convcmd.orig_encoding)
         self.depotname = {}           # mapping from local name to depot name
         self.localname = {} # mapping from depot name to local name
         self.re_type = re.compile(


More information about the Mercurial-devel mailing list