##// END OF EJS Templates
ui.username(): expand environment variables in username configuration value....
Chad Dombrova -
r11225:d6dbd5e4 default
parent child Browse files
Show More
@@ -266,6 +266,8 b' class ui(object):'
266 user = os.environ.get("HGUSER")
266 user = os.environ.get("HGUSER")
267 if user is None:
267 if user is None:
268 user = self.config("ui", "username")
268 user = self.config("ui", "username")
269 if user is not None:
270 user = os.path.expandvars(user)
269 if user is None:
271 if user is None:
270 user = os.environ.get("EMAIL")
272 user = os.environ.get("EMAIL")
271 if user is None and self.configbool("ui", "askusername"):
273 if user is None and self.configbool("ui", "askusername"):
@@ -29,6 +29,28 b" echo '%include $FAKEPATH/no-such-file' >"
29 hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
29 hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
30 unset FAKEPATH
30 unset FAKEPATH
31
31
32 echo "% username expansion"
33 olduser=$HGUSER
34 unset HGUSER
35
36 FAKEUSER='John Doe'
37 export FAKEUSER
38 echo '[ui]' > $HGRCPATH
39 echo 'username = $FAKEUSER' >> $HGRCPATH
40
41 hg init usertest
42 cd usertest
43 touch bar
44 hg commit --addremove --quiet -m "added bar"
45 hg log --template "{author}\n"
46 cd ..
47
48 hg showconfig | sed -e "s:$p:...:"
49
50 unset FAKEUSER
51 HGUSER=$olduser
52 export HGUSER
53
32 # HGPLAIN
54 # HGPLAIN
33 cd ..
55 cd ..
34 p=`pwd`
56 p=`pwd`
@@ -10,6 +10,9 b" hg: config error at $HGRCPATH:2: ' x = "
10 foo.bar=a\nb\nc\nde\nfg
10 foo.bar=a\nb\nc\nde\nfg
11 foo.baz=bif cb
11 foo.baz=bif cb
12 hg: config error at $HGRCPATH:1: cannot include /path/to/nowhere/no-such-file (No such file or directory)
12 hg: config error at $HGRCPATH:1: cannot include /path/to/nowhere/no-such-file (No such file or directory)
13 % username expansion
14 John Doe
15 ui.username=$FAKEUSER
13 % customized hgrc
16 % customized hgrc
14 read config from: .../.hgrc
17 read config from: .../.hgrc
15 .../.hgrc:13: alias.log=log -g
18 .../.hgrc:13: alias.log=log -g
General Comments 0
You need to be logged in to leave comments. Login now