diff tests/test-config.t @ 33329:e714159860fd

configitems: add alias support in config Aliases define optional alternatives to existing options. For example the old option ui.user was deprecated and replaced by ui.username. With this mechanism, it's even possible to create an alias to an option in a different section. Add ui.user as alias to ui.username as an example of this concept. The old alternates principle in ui.config is removed as it was used only for this option.
author David Demelier <demelier.david@gmail.com>
date Fri, 07 Jul 2017 08:33:10 +0200
parents d83e51654c8a
children 4441705b7111
line wrap: on
line diff
--- a/tests/test-config.t	Mon Jul 03 13:04:35 2017 +0200
+++ b/tests/test-config.t	Fri Jul 07 08:33:10 2017 +0200
@@ -178,3 +178,36 @@
 
   $ PAGER=p1 hg config --debug --config pager.pager=p2 | grep 'pager\.pager'
   --config: pager.pager=p2
+
+verify that aliases are evaluated as well
+
+  $ hg init aliastest
+  $ cd aliastest
+  $ cat > .hg/hgrc << EOF
+  > [ui]
+  > user = repo user
+  > EOF
+  $ touch index
+  $ unset HGUSER
+  $ hg ci -Am test
+  adding index
+  $ hg log --template '{author}\n'
+  repo user
+  $ cd ..
+
+alias has lower priority
+
+  $ hg init aliaspriority
+  $ cd aliaspriority
+  $ cat > .hg/hgrc << EOF
+  > [ui]
+  > user = alias user
+  > username = repo user
+  > EOF
+  $ touch index
+  $ unset HGUSER
+  $ hg ci -Am test
+  adding index
+  $ hg log --template '{author}\n'
+  repo user
+  $ cd ..