[PATCH 1 of 4] config: don't read the same config file twice

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Sep 24 21:48:46 CDT 2014



On 09/24/2014 06:33 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1409859395 -7200
> #      Thu Sep 04 21:36:35 2014 +0200
> # Node ID e04d746df4b9a7c5ef32b0bf70284e3dd8402791
> # Parent  fa3181323c0aa9b2d2c2f81a7d68d57bd3a7a515
> config: don't read the same config file twice
>
> In some cases some config files would be read twice and shown twice in
> showconfig --debug.

Can you details how the two changes fixes this bug? I'm curious.

>
> diff --git a/mercurial/scmposix.py b/mercurial/scmposix.py
> --- a/mercurial/scmposix.py
> +++ b/mercurial/scmposix.py
> @@ -21,7 +21,8 @@ def systemrcpath():
>       # old mod_python does not set sys.argv
>       if len(getattr(sys, 'argv', [])) > 0:
>           p = os.path.dirname(os.path.dirname(sys.argv[0]))
> -        path.extend(_rcfiles(os.path.join(p, root)))
> +        if p != '/':
> +            path.extend(_rcfiles(os.path.join(p, root)))
>       path.extend(_rcfiles('/' + root))
>       return path
>
> diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py
> --- a/mercurial/scmwindows.py
> +++ b/mercurial/scmwindows.py
> @@ -40,7 +40,7 @@ def userrcpath():
>       path = [os.path.join(home, 'mercurial.ini'),
>               os.path.join(home, '.hgrc')]
>       userprofile = os.environ.get('USERPROFILE')
> -    if userprofile:
> +    if userprofile and userprofile != home:
>           path.append(os.path.join(userprofile, 'mercurial.ini'))
>           path.append(os.path.join(userprofile, '.hgrc'))
>       return path
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list