Mercurial > hg-stable
comparison tests/test-mq-qnew.t @ 31562:448acdee9161
mq: reject new patch name containing leading/trailing whitespace
We could create a patch of such name, but it wouldn't be processed properly
by mq as parseseries() strips leading/trailing whitespace.
The test of default message (added by b9a16ed5acec) is no longer be useful
so removed.
This issue was reported as:
https://bitbucket.org/tortoisehg/thg/issues/4693/
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 20 Mar 2017 11:38:37 +0900 |
parents | 4414d500604f |
children | 4441705b7111 |
comparison
equal
deleted
inserted
replaced
31561:7c7d3ad7ca5c | 31562:448acdee9161 |
---|---|
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 > hg qnew "`echo foo; echo bar`" | 24 > hg qnew "`echo foo; echo bar`" |
25 > hg qnew ' foo' | |
26 > hg qnew 'foo ' | |
25 > | 27 > |
26 > hg qinit -c | 28 > hg qinit -c |
27 > | 29 > |
28 > echo '% qnew with name containing slash' | 30 > echo '% qnew with name containing slash' |
29 > hg qnew foo/ | 31 > hg qnew foo/ |
110 abort: patch name cannot begin with ".hg" | 112 abort: patch name cannot begin with ".hg" |
111 abort: patch name cannot begin with ".mq" | 113 abort: patch name cannot begin with ".mq" |
112 abort: '#' cannot be used in the name of a patch | 114 abort: '#' cannot be used in the name of a patch |
113 abort: ':' cannot be used in the name of a patch | 115 abort: ':' cannot be used in the name of a patch |
114 abort: '\n' cannot be used in the name of a patch | 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 % qnew with name containing slash | 119 % qnew with name containing slash |
116 abort: path ends in directory separator: foo/ (glob) | 120 abort: path ends in directory separator: foo/ (glob) |
117 abort: "foo" already exists as a directory | 121 abort: "foo" already exists as a directory |
118 foo/bar.patch | 122 foo/bar.patch |
119 popping foo/bar.patch | 123 popping foo/bar.patch |
178 abort: patch name cannot begin with ".hg" | 182 abort: patch name cannot begin with ".hg" |
179 abort: patch name cannot begin with ".mq" | 183 abort: patch name cannot begin with ".mq" |
180 abort: '#' cannot be used in the name of a patch | 184 abort: '#' cannot be used in the name of a patch |
181 abort: ':' cannot be used in the name of a patch | 185 abort: ':' cannot be used in the name of a patch |
182 abort: '\n' cannot be used in the name of a patch | 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 % qnew with name containing slash | 189 % qnew with name containing slash |
184 abort: path ends in directory separator: foo/ (glob) | 190 abort: path ends in directory separator: foo/ (glob) |
185 abort: "foo" already exists as a directory | 191 abort: "foo" already exists as a directory |
186 foo/bar.patch | 192 foo/bar.patch |
187 popping foo/bar.patch | 193 popping foo/bar.patch |
311 | 317 |
312 $ cat >> .hg/hgrc <<EOF | 318 $ cat >> .hg/hgrc <<EOF |
313 > [hooks] | 319 > [hooks] |
314 > pretxncommit.unexpectedabort = | 320 > pretxncommit.unexpectedabort = |
315 > EOF | 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 |