Show More
@@ -1116,6 +1116,10 b' class queue(object):' | |||
|
1116 | 1116 | if name in self._reserved: |
|
1117 | 1117 | raise error.Abort(_('"%s" cannot be used as the name of a patch') |
|
1118 | 1118 | % name) |
|
1119 | if name != name.strip(): | |
|
1120 | # whitespace is stripped by parseseries() | |
|
1121 | raise error.Abort(_('patch name cannot begin or end with ' | |
|
1122 | 'whitespace')) | |
|
1119 | 1123 | for prefix in ('.hg', '.mq'): |
|
1120 | 1124 | if name.startswith(prefix): |
|
1121 | 1125 | raise error.Abort(_('patch name cannot begin with "%s"') |
@@ -247,11 +247,28 b' qimport -e --name with --force' | |||
|
247 | 247 | this-name-is-better |
|
248 | 248 | url.diff |
|
249 | 249 | |
|
250 | import patch of bad filename | |
|
251 | ||
|
252 | $ touch '../ bad.diff' | |
|
253 | $ hg qimport '../ bad.diff' | |
|
254 | abort: patch name cannot begin or end with whitespace | |
|
255 | [255] | |
|
256 | $ touch '.hg/patches/ bad.diff' | |
|
257 | $ hg qimport -e ' bad.diff' | |
|
258 | abort: patch name cannot begin or end with whitespace | |
|
259 | [255] | |
|
260 | ||
|
250 | 261 | qimport with bad name, should abort before reading file |
|
251 | 262 | |
|
252 | 263 | $ hg qimport non-existent-file --name .hg |
|
253 | 264 | abort: patch name cannot begin with ".hg" |
|
254 | 265 | [255] |
|
266 | $ hg qimport non-existent-file --name ' foo' | |
|
267 | abort: patch name cannot begin or end with whitespace | |
|
268 | [255] | |
|
269 | $ hg qimport non-existent-file --name 'foo ' | |
|
270 | abort: patch name cannot begin or end with whitespace | |
|
271 | [255] | |
|
255 | 272 | |
|
256 | 273 | qimport http:// patch with leading slashes in url |
|
257 | 274 |
@@ -22,6 +22,8 b'' | |||
|
22 | 22 | > hg qnew 'foo#bar' |
|
23 | 23 | > hg qnew 'foo:bar' |
|
24 | 24 | > hg qnew "`echo foo; echo bar`" |
|
25 | > hg qnew ' foo' | |
|
26 | > hg qnew 'foo ' | |
|
25 | 27 | > |
|
26 | 28 | > hg qinit -c |
|
27 | 29 | > |
@@ -112,6 +114,8 b' plain headers' | |||
|
112 | 114 | abort: '#' cannot be used in the name of a patch |
|
113 | 115 | abort: ':' cannot be used in the name of a patch |
|
114 | 116 | abort: '\n' cannot be used in the name of a patch |
|
117 | abort: patch name cannot begin or end with whitespace | |
|
118 | abort: patch name cannot begin or end with whitespace | |
|
115 | 119 | % qnew with name containing slash |
|
116 | 120 | abort: path ends in directory separator: foo/ (glob) |
|
117 | 121 | abort: "foo" already exists as a directory |
@@ -180,6 +184,8 b' hg headers' | |||
|
180 | 184 | abort: '#' cannot be used in the name of a patch |
|
181 | 185 | abort: ':' cannot be used in the name of a patch |
|
182 | 186 | abort: '\n' cannot be used in the name of a patch |
|
187 | abort: patch name cannot begin or end with whitespace | |
|
188 | abort: patch name cannot begin or end with whitespace | |
|
183 | 189 | % qnew with name containing slash |
|
184 | 190 | abort: path ends in directory separator: foo/ (glob) |
|
185 | 191 | abort: "foo" already exists as a directory |
@@ -313,36 +319,3 b' Test saving last-message.txt' | |||
|
313 | 319 | > [hooks] |
|
314 | 320 | > pretxncommit.unexpectedabort = |
|
315 | 321 | > EOF |
|
316 | ||
|
317 | #if unix-permissions | |
|
318 | ||
|
319 | Test handling default message with the patch filename with tail whitespaces | |
|
320 | ||
|
321 | $ cat > $TESTTMP/editor.sh << EOF | |
|
322 | > echo "==== before editing" | |
|
323 | > cat \$1 | |
|
324 | > echo "====" | |
|
325 | > echo "[mq]: patch " > \$1 | |
|
326 | > EOF | |
|
327 | ||
|
328 | $ rm -f .hg/last-message.txt | |
|
329 | $ hg status | |
|
330 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e "patch " | |
|
331 | ==== before editing | |
|
332 | ||
|
333 | ||
|
334 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
|
335 | HG: Leave message empty to use default message. | |
|
336 | HG: -- | |
|
337 | HG: user: test | |
|
338 | HG: branch 'default' | |
|
339 | HG: no files changed | |
|
340 | ==== | |
|
341 | $ cat ".hg/patches/patch " | |
|
342 | # HG changeset patch | |
|
343 | # Parent 0000000000000000000000000000000000000000 | |
|
344 | ||
|
345 | ||
|
346 | $ cd .. | |
|
347 | ||
|
348 | #endif |
@@ -239,6 +239,12 b' qrecord with bad patch name, should abor' | |||
|
239 | 239 | $ hg qrecord .hg |
|
240 | 240 | abort: patch name cannot begin with ".hg" |
|
241 | 241 | [255] |
|
242 | $ hg qrecord ' foo' | |
|
243 | abort: patch name cannot begin or end with whitespace | |
|
244 | [255] | |
|
245 | $ hg qrecord 'foo ' | |
|
246 | abort: patch name cannot begin or end with whitespace | |
|
247 | [255] | |
|
242 | 248 | |
|
243 | 249 | qrecord a.patch |
|
244 | 250 |
General Comments 0
You need to be logged in to leave comments.
Login now