Comments
Patch
@@ -552,13 +552,17 @@ class ui(object):
msg %= (section, name, pycompat.bytestr(default))
self.develwarn(msg, 2, 'warn-config-default')
- for s, n in alternates:
+ found = []
+ for idx, (s, n) in enumerate(alternates):
candidate = self._data(untrusted).get(s, n, None)
if candidate is not None:
value = candidate
section = s
name = n
- break
+ level = self._data(untrusted).level(s, n)
+ found.append((level, -idx, value))
+ if found:
+ value = max(found)[-1]
if self.debugflag and not untrusted and self._reportuntrusted:
for s, n in alternates:
@@ -202,12 +202,36 @@ alias has lower priority
$ cat > .hg/hgrc << EOF
> [ui]
> user = alias user
- > username = repo user
+ > username = Repo user
> EOF
$ touch index
$ unset HGUSER
$ hg ci -Am test
adding index
$ hg log --template '{author}\n'
- repo user
+ Repo user
$ cd ..
+
+Unless alias are specified at an higher level
+
+ $ hg init aliaspriority-level
+ $ cd aliaspriority-level
+ $ cat >> $HGRCPATH << EOF
+ > [ui]
+ > username = repo user
+ > EOF
+ $ cat > .hg/hgrc << EOF
+ > [ui]
+ > user = alias user
+ > EOF
+ $ touch index
+ $ unset HGUSER
+ $ hg ci -Am test
+ adding index
+ $ hg log --template '{author}\n'
+ alias user
+ $ echo foo >> index
+ $ hg ci -m test --config ui.username=cmd-user
+ $ hg log --template '{author}\n' -r .
+ cmd-user
+ $ cd ..