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