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

login
register
mail settings
Submitter Eugene Baranov
Date July 26, 2015, 5:32 p.m.
Message ID <351ce5f90215399f1d6f.1437931950@Eugene-PC>
Download mbox | patch
Permalink /patch/10063/
State Superseded
Headers show

Comments

Eugene Baranov - July 26, 2015, 5:32 p.m.
# HG changeset patch
# User Eugene Baranov <eug.baranov@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.
Matt Mackall - July 26, 2015, 6:44 p.m.
On Sun, 2015-07-26 at 18:32 +0100, Eugene Baranov wrote:
> # HG changeset patch
> # User Eugene Baranov <eug.baranov@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

You'll need to mark this with (BC). Also, it should fail the
check-config test because your new config variable is undocumented
(though it's possible my regex is broken).

Patch

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(