Patchwork [14,of,14] configitems: register the 'convert.p4.encoding' config

login
register
mail settings
Submitter Boris Feld
Date Oct. 6, 2017, 9:22 a.m.
Message ID <0d5a1175d0f94045d0ff.1507281750@FB>
Download mbox | patch
Permalink /patch/24596/
State Accepted
Headers show

Comments

Boris Feld - Oct. 6, 2017, 9:22 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1498786570 -7200
#      Fri Jun 30 03:36:10 2017 +0200
# Node ID 0d5a1175d0f94045d0ffb33740ff0137cbebc76b
# Parent  d54526c257afa33b7624f0b94c16822bcbd08df1
# EXP-Topic config.register.convert
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 0d5a1175d0f9
configitems: register the 'convert.p4.encoding' config
Ryan McElroy - Oct. 6, 2017, 11:26 a.m.
This series looks fine to me. It will be my first attempt at queuing a 
series. Wish me luck!


On 10/6/17 10:22 AM, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1498786570 -7200
> #      Fri Jun 30 03:36:10 2017 +0200
> # Node ID 0d5a1175d0f94045d0ffb33740ff0137cbebc76b
> # Parent  d54526c257afa33b7624f0b94c16822bcbd08df1
> # EXP-Topic config.register.convert
> configitems: register the 'convert.p4.encoding' config
>
> diff -r d54526c257af -r 0d5a1175d0f9 hgext/convert/__init__.py
> --- 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,
>   )
> diff -r d54526c257af -r 0d5a1175d0f9 hgext/convert/p4.py
> --- 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+)?$")
>

Patch

diff -r d54526c257af -r 0d5a1175d0f9 hgext/convert/__init__.py
--- 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,
 )
diff -r d54526c257af -r 0d5a1175d0f9 hgext/convert/p4.py
--- 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+)?$")