Patchwork [4,of,5,py3] config: record source file and line number as a sysstr

login
register
mail settings
Submitter Augie Fackler
Date Nov. 10, 2016, 10:10 p.m.
Message ID <61d6c1706d3246ea08a4.1478815842@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/17465/
State Changes Requested
Headers show

Comments

Augie Fackler - Nov. 10, 2016, 10:10 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1476021520 14400
#      Sun Oct 09 09:58:40 2016 -0400
# Node ID 61d6c1706d3246ea08a4176a5b3d286f498b8054
# Parent  86c54d5610fc355ba0a68b51319740a1a8b4a975
config: record source file and line number as a sysstr

We've already got the path to a config file as a sysstr, so we can
just store this information as a sysstr as well.
Yuya Nishihara - Nov. 11, 2016, 2:46 p.m.
On Thu, 10 Nov 2016 17:10:42 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1476021520 14400
> #      Sun Oct 09 09:58:40 2016 -0400
> # Node ID 61d6c1706d3246ea08a4176a5b3d286f498b8054
> # Parent  86c54d5610fc355ba0a68b51319740a1a8b4a975
> config: record source file and line number as a sysstr
> 
> We've already got the path to a config file as a sysstr, so we can
> just store this information as a sysstr as well.
> 
> diff --git a/mercurial/config.py b/mercurial/config.py
> --- a/mercurial/config.py
> +++ b/mercurial/config.py
> @@ -153,7 +153,7 @@ class config(object):
>                  cont = True
>                  if sections and section not in sections:
>                      continue
> -                self.set(section, item, m.group(2), "%s:%d" % (src, line))
> +                self.set(section, item, m.group(2), r"%s:%d" % (src, line))

IIRC, Pulkit is/was going to convert the data path to bytes. Also, source
can be printed via ui.write(), which should be bytes.
Pulkit Goyal - Nov. 11, 2016, 3:12 p.m.
On Fri, Nov 11, 2016 at 8:16 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> On Thu, 10 Nov 2016 17:10:42 -0500, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1476021520 14400
>> #      Sun Oct 09 09:58:40 2016 -0400
>> # Node ID 61d6c1706d3246ea08a4176a5b3d286f498b8054
>> # Parent  86c54d5610fc355ba0a68b51319740a1a8b4a975
>> config: record source file and line number as a sysstr
>>
>> We've already got the path to a config file as a sysstr, so we can
>> just store this information as a sysstr as well.
>>
>> diff --git a/mercurial/config.py b/mercurial/config.py
>> --- a/mercurial/config.py
>> +++ b/mercurial/config.py
>> @@ -153,7 +153,7 @@ class config(object):
>>                  cont = True
>>                  if sections and section not in sections:
>>                      continue
>> -                self.set(section, item, m.group(2), "%s:%d" % (src, line))
>> +                self.set(section, item, m.group(2), r"%s:%d" % (src, line))
>
> IIRC, Pulkit is/was going to convert the data path to bytes. Also, source
> can be printed via ui.write(), which should be bytes.

Hehe is converting ;)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -153,7 +153,7 @@  class config(object):
                 cont = True
                 if sections and section not in sections:
                     continue
-                self.set(section, item, m.group(2), "%s:%d" % (src, line))
+                self.set(section, item, m.group(2), r"%s:%d" % (src, line))
                 continue
             m = unsetre.match(l)
             if m: