Patchwork [1,of,3,hglib] config: un-break showconfig wrapper when environment variables are used

login
register
mail settings
Submitter Augie Fackler
Date Dec. 10, 2017, 5:54 p.m.
Message ID <fd22223e0c7b22d8807e.1512928492@imladris.local>
Download mbox | patch
Permalink /patch/26201/
State Accepted
Headers show

Comments

Augie Fackler - Dec. 10, 2017, 5:54 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1512927456 18000
#      Sun Dec 10 12:37:36 2017 -0500
# Node ID fd22223e0c7b22d8807e30f96f734d10c59f4433
# Parent  22767a1e61acff3521c0b84589546906274cdbcf
config: un-break showconfig wrapper when environment variables are used

This was broken when hg was picking up $EDITOR etc and showing that in
the showconfig --debug output. No test because I can't figure out how
to thread the environment variable down into the executed hg binary,
but this fixes the failure on my laptop.
Yuya Nishihara - Dec. 11, 2017, 1:10 p.m.
On Sun, 10 Dec 2017 12:54:52 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1512927456 18000
> #      Sun Dec 10 12:37:36 2017 -0500
> # Node ID fd22223e0c7b22d8807e30f96f734d10c59f4433
> # Parent  22767a1e61acff3521c0b84589546906274cdbcf
> config: un-break showconfig wrapper when environment variables are used

These look good to me.

> diff --git a/hglib/client.py b/hglib/client.py
> --- a/hglib/client.py
> +++ b/hglib/client.py
> @@ -682,6 +682,7 @@ class hgclient(object):
>          conf = []
>          if showsource:
>              out = util.skiplines(out, b('read config from: '))
> +            out = util.skiplines(out, b('set config by: '))

Nit: perhaps these prefixes can be a tuple since util.skiplines() just passes
'prefix' to bytes.startswith().
Augie Fackler - Dec. 11, 2017, 1:55 p.m.
> On Dec 11, 2017, at 08:10, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> On Sun, 10 Dec 2017 12:54:52 -0500, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <raf@durin42.com>
>> # Date 1512927456 18000
>> #      Sun Dec 10 12:37:36 2017 -0500
>> # Node ID fd22223e0c7b22d8807e30f96f734d10c59f4433
>> # Parent  22767a1e61acff3521c0b84589546906274cdbcf
>> config: un-break showconfig wrapper when environment variables are used
> 
> These look good to me.
> 
>> diff --git a/hglib/client.py b/hglib/client.py
>> --- a/hglib/client.py
>> +++ b/hglib/client.py
>> @@ -682,6 +682,7 @@ class hgclient(object):
>>         conf = []
>>         if showsource:
>>             out = util.skiplines(out, b('read config from: '))
>> +            out = util.skiplines(out, b('set config by: '))
> 
> Nit: perhaps these prefixes can be a tuple since util.skiplines() just passes
> 'prefix' to bytes.startswith().

Thanks, pushed with that fixed!

Patch

diff --git a/hglib/client.py b/hglib/client.py
--- a/hglib/client.py
+++ b/hglib/client.py
@@ -682,6 +682,7 @@  class hgclient(object):
         conf = []
         if showsource:
             out = util.skiplines(out, b('read config from: '))
+            out = util.skiplines(out, b('set config by: '))
             for line in out.splitlines():
                 m = re.match(b(r"(.+?:(?:\d+:)?) (.*)"), line)
                 t = splitline(m.group(2))