Patchwork D6193: config: read configs from directories in lexicographical order

login
register
mail settings
Submitter phabricator
Date April 3, 2019, 11:08 p.m.
Message ID <f5e55043523231605e08cb6d110971c6@localhost.localdomain>
Download mbox | patch
Permalink /patch/39469/
State Not Applicable
Headers show

Comments

phabricator - April 3, 2019, 11:08 p.m.
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




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

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):