diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py --- a/mercurial/rcutil.py +++ b/mercurial/rcutil.py @@ -99,7 +99,7 @@ _rccomponents = [(b'resource', r) for r in default_rc_resources()] normpaths = lambda paths: [ - (b'path', os.path.normpath(p)) for p in paths + (b'path', os.path.normpath(p)) for p in sorted(paths) ] _rccomponents.extend(normpaths(systemrcpath())) _rccomponents.append(envrc) diff --git a/tests/test-config-env.py b/tests/test-config-env.py --- a/tests/test-config-env.py +++ b/tests/test-config-env.py @@ -21,19 +21,25 @@ return os.path.join(testtmp, name) -with open(join(b'sysrc'), 'wb') as f: - f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n') +with open(join(b'sysrc1'), 'wb') as f: + f.write(b'[ui]\neditor=e0\n[pager]\npager=p1\n') + +with open(join(b'sysrc2'), 'wb') as f: + f.write(b'[ui]\neditor=e0\n[pager]\npager=p2\n') -with open(join(b'userrc'), 'wb') as f: +with open(join(b'userrc1'), 'wb') as f: f.write(b'[ui]\neditor=e1') +with open(join(b'userrc2'), 'wb') as f: + f.write(b'[ui]\neditor=e2') + # replace rcpath functions so they point to the files above def systemrcpath(): - return [join(b'sysrc')] + return [join(b'sysrc2'), join(b'sysrc1')] def userrcpath(): - return [join(b'userrc')] + return [join(b'userrc2'), join(b'userrc1')] extensions.wrapfunction(rcutil, 'default_rc_resources', lambda orig: []) @@ -56,4 +62,4 @@ # environment variable overrides printconfigs({}) -printconfigs({b'EDITOR': b'e2', b'PAGER': b'p2'}) +printconfigs({b'EDITOR': b'e3', b'PAGER': b'p3'}) diff --git a/tests/test-config-env.py.out b/tests/test-config-env.py.out --- a/tests/test-config-env.py.out +++ b/tests/test-config-env.py.out @@ -1,6 +1,6 @@ -pager.pager=p0 # $TESTTMP/sysrc:4 -ui.editor=e1 # $TESTTMP/userrc:2 +pager.pager=p2 # $TESTTMP/sysrc2:4 +ui.editor=e2 # $TESTTMP/userrc2:2 -pager.pager=p2 # $PAGER -ui.editor=e1 # $TESTTMP/userrc:2 +pager.pager=p3 # $PAGER +ui.editor=e2 # $TESTTMP/userrc2:2