Show More
@@ -1,430 +1,430 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | echo "[extensions]" >> $HGRCPATH |
|
4 | 4 | echo "mq=" >> $HGRCPATH |
|
5 | 5 | |
|
6 | 6 | echo % help |
|
7 | 7 | hg help mq |
|
8 | 8 | |
|
9 | 9 | hg init a |
|
10 | 10 | cd a |
|
11 | 11 | echo a > a |
|
12 | 12 | hg ci -Ama |
|
13 | 13 | |
|
14 | 14 | hg clone . ../k |
|
15 | 15 | |
|
16 | 16 | mkdir b |
|
17 | 17 | echo z > b/z |
|
18 | 18 | hg ci -Ama |
|
19 | 19 | |
|
20 | 20 | echo % qinit |
|
21 | 21 | |
|
22 | 22 | hg qinit |
|
23 | 23 | |
|
24 | 24 | cd .. |
|
25 | 25 | hg init b |
|
26 | 26 | |
|
27 | 27 | echo % -R qinit |
|
28 | 28 | |
|
29 | 29 | hg -R b qinit |
|
30 | 30 | |
|
31 | 31 | hg init c |
|
32 | 32 | |
|
33 | 33 | echo % qinit -c |
|
34 | 34 | |
|
35 | 35 | hg --cwd c qinit -c |
|
36 | 36 | hg -R c/.hg/patches st |
|
37 | 37 | |
|
38 | 38 | echo % qnew implies add |
|
39 | 39 | |
|
40 | 40 | hg -R c qnew test.patch |
|
41 | 41 | hg -R c/.hg/patches st |
|
42 | 42 | |
|
43 | 43 | echo '% qinit; qinit -c' |
|
44 | 44 | hg init d |
|
45 | 45 | cd d |
|
46 | 46 | hg qinit |
|
47 | 47 | hg qinit -c |
|
48 | 48 | # qinit -c should create both files if they don't exist |
|
49 | 49 | echo ' .hgignore:' |
|
50 | 50 | cat .hg/patches/.hgignore |
|
51 | 51 | echo ' series:' |
|
52 | 52 | cat .hg/patches/series |
|
53 | 53 | hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/' |
|
54 | 54 | cd .. |
|
55 | 55 | |
|
56 | 56 | echo '% qinit; <stuff>; qinit -c' |
|
57 | 57 | hg init e |
|
58 | 58 | cd e |
|
59 | 59 | hg qnew A |
|
60 | 60 | echo foo > foo |
|
61 | 61 | hg add foo |
|
62 | 62 | hg qrefresh |
|
63 | 63 | hg qnew B |
|
64 | 64 | echo >> foo |
|
65 | 65 | hg qrefresh |
|
66 | 66 | echo status >> .hg/patches/.hgignore |
|
67 | 67 | echo bleh >> .hg/patches/.hgignore |
|
68 | 68 | hg qinit -c |
|
69 | 69 | hg -R .hg/patches status |
|
70 | 70 | # qinit -c shouldn't touch these files if they already exist |
|
71 | 71 | echo ' .hgignore:' |
|
72 | 72 | cat .hg/patches/.hgignore |
|
73 | 73 | echo ' series:' |
|
74 | 74 | cat .hg/patches/series |
|
75 | 75 | cd .. |
|
76 | 76 | |
|
77 | 77 | cd a |
|
78 | 78 | |
|
79 | 79 | echo % qnew -m |
|
80 | 80 | |
|
81 | 81 | hg qnew -m 'foo bar' test.patch |
|
82 | 82 | cat .hg/patches/test.patch |
|
83 | 83 | |
|
84 | 84 | echo % qrefresh |
|
85 | 85 | |
|
86 | 86 | echo a >> a |
|
87 | 87 | hg qrefresh |
|
88 | 88 | sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \ |
|
89 | 89 | -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
90 | 90 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch |
|
91 | 91 | |
|
92 | 92 | echo % empty qrefresh |
|
93 | 93 | |
|
94 | 94 | hg qrefresh -X a |
|
95 | 95 | echo 'revision:' |
|
96 | 96 | hg diff -r -2 -r -1 |
|
97 | 97 | echo 'patch:' |
|
98 | 98 | cat .hg/patches/test.patch |
|
99 | 99 | echo 'working dir diff:' |
|
100 | 100 | hg diff --nodates -q |
|
101 | 101 | # restore things |
|
102 | 102 | hg qrefresh |
|
103 | 103 | |
|
104 | 104 | echo % qpop |
|
105 | 105 | |
|
106 | 106 | hg qpop |
|
107 | 107 | |
|
108 | 108 | echo % qpush |
|
109 | 109 | |
|
110 | 110 | hg qpush |
|
111 | 111 | |
|
112 | 112 | cd .. |
|
113 | 113 | |
|
114 | 114 | echo % pop/push outside repo |
|
115 | 115 | |
|
116 | 116 | hg -R a qpop |
|
117 | 117 | hg -R a qpush |
|
118 | 118 | |
|
119 | 119 | cd a |
|
120 | 120 | hg qnew test2.patch |
|
121 | 121 | |
|
122 | 122 | echo % qrefresh in subdir |
|
123 | 123 | |
|
124 | 124 | cd b |
|
125 | 125 | echo a > a |
|
126 | 126 | hg add a |
|
127 | 127 | hg qrefresh |
|
128 | 128 | |
|
129 | 129 | echo % pop/push -a in subdir |
|
130 | 130 | |
|
131 | 131 | hg qpop -a |
|
132 | 132 | hg --traceback qpush -a |
|
133 | 133 | |
|
134 | 134 | echo % qseries |
|
135 | 135 | hg qseries |
|
136 | 136 | hg qpop |
|
137 | 137 | hg qseries -vs |
|
138 | 138 | hg qpush |
|
139 | 139 | |
|
140 | 140 | echo % qapplied |
|
141 | 141 | hg qapplied |
|
142 | 142 | |
|
143 | 143 | echo % qtop |
|
144 | 144 | hg qtop |
|
145 | 145 | |
|
146 | 146 | echo % qprev |
|
147 | 147 | hg qprev |
|
148 | 148 | |
|
149 | 149 | echo % qnext |
|
150 | 150 | hg qnext |
|
151 | 151 | |
|
152 | 152 | echo % pop, qnext, qprev, qapplied |
|
153 | 153 | hg qpop |
|
154 | 154 | hg qnext |
|
155 | 155 | hg qprev |
|
156 | 156 | hg qapplied |
|
157 | 157 | |
|
158 | 158 | echo % commit should fail |
|
159 | 159 | hg commit |
|
160 | 160 | |
|
161 | 161 | echo % push should fail |
|
162 | 162 | hg push ../../k |
|
163 | 163 | |
|
164 | 164 | echo % qunapplied |
|
165 | 165 | hg qunapplied |
|
166 | 166 | |
|
167 | 167 | echo % qpush/qpop with index |
|
168 | 168 | hg qnew test1b.patch |
|
169 | 169 | echo 1b > 1b |
|
170 | 170 | hg add 1b |
|
171 | 171 | hg qrefresh |
|
172 | 172 | hg qpush 2 |
|
173 | 173 | hg qpop 0 |
|
174 | 174 | hg qpush test.patch+1 |
|
175 | 175 | hg qpush test.patch+2 |
|
176 | 176 | hg qpop test2.patch-1 |
|
177 | 177 | hg qpop test2.patch-2 |
|
178 | 178 | hg qpush test1b.patch+1 |
|
179 | 179 | |
|
180 | 180 | echo % push should succeed |
|
181 | 181 | hg qpop -a |
|
182 | 182 | hg push ../../k |
|
183 | 183 | |
|
184 | 184 | echo % qpush/qpop error codes |
|
185 | 185 | errorcode() |
|
186 | 186 | { |
|
187 | 187 | hg "$@" && echo " $@ succeeds" || echo " $@ fails" |
|
188 | 188 | } |
|
189 | 189 | |
|
190 | 190 | # we want to start with some patches applied |
|
191 | 191 | hg qpush -a |
|
192 | 192 | echo " % pops all patches and succeeds" |
|
193 | 193 | errorcode qpop -a |
|
194 | 194 | echo " % does nothing and succeeds" |
|
195 | 195 | errorcode qpop -a |
|
196 | 196 | echo " % fails - nothing else to pop" |
|
197 | 197 | errorcode qpop |
|
198 | 198 | echo " % pushes a patch and succeeds" |
|
199 | 199 | errorcode qpush |
|
200 | 200 | echo " % pops a patch and succeeds" |
|
201 | 201 | errorcode qpop |
|
202 | 202 | echo " % pushes up to test1b.patch and succeeds" |
|
203 | 203 | errorcode qpush test1b.patch |
|
204 | 204 | echo " % does nothing and succeeds" |
|
205 | 205 | errorcode qpush test1b.patch |
|
206 | 206 | echo " % does nothing and succeeds" |
|
207 | 207 | errorcode qpop test1b.patch |
|
208 | 208 | echo " % fails - can't push to this patch" |
|
209 | 209 | errorcode qpush test.patch |
|
210 | 210 | echo " % fails - can't pop to this patch" |
|
211 | 211 | errorcode qpop test2.patch |
|
212 | 212 | echo " % pops up to test.patch and succeeds" |
|
213 | 213 | errorcode qpop test.patch |
|
214 | 214 | echo " % pushes all patches and succeeds" |
|
215 | 215 | errorcode qpush -a |
|
216 | 216 | echo " % does nothing and succeeds" |
|
217 | 217 | errorcode qpush -a |
|
218 | 218 | echo " % fails - nothing else to push" |
|
219 | 219 | errorcode qpush |
|
220 | 220 | echo " % does nothing and succeeds" |
|
221 | 221 | errorcode qpush test2.patch |
|
222 | 222 | |
|
223 | 223 | |
|
224 | 224 | echo % strip |
|
225 | 225 | cd ../../b |
|
226 | 226 | echo x>x |
|
227 | 227 | hg ci -Ama |
|
228 | 228 | hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
|
229 | 229 | hg unbundle .hg/strip-backup/* |
|
230 | 230 | |
|
231 | 231 | echo '% cd b; hg qrefresh' |
|
232 | 232 | hg init refresh |
|
233 | 233 | cd refresh |
|
234 | 234 | echo a > a |
|
235 | 235 | hg ci -Ama -d'0 0' |
|
236 | 236 | hg qnew -mfoo foo |
|
237 | 237 | echo a >> a |
|
238 | 238 | hg qrefresh |
|
239 | 239 | mkdir b |
|
240 | 240 | cd b |
|
241 | 241 | echo f > f |
|
242 | 242 | hg add f |
|
243 | 243 | hg qrefresh |
|
244 | 244 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
245 | 245 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo |
|
246 | 246 | echo % hg qrefresh . |
|
247 | 247 | hg qrefresh . |
|
248 | 248 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
249 | 249 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo |
|
250 | 250 | hg status |
|
251 | 251 | |
|
252 | 252 | echo % qpush failure |
|
253 | 253 | cd .. |
|
254 | 254 | hg qrefresh |
|
255 | 255 | hg qnew -mbar bar |
|
256 | 256 | echo foo > foo |
|
257 | 257 | echo bar > bar |
|
258 | 258 | hg add foo bar |
|
259 | 259 | hg qrefresh |
|
260 | 260 | hg qpop -a |
|
261 | 261 | echo bar > foo |
|
262 | 262 | hg qpush -a |
|
263 | 263 | hg st |
|
264 | 264 | |
|
265 | 265 | echo % mq tags |
|
266 | 266 | hg log --template '{rev} {tags}\n' -r qparent:qtip |
|
267 | 267 | |
|
268 | 268 | cat >>$HGRCPATH <<EOF |
|
269 | 269 | [diff] |
|
270 | 270 | git = True |
|
271 | 271 | EOF |
|
272 | 272 | cd .. |
|
273 | 273 | hg init git |
|
274 | 274 | cd git |
|
275 | 275 | hg qinit |
|
276 | 276 | |
|
277 | 277 | hg qnew -m'new file' new |
|
278 | 278 | echo foo > new |
|
279 | 279 | chmod +x new |
|
280 | 280 | hg add new |
|
281 | 281 | hg qrefresh |
|
282 | 282 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
283 | 283 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new |
|
284 | 284 | |
|
285 | 285 | hg qnew -m'copy file' copy |
|
286 | 286 | hg cp new copy |
|
287 | 287 | hg qrefresh |
|
288 | 288 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
289 | 289 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy |
|
290 | 290 | |
|
291 | 291 | hg qpop |
|
292 | 292 | hg qpush |
|
293 | 293 | hg qdiff |
|
294 | 294 | cat >>$HGRCPATH <<EOF |
|
295 | 295 | [diff] |
|
296 | 296 | git = False |
|
297 | 297 | EOF |
|
298 | 298 | hg qdiff --git |
|
299 | 299 | |
|
300 | 300 | cd .. |
|
301 | 301 | hg init slow |
|
302 | 302 | cd slow |
|
303 | 303 | hg qinit |
|
304 | 304 | echo foo > foo |
|
305 | 305 | hg add foo |
|
306 | 306 | hg ci -m 'add foo' |
|
307 | 307 | hg qnew bar |
|
308 | 308 | echo bar > bar |
|
309 | 309 | hg add bar |
|
310 | 310 | hg mv foo baz |
|
311 | 311 | hg qrefresh --git |
|
312 | 312 | hg up -C 0 |
|
313 | 313 | echo >> foo |
|
314 | 314 | hg ci -m 'change foo' |
|
315 | 315 | hg up -C 1 |
|
316 | 316 | hg qrefresh --git 2>&1 | grep -v 'saving bundle' |
|
317 | 317 | cat .hg/patches/bar |
|
318 | 318 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
319 | 319 | hg qrefresh --git |
|
320 | 320 | cat .hg/patches/bar |
|
321 | 321 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
322 | 322 | hg qrefresh |
|
323 | 323 | grep 'diff --git' .hg/patches/bar |
|
324 | 324 | |
|
325 | 325 | echo |
|
326 | 326 | hg up -C 1 |
|
327 | 327 | echo >> foo |
|
328 | 328 | hg ci -m 'change foo again' |
|
329 | 329 | hg up -C 2 |
|
330 | 330 | hg mv bar quux |
|
331 | 331 | hg mv baz bleh |
|
332 | 332 | hg qrefresh --git 2>&1 | grep -v 'saving bundle' |
|
333 | 333 | cat .hg/patches/bar |
|
334 | 334 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
335 | 335 | hg mv quux fred |
|
336 | 336 | hg mv bleh barney |
|
337 | 337 | hg qrefresh --git |
|
338 | 338 | cat .hg/patches/bar |
|
339 | 339 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
340 | 340 | |
|
341 | 341 | echo % create a git patch |
|
342 | 342 | echo a > alexander |
|
343 | 343 | hg add alexander |
|
344 | 344 | hg qnew -f --git addalexander |
|
345 |
|
|
|
345 | grep diff .hg/patches/addalexander | |
|
346 | 346 | |
|
347 | 347 | echo % create a git binary patch |
|
348 | 348 | cat > writebin.py <<EOF |
|
349 | 349 | import sys |
|
350 | 350 | path = sys.argv[1] |
|
351 | 351 | open(path, 'wb').write('BIN\x00ARY') |
|
352 | 352 | EOF |
|
353 | 353 | python writebin.py bucephalus |
|
354 | 354 | |
|
355 | 355 | python "$TESTDIR/md5sum.py" bucephalus |
|
356 | 356 | hg add bucephalus |
|
357 | 357 | hg qnew -f --git addbucephalus |
|
358 |
|
|
|
358 | grep diff .hg/patches/addbucephalus | |
|
359 | 359 | |
|
360 | 360 | echo % check binary patches can be popped and pushed |
|
361 | 361 | hg qpop |
|
362 |
|
|
|
362 | test -f bucephalus && echo % bucephalus should not be there | |
|
363 | 363 | hg qpush |
|
364 | 364 | test -f bucephalus || echo % bucephalus should be there |
|
365 | 365 | python "$TESTDIR/md5sum.py" bucephalus |
|
366 | 366 | |
|
367 | 367 | |
|
368 | 368 | echo '% strip again' |
|
369 | 369 | cd .. |
|
370 | 370 | hg init strip |
|
371 | 371 | cd strip |
|
372 | 372 | touch foo |
|
373 | 373 | hg add foo |
|
374 | 374 | hg ci -m 'add foo' -d '0 0' |
|
375 | 375 | echo >> foo |
|
376 | 376 | hg ci -m 'change foo 1' -d '0 0' |
|
377 | 377 | hg up -C 0 |
|
378 | 378 | echo 1 >> foo |
|
379 | 379 | hg ci -m 'change foo 2' -d '0 0' |
|
380 | 380 | HGMERGE=true hg merge |
|
381 | 381 | hg ci -m merge -d '0 0' |
|
382 | 382 | hg log |
|
383 | 383 | hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
|
384 | 384 | hg log |
|
385 | 385 | cd .. |
|
386 | 386 | |
|
387 | 387 | echo '% qclone' |
|
388 | 388 | qlog() |
|
389 | 389 | { |
|
390 | 390 | echo 'main repo:' |
|
391 | 391 | hg log --template ' rev {rev}: {desc}\n' |
|
392 | 392 | echo 'patch repo:' |
|
393 | 393 | hg -R .hg/patches log --template ' rev {rev}: {desc}\n' |
|
394 | 394 | } |
|
395 | 395 | hg init qclonesource |
|
396 | 396 | cd qclonesource |
|
397 | 397 | echo foo > foo |
|
398 | 398 | hg add foo |
|
399 | 399 | hg ci -m 'add foo' |
|
400 | 400 | hg qinit |
|
401 | 401 | hg qnew patch1 |
|
402 | 402 | echo bar >> foo |
|
403 | 403 | hg qrefresh -m 'change foo' |
|
404 | 404 | cd .. |
|
405 | 405 | |
|
406 | 406 | # repo with unversioned patch dir |
|
407 | 407 | hg qclone qclonesource failure |
|
408 | 408 | |
|
409 | 409 | cd qclonesource |
|
410 | 410 | hg qinit -c |
|
411 | 411 | hg qci -m checkpoint |
|
412 | 412 | qlog |
|
413 | 413 | cd .. |
|
414 | 414 | |
|
415 | 415 | # repo with patches applied |
|
416 | 416 | hg qclone qclonesource qclonedest |
|
417 | 417 | cd qclonedest |
|
418 | 418 | qlog |
|
419 | 419 | cd .. |
|
420 | 420 | |
|
421 | 421 | # repo with patches unapplied |
|
422 | 422 | cd qclonesource |
|
423 | 423 | hg qpop -a |
|
424 | 424 | qlog |
|
425 | 425 | cd .. |
|
426 | 426 | hg qclone qclonesource qclonedest2 |
|
427 | 427 | cd qclonedest2 |
|
428 | 428 | qlog |
|
429 | 429 | cd .. |
|
430 | 430 |
General Comments 0
You need to be logged in to leave comments.
Login now