From f7a8635451606ae593ed522f0043f28088cc8eff Mon Sep 17 00:00:00 2001 From: Mads Kiilerich Date: Thu, 4 Sep 2014 21:36:35 +0200 Subject: [PATCH] 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. --- mercurial/scmposix.py | 3 ++- mercurial/scmwindows.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mercurial/scmposix.py b/mercurial/scmposix.py index 1329a91503..33c914664e 100644 --- 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 index 84b75fb684..9ee0ac4912 100644 --- 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