Show More
@@ -437,7 +437,7 b' class ui(object):' | |||||
437 | """ |
|
437 | """ | |
438 | user = os.environ.get("HGUSER") |
|
438 | user = os.environ.get("HGUSER") | |
439 | if user is None: |
|
439 | if user is None: | |
440 | user = self.config("ui", "username") |
|
440 | user = self.config("ui", ["username", "user"]) | |
441 | if user is not None: |
|
441 | if user is not None: | |
442 | user = os.path.expandvars(user) |
|
442 | user = os.path.expandvars(user) | |
443 | if user is None: |
|
443 | if user is None: |
@@ -52,15 +52,34 b'' | |||||
52 | abort: no username supplied |
|
52 | abort: no username supplied | |
53 | (use "hg config --edit" to set your username) |
|
53 | (use "hg config --edit" to set your username) | |
54 | [255] |
|
54 | [255] | |
|
55 | ||||
|
56 | # test alternate config var | |||
|
57 | ||||
|
58 | $ echo 1234 > asdf | |||
|
59 | $ echo "[ui]" > .hg/hgrc | |||
|
60 | $ echo "user = Foo Bar II <foo2@bar.com>" >> .hg/hgrc | |||
|
61 | $ hg commit -m commit-1 | |||
|
62 | $ hg tip | |||
|
63 | changeset: 4:6f24bfb4c617 | |||
|
64 | tag: tip | |||
|
65 | user: Foo Bar II <foo2@bar.com> | |||
|
66 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
67 | summary: commit-1 | |||
|
68 | ||||
|
69 | # test no .hg/hgrc (uses generated non-interactive username) | |||
|
70 | ||||
|
71 | $ echo space > asdf | |||
55 |
$ |
|
72 | $ rm .hg/hgrc | |
56 |
$ |
|
73 | $ hg commit -m commit-1 2>&1 | |
57 | no username found, using '[^']*' instead (re) |
|
74 | no username found, using '[^']*' instead (re) | |
58 |
|
75 | |||
59 | $ echo space > asdf |
|
76 | $ echo space2 > asdf | |
60 | $ hg commit -u ' ' -m commit-1 |
|
77 | $ hg commit -u ' ' -m commit-1 | |
61 | transaction abort! |
|
78 | transaction abort! | |
62 | rollback completed |
|
79 | rollback completed | |
63 | abort: empty username! |
|
80 | abort: empty username! | |
64 | [255] |
|
81 | [255] | |
65 |
|
82 | |||
|
83 | # don't add tests here, previous test is unstable | |||
|
84 | ||||
66 | $ cd .. |
|
85 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now