D6193: config: read configs from directories in lexicographical order
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Apr 3 19:08:10 EDT 2019
martinvonz updated this revision to Diff 14646.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D6193?vs=14643&id=14646
REVISION DETAIL
https://phab.mercurial-scm.org/D6193
AFFECTED FILES
mercurial/rcutil.py
tests/test-config.t
CHANGE DETAILS
diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -211,3 +211,12 @@
$ hg log --template '{author}\n'
repo user
$ cd ..
+
+configs should be read in lexicographical order
+
+ $ mkdir configs
+ $ for i in `$TESTDIR/seq.py 10 99`; do
+ > printf "[section]\nkey=$i" > configs/$i.rc
+ > done
+ $ HGRCPATH=configs hg config section.key
+ 99
diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py
--- a/mercurial/rcutil.py
+++ b/mercurial/rcutil.py
@@ -29,7 +29,8 @@
p = util.expandpath(path)
if os.path.isdir(p):
join = os.path.join
- return [join(p, f) for f, k in util.listdir(p) if f.endswith('.rc')]
+ return sorted(join(p, f) for f, k in util.listdir(p)
+ if f.endswith('.rc'))
return [p]
def envrcitems(env=None):
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list