##// END OF EJS Templates
tests: fix test failure on vfat...
Matt Mackall -
r21276:25b7c760 default
parent child Browse files
Show More
@@ -1,323 +1,327
1
1
2 $ catpatch() {
2 $ catpatch() {
3 > cat $1 | sed -e "s/^\(# Parent \).*/\1/"
3 > cat $1 | sed -e "s/^\(# Parent \).*/\1/"
4 > }
4 > }
5 $ echo "[extensions]" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "mq=" >> $HGRCPATH
6 $ echo "mq=" >> $HGRCPATH
7 $ runtest() {
7 $ runtest() {
8 > hg init mq
8 > hg init mq
9 > cd mq
9 > cd mq
10 >
10 >
11 > echo a > a
11 > echo a > a
12 > hg ci -Ama
12 > hg ci -Ama
13 >
13 >
14 > echo '% qnew should refuse bad patch names'
14 > echo '% qnew should refuse bad patch names'
15 > hg qnew series
15 > hg qnew series
16 > hg qnew status
16 > hg qnew status
17 > hg qnew guards
17 > hg qnew guards
18 > hg qnew .
18 > hg qnew .
19 > hg qnew ..
19 > hg qnew ..
20 > hg qnew .hgignore
20 > hg qnew .hgignore
21 > hg qnew .mqfoo
21 > hg qnew .mqfoo
22 > hg qnew 'foo#bar'
22 > hg qnew 'foo#bar'
23 > hg qnew 'foo:bar'
23 > hg qnew 'foo:bar'
24 >
24 >
25 > hg qinit -c
25 > hg qinit -c
26 >
26 >
27 > echo '% qnew with name containing slash'
27 > echo '% qnew with name containing slash'
28 > hg qnew foo/
28 > hg qnew foo/
29 > hg qnew foo/bar.patch
29 > hg qnew foo/bar.patch
30 > hg qnew foo
30 > hg qnew foo
31 > hg qseries
31 > hg qseries
32 > hg qpop
32 > hg qpop
33 > hg qdelete foo/bar.patch
33 > hg qdelete foo/bar.patch
34 >
34 >
35 > echo '% qnew with uncommitted changes'
35 > echo '% qnew with uncommitted changes'
36 > echo a > somefile
36 > echo a > somefile
37 > hg add somefile
37 > hg add somefile
38 > hg qnew uncommitted.patch
38 > hg qnew uncommitted.patch
39 > hg st
39 > hg st
40 > hg qseries
40 > hg qseries
41 >
41 >
42 > echo '% qnew implies add'
42 > echo '% qnew implies add'
43 > hg -R .hg/patches st
43 > hg -R .hg/patches st
44 >
44 >
45 > echo '% qnew missing'
45 > echo '% qnew missing'
46 > hg qnew missing.patch missing
46 > hg qnew missing.patch missing
47 >
47 >
48 > echo '% qnew -m'
48 > echo '% qnew -m'
49 > hg qnew -m 'foo bar' mtest.patch
49 > hg qnew -m 'foo bar' mtest.patch
50 > catpatch .hg/patches/mtest.patch
50 > catpatch .hg/patches/mtest.patch
51 >
51 >
52 > echo '% qnew twice'
52 > echo '% qnew twice'
53 > hg qnew first.patch
53 > hg qnew first.patch
54 > hg qnew first.patch
54 > hg qnew first.patch
55 >
55 >
56 > touch ../first.patch
56 > touch ../first.patch
57 > hg qimport ../first.patch
57 > hg qimport ../first.patch
58 >
58 >
59 > echo '% qnew -f from a subdirectory'
59 > echo '% qnew -f from a subdirectory'
60 > hg qpop -a
60 > hg qpop -a
61 > mkdir d
61 > mkdir d
62 > cd d
62 > cd d
63 > echo b > b
63 > echo b > b
64 > hg ci -Am t
64 > hg ci -Am t
65 > echo b >> b
65 > echo b >> b
66 > hg st
66 > hg st
67 > hg qnew -g -f p
67 > hg qnew -g -f p
68 > catpatch ../.hg/patches/p
68 > catpatch ../.hg/patches/p
69 >
69 >
70 > echo '% qnew -u with no username configured'
70 > echo '% qnew -u with no username configured'
71 > HGUSER= hg qnew -u blue red
71 > HGUSER= hg qnew -u blue red
72 > catpatch ../.hg/patches/red
72 > catpatch ../.hg/patches/red
73 >
73 >
74 > echo '% qnew -e -u with no username configured'
74 > echo '% qnew -e -u with no username configured'
75 > HGUSER= hg qnew -e -u chartreuse fucsia
75 > HGUSER= hg qnew -e -u chartreuse fucsia
76 > catpatch ../.hg/patches/fucsia
76 > catpatch ../.hg/patches/fucsia
77 >
77 >
78 > echo '% fail when trying to import a merge'
78 > echo '% fail when trying to import a merge'
79 > hg init merge
79 > hg init merge
80 > cd merge
80 > cd merge
81 > touch a
81 > touch a
82 > hg ci -Am null
82 > hg ci -Am null
83 > echo a >> a
83 > echo a >> a
84 > hg ci -m a
84 > hg ci -m a
85 > hg up -r 0
85 > hg up -r 0
86 > echo b >> a
86 > echo b >> a
87 > hg ci -m b
87 > hg ci -m b
88 > hg merge -f 1
88 > hg merge -f 1
89 > hg resolve --mark a
89 > hg resolve --mark a
90 > hg qnew -f merge
90 > hg qnew -f merge
91 >
91 >
92 > cd ../../..
92 > cd ../../..
93 > rm -r mq
93 > rm -r mq
94 > }
94 > }
95
95
96 plain headers
96 plain headers
97
97
98 $ echo "[mq]" >> $HGRCPATH
98 $ echo "[mq]" >> $HGRCPATH
99 $ echo "plain=true" >> $HGRCPATH
99 $ echo "plain=true" >> $HGRCPATH
100 $ mkdir sandbox
100 $ mkdir sandbox
101 $ (cd sandbox ; runtest)
101 $ (cd sandbox ; runtest)
102 adding a
102 adding a
103 % qnew should refuse bad patch names
103 % qnew should refuse bad patch names
104 abort: "series" cannot be used as the name of a patch
104 abort: "series" cannot be used as the name of a patch
105 abort: "status" cannot be used as the name of a patch
105 abort: "status" cannot be used as the name of a patch
106 abort: "guards" cannot be used as the name of a patch
106 abort: "guards" cannot be used as the name of a patch
107 abort: "." cannot be used as the name of a patch
107 abort: "." cannot be used as the name of a patch
108 abort: ".." cannot be used as the name of a patch
108 abort: ".." cannot be used as the name of a patch
109 abort: patch name cannot begin with ".hg"
109 abort: patch name cannot begin with ".hg"
110 abort: patch name cannot begin with ".mq"
110 abort: patch name cannot begin with ".mq"
111 abort: "#" cannot be used in the name of a patch
111 abort: "#" cannot be used in the name of a patch
112 abort: ":" cannot be used in the name of a patch
112 abort: ":" cannot be used in the name of a patch
113 % qnew with name containing slash
113 % qnew with name containing slash
114 abort: path ends in directory separator: foo/ (glob)
114 abort: path ends in directory separator: foo/ (glob)
115 abort: "foo" already exists as a directory
115 abort: "foo" already exists as a directory
116 foo/bar.patch
116 foo/bar.patch
117 popping foo/bar.patch
117 popping foo/bar.patch
118 patch queue now empty
118 patch queue now empty
119 % qnew with uncommitted changes
119 % qnew with uncommitted changes
120 uncommitted.patch
120 uncommitted.patch
121 % qnew implies add
121 % qnew implies add
122 A .hgignore
122 A .hgignore
123 A series
123 A series
124 A uncommitted.patch
124 A uncommitted.patch
125 % qnew missing
125 % qnew missing
126 abort: missing: * (glob)
126 abort: missing: * (glob)
127 % qnew -m
127 % qnew -m
128 foo bar
128 foo bar
129
129
130 % qnew twice
130 % qnew twice
131 abort: patch "first.patch" already exists
131 abort: patch "first.patch" already exists
132 abort: patch "first.patch" already exists
132 abort: patch "first.patch" already exists
133 % qnew -f from a subdirectory
133 % qnew -f from a subdirectory
134 popping first.patch
134 popping first.patch
135 popping mtest.patch
135 popping mtest.patch
136 popping uncommitted.patch
136 popping uncommitted.patch
137 patch queue now empty
137 patch queue now empty
138 adding d/b
138 adding d/b
139 M d/b
139 M d/b
140 diff --git a/d/b b/d/b
140 diff --git a/d/b b/d/b
141 --- a/d/b
141 --- a/d/b
142 +++ b/d/b
142 +++ b/d/b
143 @@ -1,1 +1,2 @@
143 @@ -1,1 +1,2 @@
144 b
144 b
145 +b
145 +b
146 % qnew -u with no username configured
146 % qnew -u with no username configured
147 From: blue
147 From: blue
148
148
149 % qnew -e -u with no username configured
149 % qnew -e -u with no username configured
150 From: chartreuse
150 From: chartreuse
151
151
152 % fail when trying to import a merge
152 % fail when trying to import a merge
153 adding a
153 adding a
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 created new head
155 created new head
156 merging a
156 merging a
157 warning: conflicts during merge.
157 warning: conflicts during merge.
158 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
158 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
159 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
159 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
160 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
160 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
161 no more unresolved files
161 no more unresolved files
162 abort: cannot manage merge changesets
162 abort: cannot manage merge changesets
163 $ rm -r sandbox
163 $ rm -r sandbox
164
164
165 hg headers
165 hg headers
166
166
167 $ echo "plain=false" >> $HGRCPATH
167 $ echo "plain=false" >> $HGRCPATH
168 $ mkdir sandbox
168 $ mkdir sandbox
169 $ (cd sandbox ; runtest)
169 $ (cd sandbox ; runtest)
170 adding a
170 adding a
171 % qnew should refuse bad patch names
171 % qnew should refuse bad patch names
172 abort: "series" cannot be used as the name of a patch
172 abort: "series" cannot be used as the name of a patch
173 abort: "status" cannot be used as the name of a patch
173 abort: "status" cannot be used as the name of a patch
174 abort: "guards" cannot be used as the name of a patch
174 abort: "guards" cannot be used as the name of a patch
175 abort: "." cannot be used as the name of a patch
175 abort: "." cannot be used as the name of a patch
176 abort: ".." cannot be used as the name of a patch
176 abort: ".." cannot be used as the name of a patch
177 abort: patch name cannot begin with ".hg"
177 abort: patch name cannot begin with ".hg"
178 abort: patch name cannot begin with ".mq"
178 abort: patch name cannot begin with ".mq"
179 abort: "#" cannot be used in the name of a patch
179 abort: "#" cannot be used in the name of a patch
180 abort: ":" cannot be used in the name of a patch
180 abort: ":" cannot be used in the name of a patch
181 % qnew with name containing slash
181 % qnew with name containing slash
182 abort: path ends in directory separator: foo/ (glob)
182 abort: path ends in directory separator: foo/ (glob)
183 abort: "foo" already exists as a directory
183 abort: "foo" already exists as a directory
184 foo/bar.patch
184 foo/bar.patch
185 popping foo/bar.patch
185 popping foo/bar.patch
186 patch queue now empty
186 patch queue now empty
187 % qnew with uncommitted changes
187 % qnew with uncommitted changes
188 uncommitted.patch
188 uncommitted.patch
189 % qnew implies add
189 % qnew implies add
190 A .hgignore
190 A .hgignore
191 A series
191 A series
192 A uncommitted.patch
192 A uncommitted.patch
193 % qnew missing
193 % qnew missing
194 abort: missing: * (glob)
194 abort: missing: * (glob)
195 % qnew -m
195 % qnew -m
196 # HG changeset patch
196 # HG changeset patch
197 # Parent
197 # Parent
198 foo bar
198 foo bar
199
199
200 % qnew twice
200 % qnew twice
201 abort: patch "first.patch" already exists
201 abort: patch "first.patch" already exists
202 abort: patch "first.patch" already exists
202 abort: patch "first.patch" already exists
203 % qnew -f from a subdirectory
203 % qnew -f from a subdirectory
204 popping first.patch
204 popping first.patch
205 popping mtest.patch
205 popping mtest.patch
206 popping uncommitted.patch
206 popping uncommitted.patch
207 patch queue now empty
207 patch queue now empty
208 adding d/b
208 adding d/b
209 M d/b
209 M d/b
210 # HG changeset patch
210 # HG changeset patch
211 # Parent
211 # Parent
212 diff --git a/d/b b/d/b
212 diff --git a/d/b b/d/b
213 --- a/d/b
213 --- a/d/b
214 +++ b/d/b
214 +++ b/d/b
215 @@ -1,1 +1,2 @@
215 @@ -1,1 +1,2 @@
216 b
216 b
217 +b
217 +b
218 % qnew -u with no username configured
218 % qnew -u with no username configured
219 # HG changeset patch
219 # HG changeset patch
220 # Parent
220 # Parent
221 # User blue
221 # User blue
222 % qnew -e -u with no username configured
222 % qnew -e -u with no username configured
223 # HG changeset patch
223 # HG changeset patch
224 # Parent
224 # Parent
225 # User chartreuse
225 # User chartreuse
226 % fail when trying to import a merge
226 % fail when trying to import a merge
227 adding a
227 adding a
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 created new head
229 created new head
230 merging a
230 merging a
231 warning: conflicts during merge.
231 warning: conflicts during merge.
232 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
232 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
233 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
233 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
234 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
234 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
235 no more unresolved files
235 no more unresolved files
236 abort: cannot manage merge changesets
236 abort: cannot manage merge changesets
237 $ rm -r sandbox
237 $ rm -r sandbox
238
238
239 Test saving last-message.txt
239 Test saving last-message.txt
240
240
241 $ hg init repo
241 $ hg init repo
242 $ cd repo
242 $ cd repo
243
243
244 $ cat > $TESTTMP/commitfailure.py <<EOF
244 $ cat > $TESTTMP/commitfailure.py <<EOF
245 > from mercurial import util
245 > from mercurial import util
246 > def reposetup(ui, repo):
246 > def reposetup(ui, repo):
247 > class commitfailure(repo.__class__):
247 > class commitfailure(repo.__class__):
248 > def commit(self, *args, **kwargs):
248 > def commit(self, *args, **kwargs):
249 > raise util.Abort('emulating unexpected abort')
249 > raise util.Abort('emulating unexpected abort')
250 > repo.__class__ = commitfailure
250 > repo.__class__ = commitfailure
251 > EOF
251 > EOF
252 $ cat >> .hg/hgrc <<EOF
252 $ cat >> .hg/hgrc <<EOF
253 > [extensions]
253 > [extensions]
254 > # this failure occurs before editor invocation
254 > # this failure occurs before editor invocation
255 > commitfailure = $TESTTMP/commitfailure.py
255 > commitfailure = $TESTTMP/commitfailure.py
256 > EOF
256 > EOF
257
257
258 $ cat > $TESTTMP/editor.sh << EOF
258 $ cat > $TESTTMP/editor.sh << EOF
259 > echo "==== before editing"
259 > echo "==== before editing"
260 > cat \$1
260 > cat \$1
261 > echo "===="
261 > echo "===="
262 > echo "test saving last-message.txt" >> \$1
262 > echo "test saving last-message.txt" >> \$1
263 > EOF
263 > EOF
264
264
265 (test that editor is not invoked before transaction starting)
265 (test that editor is not invoked before transaction starting)
266
266
267 $ rm -f .hg/last-message.txt
267 $ rm -f .hg/last-message.txt
268 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
268 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
269 abort: emulating unexpected abort
269 abort: emulating unexpected abort
270 [255]
270 [255]
271 $ cat .hg/last-message.txt
271 $ cat .hg/last-message.txt
272 cat: .hg/last-message.txt: No such file or directory
272 cat: .hg/last-message.txt: No such file or directory
273 [1]
273 [1]
274
274
275 (test that editor is invoked and commit message is saved into
275 (test that editor is invoked and commit message is saved into
276 "last-message.txt")
276 "last-message.txt")
277
277
278 $ cat >> .hg/hgrc <<EOF
278 $ cat >> .hg/hgrc <<EOF
279 > [extensions]
279 > [extensions]
280 > commitfailure = !
280 > commitfailure = !
281 > [hooks]
281 > [hooks]
282 > # this failure occurs after editor invocation
282 > # this failure occurs after editor invocation
283 > pretxncommit.unexpectedabort = false
283 > pretxncommit.unexpectedabort = false
284 > EOF
284 > EOF
285
285
286 $ rm -f .hg/last-message.txt
286 $ rm -f .hg/last-message.txt
287 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
287 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
288 ==== before editing
288 ==== before editing
289
289
290 ====
290 ====
291 transaction abort!
291 transaction abort!
292 rollback completed
292 rollback completed
293 note: commit message saved in .hg/last-message.txt
293 note: commit message saved in .hg/last-message.txt
294 abort: pretxncommit.unexpectedabort hook exited with status 1
294 abort: pretxncommit.unexpectedabort hook exited with status 1
295 [255]
295 [255]
296 $ cat .hg/last-message.txt
296 $ cat .hg/last-message.txt
297
297
298 test saving last-message.txt
298 test saving last-message.txt
299
299
300 $ cat >> .hg/hgrc <<EOF
300 $ cat >> .hg/hgrc <<EOF
301 > [hooks]
301 > [hooks]
302 > pretxncommit.unexpectedabort =
302 > pretxncommit.unexpectedabort =
303 > EOF
303 > EOF
304
304
305 #if unix-permissions
306
305 Test handling default message with the patch filename with tail whitespaces
307 Test handling default message with the patch filename with tail whitespaces
306
308
307 $ cat > $TESTTMP/editor.sh << EOF
309 $ cat > $TESTTMP/editor.sh << EOF
308 > echo "==== before editing"
310 > echo "==== before editing"
309 > cat \$1
311 > cat \$1
310 > echo "===="
312 > echo "===="
311 > echo "[mq]: patch " > \$1
313 > echo "[mq]: patch " > \$1
312 > EOF
314 > EOF
313
315
314 $ rm -f .hg/last-message.txt
316 $ rm -f .hg/last-message.txt
315 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e "patch "
317 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e "patch "
316 ==== before editing
318 ==== before editing
317
319
318 ====
320 ====
319 $ cat ".hg/patches/patch "
321 $ cat ".hg/patches/patch "
320 # HG changeset patch
322 # HG changeset patch
321 # Parent 0000000000000000000000000000000000000000
323 # Parent 0000000000000000000000000000000000000000
322
324
323 $ cd ..
325 $ cd ..
326
327 #endif
General Comments 0
You need to be logged in to leave comments. Login now