Mercurial > hg
annotate tests/test-mq-qnew.t @ 12748:d10369fefd01
alias: fail gracefully when invalid global options are given (issue2442)
This patch modifies the check for shell aliases to prevent crashing when an invalid
global option is given.
When an invalid global option is given the check will simply return and let the
normal error handling for this case happen.
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Sun, 17 Oct 2010 13:24:37 -0400 |
parents | 3160698100c6 |
children | 1634287b6ab1 |
rev | line source |
---|---|
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
1 |
12466 | 2 $ catpatch() { |
3 > cat $1 | sed -e "s/^\(# Parent \).*/\1/" | |
4 > } | |
5 $ echo "[extensions]" >> $HGRCPATH | |
6 $ echo "mq=" >> $HGRCPATH | |
7 $ runtest() { | |
8 > hg init mq | |
9 > cd mq | |
10 > | |
11 > echo a > a | |
12 > hg ci -Ama | |
13 > | |
14 > echo '% qnew should refuse bad patch names' | |
15 > hg qnew series | |
16 > hg qnew status | |
17 > hg qnew guards | |
18 > hg qnew .hgignore | |
19 > hg qnew .mqfoo | |
20 > hg qnew 'foo#bar' | |
21 > hg qnew 'foo:bar' | |
22 > | |
23 > hg qinit -c | |
24 > | |
25 > echo '% qnew with name containing slash' | |
26 > hg qnew foo/bar.patch | |
27 > hg qseries | |
28 > hg qpop | |
29 > hg qdelete foo/bar.patch | |
30 > | |
31 > echo '% qnew with uncommitted changes' | |
32 > echo a > somefile | |
33 > hg add somefile | |
34 > hg qnew uncommitted.patch | |
35 > hg st | |
36 > hg qseries | |
37 > | |
38 > echo '% qnew implies add' | |
39 > hg -R .hg/patches st | |
40 > | |
41 > echo '% qnew missing' | |
42 > hg qnew missing.patch missing | |
43 > | |
44 > echo '% qnew -m' | |
45 > hg qnew -m 'foo bar' mtest.patch | |
46 > catpatch .hg/patches/mtest.patch | |
47 > | |
48 > echo '% qnew twice' | |
49 > hg qnew first.patch | |
50 > hg qnew first.patch | |
51 > | |
52 > touch ../first.patch | |
53 > hg qimport ../first.patch | |
54 > | |
55 > echo '% qnew -f from a subdirectory' | |
56 > hg qpop -a | |
57 > mkdir d | |
58 > cd d | |
59 > echo b > b | |
60 > hg ci -Am t | |
61 > echo b >> b | |
62 > hg st | |
63 > hg qnew -g -f p | |
64 > catpatch ../.hg/patches/p | |
65 > | |
66 > echo '% qnew -u with no username configured' | |
67 > HGUSER= hg qnew -u blue red | |
68 > catpatch ../.hg/patches/red | |
69 > | |
70 > echo '% qnew -e -u with no username configured' | |
71 > HGUSER= hg qnew -e -u chartreuse fucsia | |
72 > catpatch ../.hg/patches/fucsia | |
73 > | |
74 > echo '% fail when trying to import a merge' | |
75 > hg init merge | |
76 > cd merge | |
77 > touch a | |
78 > hg ci -Am null | |
79 > echo a >> a | |
80 > hg ci -m a | |
81 > hg up -r 0 | |
82 > echo b >> a | |
83 > hg ci -m b | |
84 > hg merge -f 1 | |
85 > hg resolve --mark a | |
86 > hg qnew -f merge | |
87 > | |
88 > cd ../../.. | |
89 > rm -r mq | |
90 > } | |
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
91 |
12466 | 92 plain headers |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
93 |
12466 | 94 $ echo "[mq]" >> $HGRCPATH |
95 $ echo "plain=true" >> $HGRCPATH | |
96 $ mkdir sandbox | |
97 $ (cd sandbox ; runtest) | |
98 adding a | |
99 % qnew should refuse bad patch names | |
100 abort: "series" cannot be used as the name of a patch | |
101 abort: "status" cannot be used as the name of a patch | |
102 abort: "guards" cannot be used as the name of a patch | |
103 abort: ".hgignore" cannot be used as the name of a patch | |
104 abort: ".mqfoo" cannot be used as the name of a patch | |
105 abort: "foo#bar" cannot be used as the name of a patch | |
106 abort: "foo:bar" cannot be used as the name of a patch | |
107 % qnew with name containing slash | |
108 foo/bar.patch | |
109 popping foo/bar.patch | |
110 patch queue now empty | |
111 % qnew with uncommitted changes | |
112 uncommitted.patch | |
113 % qnew implies add | |
114 A .hgignore | |
115 A series | |
116 A uncommitted.patch | |
117 % qnew missing | |
118 abort: missing: No such file or directory | |
119 % qnew -m | |
120 foo bar | |
121 | |
122 % qnew twice | |
123 abort: patch "first.patch" already exists | |
124 abort: patch "first.patch" already exists | |
125 % qnew -f from a subdirectory | |
126 popping first.patch | |
127 popping mtest.patch | |
128 popping uncommitted.patch | |
129 patch queue now empty | |
130 adding d/b | |
131 M d/b | |
132 diff --git a/d/b b/d/b | |
133 --- a/d/b | |
134 +++ b/d/b | |
135 @@ -1,1 +1,2 @@ | |
136 b | |
137 +b | |
138 % qnew -u with no username configured | |
139 From: blue | |
140 | |
141 % qnew -e -u with no username configured | |
142 From: chartreuse | |
143 | |
144 % fail when trying to import a merge | |
145 adding a | |
146 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
147 created new head | |
148 merging a | |
149 warning: conflicts during merge. | |
150 merging a failed! | |
151 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
152 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
153 abort: cannot manage merge changesets | |
154 $ rm -r sandbox | |
2714
85070b784896
Fix test-mq-qnew-twice exit code and output.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2711
diff
changeset
|
155 |
12466 | 156 hg headers |
11575
a5903e612f07
mq: evaluate --user before invoking editor with -e (issue2289)
Brendan Cully <brendan@kublai.com>
parents:
11513
diff
changeset
|
157 |
12466 | 158 $ echo "plain=false" >> $HGRCPATH |
159 $ mkdir sandbox | |
160 $ (cd sandbox ; runtest) | |
161 adding a | |
162 % qnew should refuse bad patch names | |
163 abort: "series" cannot be used as the name of a patch | |
164 abort: "status" cannot be used as the name of a patch | |
165 abort: "guards" cannot be used as the name of a patch | |
166 abort: ".hgignore" cannot be used as the name of a patch | |
167 abort: ".mqfoo" cannot be used as the name of a patch | |
168 abort: "foo#bar" cannot be used as the name of a patch | |
169 abort: "foo:bar" cannot be used as the name of a patch | |
170 % qnew with name containing slash | |
171 foo/bar.patch | |
172 popping foo/bar.patch | |
173 patch queue now empty | |
174 % qnew with uncommitted changes | |
175 uncommitted.patch | |
176 % qnew implies add | |
177 A .hgignore | |
178 A series | |
179 A uncommitted.patch | |
180 % qnew missing | |
181 abort: missing: No such file or directory | |
182 % qnew -m | |
183 # HG changeset patch | |
184 # Parent | |
185 foo bar | |
186 | |
187 % qnew twice | |
188 abort: patch "first.patch" already exists | |
189 abort: patch "first.patch" already exists | |
190 % qnew -f from a subdirectory | |
191 popping first.patch | |
192 popping mtest.patch | |
193 popping uncommitted.patch | |
194 patch queue now empty | |
195 adding d/b | |
196 M d/b | |
197 # HG changeset patch | |
198 # Parent | |
199 diff --git a/d/b b/d/b | |
200 --- a/d/b | |
201 +++ b/d/b | |
202 @@ -1,1 +1,2 @@ | |
203 b | |
204 +b | |
205 % qnew -u with no username configured | |
206 # HG changeset patch | |
207 # Parent | |
208 # User blue | |
209 % qnew -e -u with no username configured | |
210 # HG changeset patch | |
211 # Parent | |
212 # User chartreuse | |
213 % fail when trying to import a merge | |
214 adding a | |
215 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
216 created new head | |
217 merging a | |
218 warning: conflicts during merge. | |
219 merging a failed! | |
220 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
221 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
222 abort: cannot manage merge changesets | |
223 $ rm -r sandbox |