Show More
@@ -1,326 +1,326 b'' | |||
|
1 | 1 | Environment setup for MQ |
|
2 | 2 | |
|
3 | 3 | $ echo "[extensions]" >> $HGRCPATH |
|
4 | 4 | $ echo "mq=" >> $HGRCPATH |
|
5 | 5 | $ cat >> $HGRCPATH <<EOF |
|
6 | 6 | > [defaults] |
|
7 | 7 | > # explicit date to commit with fixed hashid |
|
8 | 8 | > qnew = -d "0 0" |
|
9 | 9 | > qrefresh = -d "0 0" |
|
10 | 10 | > qfold = -d "0 0" |
|
11 | 11 | > EOF |
|
12 | 12 | $ hg init |
|
13 | 13 | $ hg qinit |
|
14 | 14 | |
|
15 | 15 | Should fail if no patches applied |
|
16 | 16 | (this tests also that editor is not invoked if '--edit' is not |
|
17 | 17 | specified) |
|
18 | 18 | |
|
19 | 19 | $ hg qrefresh |
|
20 | 20 | no patches applied |
|
21 | 21 | [1] |
|
22 | 22 | $ hg qrefresh -e |
|
23 | 23 | no patches applied |
|
24 | 24 | [1] |
|
25 | 25 | $ hg qnew -m "First commit message" first-patch |
|
26 | 26 | $ echo aaaa > file |
|
27 | 27 | $ hg add file |
|
28 | 28 | $ HGEDITOR=cat hg qrefresh |
|
29 | 29 | |
|
30 | 30 | Should display 'First commit message' |
|
31 | 31 | |
|
32 | 32 | $ hg log -l1 --template "{desc}\n" |
|
33 | 33 | First commit message |
|
34 | 34 | |
|
35 | 35 | Testing changing message with -m |
|
36 | 36 | (this tests also that '--edit' can be used with '--message', and |
|
37 | 37 | that '[committemplate] changeset' definition and commit log specific |
|
38 | 38 | template keyword 'extramsg' work well) |
|
39 | 39 | |
|
40 | 40 | $ cat >> .hg/hgrc <<EOF |
|
41 | 41 | > [committemplate] |
|
42 | 42 | > listupfiles = {file_adds % |
|
43 | 43 | > "HG: added {file}\n" }{file_mods % |
|
44 | 44 | > "HG: changed {file}\n" }{file_dels % |
|
45 | 45 | > "HG: removed {file}\n" }{if(files, "", |
|
46 | 46 | > "HG: no files changed\n")} |
|
47 | 47 | > |
|
48 | 48 | > changeset = HG: this is customized commit template |
|
49 | 49 | > {desc}\n\n |
|
50 | 50 | > HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
51 | 51 | > HG: {extramsg} |
|
52 | 52 | > HG: -- |
|
53 | 53 | > HG: user: {author} |
|
54 | 54 | > HG: branch '{branch}'\n{listupfiles} |
|
55 | 55 | > EOF |
|
56 | 56 | |
|
57 | 57 | $ echo bbbb > file |
|
58 | 58 | $ HGEDITOR=cat hg qrefresh -m "Second commit message" -e |
|
59 | 59 | HG: this is customized commit template |
|
60 | 60 | Second commit message |
|
61 | 61 | |
|
62 | 62 | |
|
63 | 63 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
64 | 64 | HG: Leave message empty to use default message. |
|
65 | 65 | HG: -- |
|
66 | 66 | HG: user: test |
|
67 | 67 | HG: branch 'default' |
|
68 | 68 | HG: added file |
|
69 | 69 | |
|
70 | 70 | $ cat >> .hg/hgrc <<EOF |
|
71 | 71 | > # disable customizing for subsequent tests |
|
72 | 72 | > [committemplate] |
|
73 | 73 | > changeset = |
|
74 | 74 | > EOF |
|
75 | 75 | |
|
76 | 76 | Should display 'Second commit message' |
|
77 | 77 | |
|
78 | 78 | $ hg log -l1 --template "{desc}\n" |
|
79 | 79 | Second commit message |
|
80 | 80 | |
|
81 | 81 | Testing changing message with -l |
|
82 | 82 | |
|
83 | 83 | $ echo "Third commit message" > logfile |
|
84 | 84 | $ echo " This is the 3rd log message" >> logfile |
|
85 | 85 | $ echo bbbb > file |
|
86 | 86 | $ hg qrefresh -l logfile |
|
87 | 87 | |
|
88 | 88 | Should display 'Third commit message\\\n This is the 3rd log message' |
|
89 | 89 | |
|
90 | 90 | $ hg log -l1 --template "{desc}\n" |
|
91 | 91 | Third commit message |
|
92 | 92 | This is the 3rd log message |
|
93 | 93 | |
|
94 | 94 | Testing changing message with -l- |
|
95 | 95 | |
|
96 | 96 | $ hg qnew -m "First commit message" second-patch |
|
97 | 97 | $ echo aaaa > file2 |
|
98 | 98 | $ hg add file2 |
|
99 | 99 | $ echo bbbb > file2 |
|
100 | 100 | $ (echo "Fifth commit message"; echo " This is the 5th log message") | hg qrefresh -l- |
|
101 | 101 | |
|
102 | 102 | Should display 'Fifth commit message\\\n This is the 5th log message' |
|
103 | 103 | |
|
104 | 104 | $ hg log -l1 --template "{desc}\n" |
|
105 | 105 | Fifth commit message |
|
106 | 106 | This is the 5th log message |
|
107 | 107 | |
|
108 | 108 | Test saving last-message.txt: |
|
109 | 109 | |
|
110 | 110 | $ cat > $TESTTMP/editor.sh << EOF |
|
111 | 111 | > echo "==== before editing" |
|
112 | 112 | > cat \$1 |
|
113 | 113 | > echo "====" |
|
114 | 114 | > (echo; echo "test saving last-message.txt") >> \$1 |
|
115 | 115 | > EOF |
|
116 | 116 | |
|
117 | 117 | $ cat > $TESTTMP/commitfailure.py <<EOF |
|
118 | 118 | > from mercurial import error |
|
119 | 119 | > def reposetup(ui, repo): |
|
120 | 120 | > class commitfailure(repo.__class__): |
|
121 | 121 | > def commit(self, *args, **kwargs): |
|
122 | > raise error.Abort('emulating unexpected abort') | |
|
122 | > raise error.Abort(b'emulating unexpected abort') | |
|
123 | 123 | > repo.__class__ = commitfailure |
|
124 | 124 | > EOF |
|
125 | 125 | |
|
126 | 126 | $ cat >> .hg/hgrc <<EOF |
|
127 | 127 | > [extensions] |
|
128 | 128 | > # this failure occurs before editor invocation |
|
129 | 129 | > commitfailure = $TESTTMP/commitfailure.py |
|
130 | 130 | > EOF |
|
131 | 131 | |
|
132 | 132 | $ hg qapplied |
|
133 | 133 | first-patch |
|
134 | 134 | second-patch |
|
135 | 135 | $ hg tip --template "{files}\n" |
|
136 | 136 | file2 |
|
137 | 137 | |
|
138 | 138 | (test that editor is not invoked before transaction starting) |
|
139 | 139 | |
|
140 | 140 | $ rm -f .hg/last-message.txt |
|
141 | 141 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e |
|
142 | 142 | qrefresh interrupted while patch was popped! (revert --all, qpush to recover) |
|
143 | 143 | abort: emulating unexpected abort |
|
144 | 144 | [255] |
|
145 | 145 | $ test -f .hg/last-message.txt |
|
146 | 146 | [1] |
|
147 | 147 | |
|
148 | 148 | (reset applied patches and directory status) |
|
149 | 149 | |
|
150 | 150 | $ cat >> .hg/hgrc <<EOF |
|
151 | 151 | > [extensions] |
|
152 | 152 | > commitfailure = ! |
|
153 | 153 | > EOF |
|
154 | 154 | |
|
155 | 155 | $ hg qapplied |
|
156 | 156 | first-patch |
|
157 | 157 | $ hg status -A file2 |
|
158 | 158 | ? file2 |
|
159 | 159 | $ rm file2 |
|
160 | 160 | $ hg qpush -q second-patch |
|
161 | 161 | now at: second-patch |
|
162 | 162 | |
|
163 | 163 | (test that editor is invoked and commit message is saved into |
|
164 | 164 | "last-message.txt") |
|
165 | 165 | |
|
166 | 166 | $ cat >> .hg/hgrc <<EOF |
|
167 | 167 | > [hooks] |
|
168 | 168 | > # this failure occurs after editor invocation |
|
169 | 169 | > pretxncommit.unexpectedabort = false |
|
170 | 170 | > EOF |
|
171 | 171 | |
|
172 | 172 | $ rm -f .hg/last-message.txt |
|
173 | 173 | $ hg status --rev "second-patch^1" -arm |
|
174 | 174 | A file2 |
|
175 | 175 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg qrefresh -e |
|
176 | 176 | ==== before editing |
|
177 | 177 | Fifth commit message |
|
178 | 178 | This is the 5th log message |
|
179 | 179 | |
|
180 | 180 | |
|
181 | 181 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
182 | 182 | HG: Leave message empty to use default message. |
|
183 | 183 | HG: -- |
|
184 | 184 | HG: user: test |
|
185 | 185 | HG: branch 'default' |
|
186 | 186 | HG: added file2 |
|
187 | 187 | ==== |
|
188 | 188 | note: commit message saved in .hg/last-message.txt |
|
189 | 189 | transaction abort! |
|
190 | 190 | rollback completed |
|
191 | 191 | qrefresh interrupted while patch was popped! (revert --all, qpush to recover) |
|
192 | 192 | abort: pretxncommit.unexpectedabort hook exited with status 1 |
|
193 | 193 | [255] |
|
194 | 194 | $ cat .hg/last-message.txt |
|
195 | 195 | Fifth commit message |
|
196 | 196 | This is the 5th log message |
|
197 | 197 | |
|
198 | 198 | |
|
199 | 199 | |
|
200 | 200 | test saving last-message.txt |
|
201 | 201 | |
|
202 | 202 | Test visibility of in-memory dirstate changes outside transaction to |
|
203 | 203 | external process |
|
204 | 204 | |
|
205 | 205 | $ cat > $TESTTMP/checkvisibility.sh <<EOF |
|
206 | 206 | > echo "====" |
|
207 | 207 | > hg parents --template "{rev}:{node|short}\n" |
|
208 | 208 | > hg status -arm |
|
209 | 209 | > echo "====" |
|
210 | 210 | > EOF |
|
211 | 211 | |
|
212 | 212 | == test visibility to external editor |
|
213 | 213 | |
|
214 | 214 | $ hg update -C -q first-patch |
|
215 | 215 | $ rm -f file2 |
|
216 | 216 | $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort= |
|
217 | 217 | now at: second-patch |
|
218 | 218 | $ echo bbbb >> file2 |
|
219 | 219 | |
|
220 | 220 | $ sh "$TESTTMP/checkvisibility.sh" |
|
221 | 221 | ==== |
|
222 | 222 | 1:e30108269082 |
|
223 | 223 | M file2 |
|
224 | 224 | ==== |
|
225 | 225 | |
|
226 | 226 | $ HGEDITOR="sh \"$TESTTMP/checkvisibility.sh\"" hg qrefresh -e |
|
227 | 227 | ==== |
|
228 | 228 | 0:25e397dabed2 |
|
229 | 229 | A file2 |
|
230 | 230 | ==== |
|
231 | 231 | note: commit message saved in .hg/last-message.txt |
|
232 | 232 | transaction abort! |
|
233 | 233 | rollback completed |
|
234 | 234 | qrefresh interrupted while patch was popped! (revert --all, qpush to recover) |
|
235 | 235 | abort: pretxncommit.unexpectedabort hook exited with status 1 |
|
236 | 236 | [255] |
|
237 | 237 | |
|
238 | 238 | (rebuilding at failure of qrefresh bases on rev #0, and it causes |
|
239 | 239 | dropping status of "file2") |
|
240 | 240 | |
|
241 | 241 | $ sh "$TESTTMP/checkvisibility.sh" |
|
242 | 242 | ==== |
|
243 | 243 | 0:25e397dabed2 |
|
244 | 244 | ==== |
|
245 | 245 | |
|
246 | 246 | == test visibility to precommit external hook |
|
247 | 247 | |
|
248 | 248 | $ hg update -C -q |
|
249 | 249 | $ rm -f file2 |
|
250 | 250 | $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort= |
|
251 | 251 | now at: second-patch |
|
252 | 252 | $ echo bbbb >> file2 |
|
253 | 253 | |
|
254 | 254 | $ cat >> .hg/hgrc <<EOF |
|
255 | 255 | > [hooks] |
|
256 | 256 | > precommit.checkvisibility = sh "$TESTTMP/checkvisibility.sh" |
|
257 | 257 | > EOF |
|
258 | 258 | |
|
259 | 259 | $ sh "$TESTTMP/checkvisibility.sh" |
|
260 | 260 | ==== |
|
261 | 261 | 1:e30108269082 |
|
262 | 262 | M file2 |
|
263 | 263 | ==== |
|
264 | 264 | |
|
265 | 265 | $ hg qrefresh |
|
266 | 266 | ==== |
|
267 | 267 | 0:25e397dabed2 |
|
268 | 268 | A file2 |
|
269 | 269 | ==== |
|
270 | 270 | transaction abort! |
|
271 | 271 | rollback completed |
|
272 | 272 | qrefresh interrupted while patch was popped! (revert --all, qpush to recover) |
|
273 | 273 | abort: pretxncommit.unexpectedabort hook exited with status 1 |
|
274 | 274 | [255] |
|
275 | 275 | |
|
276 | 276 | $ sh "$TESTTMP/checkvisibility.sh" |
|
277 | 277 | ==== |
|
278 | 278 | 0:25e397dabed2 |
|
279 | 279 | ==== |
|
280 | 280 | |
|
281 | 281 | $ cat >> .hg/hgrc <<EOF |
|
282 | 282 | > [hooks] |
|
283 | 283 | > precommit.checkvisibility = |
|
284 | 284 | > EOF |
|
285 | 285 | |
|
286 | 286 | == test visibility to pretxncommit external hook |
|
287 | 287 | |
|
288 | 288 | $ hg update -C -q |
|
289 | 289 | $ rm -f file2 |
|
290 | 290 | $ hg qpush -q second-patch --config hooks.pretxncommit.unexpectedabort= |
|
291 | 291 | now at: second-patch |
|
292 | 292 | $ echo bbbb >> file2 |
|
293 | 293 | |
|
294 | 294 | $ cat >> .hg/hgrc <<EOF |
|
295 | 295 | > [hooks] |
|
296 | 296 | > pretxncommit.checkvisibility = sh "$TESTTMP/checkvisibility.sh" |
|
297 | 297 | > # make checkvisibility run before unexpectedabort |
|
298 | 298 | > priority.pretxncommit.checkvisibility = 10 |
|
299 | 299 | > EOF |
|
300 | 300 | |
|
301 | 301 | $ sh "$TESTTMP/checkvisibility.sh" |
|
302 | 302 | ==== |
|
303 | 303 | 1:e30108269082 |
|
304 | 304 | M file2 |
|
305 | 305 | ==== |
|
306 | 306 | |
|
307 | 307 | $ hg qrefresh |
|
308 | 308 | ==== |
|
309 | 309 | 0:25e397dabed2 |
|
310 | 310 | A file2 |
|
311 | 311 | ==== |
|
312 | 312 | transaction abort! |
|
313 | 313 | rollback completed |
|
314 | 314 | qrefresh interrupted while patch was popped! (revert --all, qpush to recover) |
|
315 | 315 | abort: pretxncommit.unexpectedabort hook exited with status 1 |
|
316 | 316 | [255] |
|
317 | 317 | |
|
318 | 318 | $ sh "$TESTTMP/checkvisibility.sh" |
|
319 | 319 | ==== |
|
320 | 320 | 0:25e397dabed2 |
|
321 | 321 | ==== |
|
322 | 322 | |
|
323 | 323 | $ cat >> .hg/hgrc <<EOF |
|
324 | 324 | > [hooks] |
|
325 | 325 | > pretxncommit.checkvisibility = |
|
326 | 326 | > EOF |
General Comments 0
You need to be logged in to leave comments.
Login now