Debian Codegraph @

tests/test-committer.t

raw
1 $ unset HGUSER
2 $ EMAIL="My Name <[email protected]>"
3 $ export EMAIL
4
5 $ hg init test
6 $ cd test
7 $ touch asdf
8 $ hg add asdf
9 $ hg commit -m commit-1
10 $ hg tip
11 changeset: 0:53f268a58230
12 tag: tip
13 user: My Name <[email protected]>
14 date: Thu Jan 01 00:00:00 1970 +0000
15 summary: commit-1
16
17
18 $ unset EMAIL
19 $ echo 1234 > asdf
20 $ hg commit -u "[email protected]" -m commit-1
21 $ hg tip
22 changeset: 1:3871b2a9e9bf
23 tag: tip
24 user: [email protected]
25 date: Thu Jan 01 00:00:00 1970 +0000
26 summary: commit-1
27
28 $ echo "[ui]" >> .hg/hgrc
29 $ echo "username = foobar <[email protected]>" >> .hg/hgrc
30 $ echo 12 > asdf
31 $ hg commit -m commit-1
32 $ hg tip
33 changeset: 2:8eeac6695c1c
34 tag: tip
35 user: foobar <[email protected]>
36 date: Thu Jan 01 00:00:00 1970 +0000
37 summary: commit-1
38
39 $ echo 1 > asdf
40 $ hg commit -u "[email protected]" -m commit-1
41 $ hg tip
42 changeset: 3:957606a725e4
43 tag: tip
44 user: [email protected]
45 date: Thu Jan 01 00:00:00 1970 +0000
46 summary: commit-1
47
48 $ echo 123 > asdf
49 $ echo "[ui]" > .hg/hgrc
50 $ echo "username = " >> .hg/hgrc
51 $ hg commit -m commit-1
52 abort: no username supplied
53 (use 'hg config --edit' to set your username)
54 [255]
55
56 # test alternate config var
57
58 $ echo 1234 > asdf
59 $ echo "[ui]" > .hg/hgrc
60 $ echo "user = Foo Bar II <[email protected]>" >> .hg/hgrc
61 $ hg commit -m commit-1
62 $ hg tip
63 changeset: 4:6f24bfb4c617
64 tag: tip
65 user: Foo Bar II <[email protected]>
66 date: Thu Jan 01 00:00:00 1970 +0000
67 summary: commit-1
68
69 # test prompt username
70
71 $ cat > .hg/hgrc <<EOF
72 > [ui]
73 > askusername = True
74 > EOF
75
76 $ echo 12345 > asdf
77 $ hg commit --config ui.interactive=False -m ask
78 enter a commit username:
79 no username found, using '[^']*' instead (re)
80 $ hg rollback -q
81
82 $ hg commit --config ui.interactive=True -m ask <<EOF
83 > Asked User <[email protected]>
84 > EOF
85 enter a commit username: Asked User <[email protected]>
86 $ hg tip
87 changeset: 5:84c91d963b70
88 tag: tip
89 user: Asked User <[email protected]>
90 date: Thu Jan 01 00:00:00 1970 +0000
91 summary: ask
92
93
94 # test no .hg/hgrc (uses generated non-interactive username)
95
96 $ echo space > asdf
97 $ rm .hg/hgrc
98 $ hg commit -m commit-1 2>&1
99 no username found, using '[^']*' instead (re)
100
101 $ echo space2 > asdf
102 $ hg commit -u ' ' -m commit-1
103 transaction abort!
104 rollback completed
105 abort: empty username
106 [50]
107
108 # don't add tests here, previous test is unstable
109
110 $ cd ..