changeset 34503:0d5a1175d0f9

configitems: register the 'convert.p4.encoding' config
author Boris Feld <boris.feld@octobus.net>
date Fri, 30 Jun 2017 03:36:10 +0200
parents d54526c257af
children 8cef8f7d51d0
files hgext/convert/__init__.py hgext/convert/p4.py
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/__init__.py	Fri Jun 30 03:42:34 2017 +0200
+++ b/hgext/convert/__init__.py	Fri Jun 30 03:36:10 2017 +0200
@@ -97,6 +97,9 @@
 configitem('convert', 'localtimezone',
     default=False,
 )
+configitem('convert', 'p4.encoding',
+    default=lambda: convcmd.orig_encoding,
+)
 configitem('convert', 'p4.startrev',
     default=0,
 )
--- a/hgext/convert/p4.py	Fri Jun 30 03:42:34 2017 +0200
+++ b/hgext/convert/p4.py	Fri Jun 30 03:36:10 2017 +0200
@@ -44,9 +44,6 @@
 
 class p4_source(common.converter_source):
     def __init__(self, ui, path, revs=None):
-        # avoid import cycle
-        from . import convcmd
-
         super(p4_source, self).__init__(ui, path, revs=revs)
 
         if "/" in path and not path.startswith('//'):
@@ -56,8 +53,7 @@
         common.checktool('p4', abort=False)
 
         self.revmap = {}
-        self.encoding = self.ui.config('convert', 'p4.encoding',
-                                       default=convcmd.orig_encoding)
+        self.encoding = self.ui.config('convert', 'p4.encoding')
         self.re_type = re.compile(
             "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
             "(\+\w+)?$")