comparison tests/test-commit.t @ 11802:d26b7cc96bc4

tests: unify test-commit
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Thu, 12 Aug 2010 22:22:17 +0900
parents tests/test-commit@8766fee6f225
children 6f58430dfdd0
comparison
equal deleted inserted replaced
11801:dedf7c811436 11802:d26b7cc96bc4
1 commit date test
2
3 $ hg init test
4 $ cd test
5 $ echo foo > foo
6 $ hg add foo
7 $ HGEDITOR=true hg commit -m ""
8 abort: empty commit message
9 $ hg commit -d '0 0' -m commit-1
10 $ echo foo >> foo
11 $ hg commit -d '1 4444444' -m commit-3
12 abort: impossible time zone offset: 4444444
13 $ hg commit -d '1 15.1' -m commit-4
14 abort: invalid date: '1\t15.1'
15 $ hg commit -d 'foo bar' -m commit-5
16 abort: invalid date: 'foo bar'
17 $ hg commit -d ' 1 4444' -m commit-6
18 $ hg commit -d '111111111111 0' -m commit-7
19 abort: date exceeds 32 bits: 111111111111
20
21 commit added file that has been deleted
22
23 $ echo bar > bar
24 $ hg add bar
25 $ rm bar
26 $ hg commit -d "1000000 0" -m commit-8
27 nothing changed
28 $ hg commit -d "1000000 0" -m commit-8-2 bar
29 abort: bar: file not found!
30
31 $ hg -q revert -a --no-backup
32
33 $ mkdir dir
34 $ echo boo > dir/file
35 $ hg add
36 adding dir/file
37 $ hg -v commit -m commit-9 dir
38 dir/file
39 committed changeset 2:d2a76177cb42
40
41 $ echo > dir.file
42 $ hg add
43 adding dir.file
44 $ hg commit -m commit-10 dir dir.file
45 abort: dir: no match under directory!
46
47 $ echo >> dir/file
48 $ mkdir bleh
49 $ mkdir dir2
50 $ cd bleh
51 $ hg commit -m commit-11 .
52 abort: bleh: no match under directory!
53 $ hg commit -m commit-12 ../dir ../dir2
54 abort: dir2: no match under directory!
55 $ hg -v commit -m commit-13 ../dir
56 dir/file
57 committed changeset 3:1cd62a2d8db5
58 $ cd ..
59
60 $ hg commit -m commit-14 does-not-exist
61 abort: does-not-exist: No such file or directory
62 $ ln -s foo baz
63 $ hg commit -m commit-15 baz
64 abort: baz: file not tracked!
65 $ touch quux
66 $ hg commit -m commit-16 quux
67 abort: quux: file not tracked!
68 $ echo >> dir/file
69 $ hg -v commit -m commit-17 dir/file
70 dir/file
71 committed changeset 4:49176991390e
72
73 An empty date was interpreted as epoch origin
74
75 $ echo foo >> foo
76 $ hg commit -d '' -m commit-no-date
77 $ hg tip --template '{date|isodate}\n' | grep '1970'
78 $ cd ..
79
80
81 partial subdir commit test
82
83 $ hg init test2
84 $ cd test2
85 $ mkdir foo
86 $ echo foo > foo/foo
87 $ mkdir bar
88 $ echo bar > bar/bar
89 $ hg add
90 adding bar/bar
91 adding foo/foo
92 $ hg ci -d '1000000 0' -m commit-subdir-1 foo
93 $ hg ci -d '1000001 0' -m commit-subdir-2 bar
94
95 subdir log 1
96
97 $ hg log -v foo
98 changeset: 0:6ef3cb06bb80
99 user: test
100 date: Mon Jan 12 13:46:40 1970 +0000
101 files: foo/foo
102 description:
103 commit-subdir-1
104
105
106
107 subdir log 2
108
109 $ hg log -v bar
110 changeset: 1:f2e51572cf5a
111 tag: tip
112 user: test
113 date: Mon Jan 12 13:46:41 1970 +0000
114 files: bar/bar
115 description:
116 commit-subdir-2
117
118
119
120 full log
121
122 $ hg log -v
123 changeset: 1:f2e51572cf5a
124 tag: tip
125 user: test
126 date: Mon Jan 12 13:46:41 1970 +0000
127 files: bar/bar
128 description:
129 commit-subdir-2
130
131
132 changeset: 0:6ef3cb06bb80
133 user: test
134 date: Mon Jan 12 13:46:40 1970 +0000
135 files: foo/foo
136 description:
137 commit-subdir-1
138
139
140 $ cd ..
141
142
143 dot and subdir commit test
144
145 $ hg init test3
146 $ cd test3
147 $ mkdir foo
148 $ echo foo content > foo/plain-file
149 $ hg add foo/plain-file
150 $ hg ci -d '1000000 0' -m commit-foo-subdir foo
151 $ echo modified foo content > foo/plain-file
152 $ hg ci -d '2000000 0' -m commit-foo-dot .
153
154 full log
155
156 $ hg log -v
157 changeset: 1:d9180e04fa8a
158 tag: tip
159 user: test
160 date: Sat Jan 24 03:33:20 1970 +0000
161 files: foo/plain-file
162 description:
163 commit-foo-dot
164
165
166 changeset: 0:80b572aaf098
167 user: test
168 date: Mon Jan 12 13:46:40 1970 +0000
169 files: foo/plain-file
170 description:
171 commit-foo-subdir
172
173
174
175 subdir log
176
177 $ cd foo
178 $ hg log .
179 changeset: 1:d9180e04fa8a
180 tag: tip
181 user: test
182 date: Sat Jan 24 03:33:20 1970 +0000
183 summary: commit-foo-dot
184
185 changeset: 0:80b572aaf098
186 user: test
187 date: Mon Jan 12 13:46:40 1970 +0000
188 summary: commit-foo-subdir
189
190 $ cd ..
191 $ cd ..
192
193 $ cd ..
194 $ hg init issue1049
195 $ cd issue1049
196 $ echo a > a
197 $ hg ci -Ama
198 adding a
199 $ echo a >> a
200 $ hg ci -mb
201 $ hg up 0
202 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
203 $ echo b >> a
204 $ hg ci -mc
205 created new head
206 $ HGMERGE=true hg merge
207 merging a
208 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
209 (branch merge, don't forget to commit)
210
211 should fail because we are specifying a file name
212
213 $ hg ci -mmerge a
214 abort: cannot partially commit a merge (do not specify files or patterns)
215
216 should fail because we are specifying a pattern
217
218 $ hg ci -mmerge -I a
219 abort: cannot partially commit a merge (do not specify files or patterns)
220
221 should succeed
222
223 $ hg ci -mmerge
224 $ cd ..
225
226
227 test commit message content
228
229 $ hg init commitmsg
230 $ cd commitmsg
231 $ echo changed > changed
232 $ echo removed > removed
233 $ hg ci -qAm init
234
235 $ hg rm removed
236 $ echo changed >> changed
237 $ echo added > added
238 $ hg add added
239 $ HGEDITOR=cat hg ci -A
240
241
242 HG: Enter commit message. Lines beginning with 'HG:' are removed.
243 HG: Leave message empty to abort commit.
244 HG: --
245 HG: user: test
246 HG: branch 'default'
247 HG: added added
248 HG: changed changed
249 HG: removed removed
250 abort: empty commit message
251 $ cd ..
252
253 $ exit 0