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

login
register
mail settings
Submitter phabricator
Date April 8, 2019, 6:51 p.m.
Message ID <981d9d6a83f01abc36d12dd672e23a8d@localhost.localdomain>
Download mbox | patch
Permalink /patch/39540/
State Not Applicable
Headers show

Comments

phabricator - April 8, 2019, 6:51 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGedbcf5b239f9: config: read configs from directories in lexicographical order (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6193?vs=14646&id=14698

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