|
1 $ . $TESTDIR/helpers.sh |
|
2 |
|
3 $ checkundo() |
|
4 > { |
|
5 > if [ -f .hg/store/undo ]; then |
|
6 > echo ".hg/store/undo still exists after $1" |
|
7 > fi |
|
8 > } |
|
9 |
|
10 $ echo "[extensions]" >> $HGRCPATH |
|
11 $ echo "mq=" >> $HGRCPATH |
|
12 |
|
13 $ echo "[mq]" >> $HGRCPATH |
|
14 $ echo "plain=true" >> $HGRCPATH |
|
15 |
|
16 |
|
17 help |
|
18 |
|
19 $ hg help mq |
|
20 mq extension - manage a stack of patches |
|
21 |
|
22 This extension lets you work with a stack of patches in a Mercurial |
|
23 repository. It manages two stacks of patches - all known patches, and applied |
|
24 patches (subset of known patches). |
|
25 |
|
26 Known patches are represented as patch files in the .hg/patches directory. |
|
27 Applied patches are both patch files and changesets. |
|
28 |
|
29 Common tasks (use "hg help command" for more details): |
|
30 |
|
31 create new patch qnew |
|
32 import existing patch qimport |
|
33 |
|
34 print patch series qseries |
|
35 print applied patches qapplied |
|
36 |
|
37 add known patch to applied stack qpush |
|
38 remove patch from applied stack qpop |
|
39 refresh contents of top applied patch qrefresh |
|
40 |
|
41 By default, mq will automatically use git patches when required to avoid |
|
42 losing file mode changes, copy records, binary files or empty files creations |
|
43 or deletions. This behaviour can be configured with: |
|
44 |
|
45 [mq] |
|
46 git = auto/keep/yes/no |
|
47 |
|
48 If set to 'keep', mq will obey the [diff] section configuration while |
|
49 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq |
|
50 will override the [diff] section and always generate git or regular patches, |
|
51 possibly losing data in the second case. |
|
52 |
|
53 You will by default be managing a patch queue named "patches". You can create |
|
54 other, independent patch queues with the "hg qqueue" command. |
|
55 |
|
56 list of commands: |
|
57 |
|
58 qapplied print the patches already applied |
|
59 qclone clone main and patch repository at same time |
|
60 qdelete remove patches from queue |
|
61 qdiff diff of the current patch and subsequent modifications |
|
62 qfinish move applied patches into repository history |
|
63 qfold fold the named patches into the current patch |
|
64 qgoto push or pop patches until named patch is at top of stack |
|
65 qguard set or print guards for a patch |
|
66 qheader print the header of the topmost or specified patch |
|
67 qimport import a patch |
|
68 qnew create a new patch |
|
69 qnext print the name of the next patch |
|
70 qpop pop the current patch off the stack |
|
71 qprev print the name of the previous patch |
|
72 qpush push the next patch onto the stack |
|
73 qqueue manage multiple patch queues |
|
74 qrefresh update the current patch |
|
75 qrename rename a patch |
|
76 qselect set or print guarded patches to push |
|
77 qseries print the entire series file |
|
78 qtop print the name of the current patch |
|
79 qunapplied print the patches not yet applied |
|
80 strip strip changesets and all their descendants from the repository |
|
81 |
|
82 use "hg -v help mq" to show aliases and global options |
|
83 |
|
84 $ hg init a |
|
85 $ cd a |
|
86 $ echo a > a |
|
87 $ hg ci -Ama |
|
88 adding a |
|
89 |
|
90 $ hg clone . ../k |
|
91 updating to branch default |
|
92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
93 |
|
94 $ mkdir b |
|
95 $ echo z > b/z |
|
96 $ hg ci -Ama |
|
97 adding b/z |
|
98 |
|
99 |
|
100 qinit |
|
101 |
|
102 $ hg qinit |
|
103 |
|
104 $ cd .. |
|
105 $ hg init b |
|
106 |
|
107 |
|
108 -R qinit |
|
109 |
|
110 $ hg -R b qinit |
|
111 |
|
112 $ hg init c |
|
113 |
|
114 |
|
115 qinit -c |
|
116 |
|
117 $ hg --cwd c qinit -c |
|
118 $ hg -R c/.hg/patches st |
|
119 A .hgignore |
|
120 A series |
|
121 |
|
122 |
|
123 qinit; qinit -c |
|
124 |
|
125 $ hg init d |
|
126 $ cd d |
|
127 $ hg qinit |
|
128 $ hg qinit -c |
|
129 |
|
130 qinit -c should create both files if they don't exist |
|
131 |
|
132 $ cat .hg/patches/.hgignore |
|
133 ^\.hg |
|
134 ^\.mq |
|
135 syntax: glob |
|
136 status |
|
137 guards |
|
138 $ cat .hg/patches/series |
|
139 $ hg qinit -c |
|
140 abort: repository .* already exists! |
|
141 $ cd .. |
|
142 |
|
143 $ echo '% qinit; <stuff>; qinit -c' |
|
144 % qinit; <stuff>; qinit -c |
|
145 $ hg init e |
|
146 $ cd e |
|
147 $ hg qnew A |
|
148 $ checkundo qnew |
|
149 $ echo foo > foo |
|
150 $ hg add foo |
|
151 $ hg qrefresh |
|
152 $ hg qnew B |
|
153 $ echo >> foo |
|
154 $ hg qrefresh |
|
155 $ echo status >> .hg/patches/.hgignore |
|
156 $ echo bleh >> .hg/patches/.hgignore |
|
157 $ hg qinit -c |
|
158 adding .hg/patches/A |
|
159 adding .hg/patches/B |
|
160 $ hg -R .hg/patches status |
|
161 A .hgignore |
|
162 A A |
|
163 A B |
|
164 A series |
|
165 |
|
166 qinit -c shouldn't touch these files if they already exist |
|
167 |
|
168 $ cat .hg/patches/.hgignore |
|
169 status |
|
170 bleh |
|
171 $ cat .hg/patches/series |
|
172 A |
|
173 B |
|
174 |
|
175 status --mq with color (issue2096) |
|
176 |
|
177 $ hg status --mq --config extensions.color= --color=always |
|
178 [0;32;1mA .hgignore[0m |
|
179 [0;32;1mA A[0m |
|
180 [0;32;1mA B[0m |
|
181 [0;32;1mA series[0m |
|
182 $ cd .. |
|
183 |
|
184 |
|
185 init --mq without repo |
|
186 |
|
187 $ mkdir f |
|
188 $ cd f |
|
189 $ hg init --mq |
|
190 abort: There is no Mercurial repository here (.hg not found) |
|
191 $ cd .. |
|
192 |
|
193 init --mq with repo path |
|
194 |
|
195 $ hg init g |
|
196 $ hg init --mq g |
|
197 $ test -d g/.hg/patches/.hg && echo "ok" || echo "failed" |
|
198 ok |
|
199 |
|
200 init --mq with nonexistent directory |
|
201 |
|
202 $ hg init --mq nonexistentdir |
|
203 abort: repository nonexistentdir not found! |
|
204 |
|
205 |
|
206 init --mq with bundle (non "local") |
|
207 |
|
208 $ hg -R a bundle --all a.bundle >/dev/null |
|
209 $ hg init --mq a.bundle |
|
210 abort: only a local queue repository may be initialized |
|
211 |
|
212 $ cd a |
|
213 |
|
214 $ hg qnew -m 'foo bar' test.patch |
|
215 |
|
216 $ echo '# comment' > .hg/patches/series.tmp |
|
217 $ echo >> .hg/patches/series.tmp # empty line |
|
218 $ cat .hg/patches/series >> .hg/patches/series.tmp |
|
219 $ mv .hg/patches/series.tmp .hg/patches/series |
|
220 |
|
221 |
|
222 qrefresh |
|
223 |
|
224 $ echo a >> a |
|
225 $ hg qrefresh |
|
226 $ cat .hg/patches/test.patch |
|
227 foo bar |
|
228 |
|
229 diff -r [a-f0-9]* a |
|
230 --- a/a\t(?P<date>.*) |
|
231 \+\+\+ b/a\t(?P<date2>.*) |
|
232 @@ -1,1 +1,2 @@ |
|
233 a |
|
234 +a |
|
235 |
|
236 empty qrefresh |
|
237 |
|
238 $ hg qrefresh -X a |
|
239 |
|
240 revision: |
|
241 |
|
242 $ hg diff -r -2 -r -1 |
|
243 |
|
244 patch: |
|
245 |
|
246 $ cat .hg/patches/test.patch |
|
247 foo bar |
|
248 |
|
249 |
|
250 working dir diff: |
|
251 |
|
252 $ hg diff --nodates -q |
|
253 --- a/a |
|
254 +++ b/a |
|
255 @@ -1,1 +1,2 @@ |
|
256 a |
|
257 +a |
|
258 |
|
259 restore things |
|
260 |
|
261 $ hg qrefresh |
|
262 $ checkundo qrefresh |
|
263 |
|
264 |
|
265 qpop |
|
266 |
|
267 $ hg qpop |
|
268 popping test.patch |
|
269 patch queue now empty |
|
270 $ checkundo qpop |
|
271 |
|
272 |
|
273 qpush with dump of tag cache |
|
274 Dump the tag cache to ensure that it has exactly one head after qpush. |
|
275 |
|
276 $ rm -f .hg/tags.cache |
|
277 $ hg tags > /dev/null |
|
278 |
|
279 .hg/tags.cache (pre qpush): |
|
280 |
|
281 $ cat .hg/tags.cache |
|
282 1 [\da-f]{40} |
|
283 |
|
284 $ hg qpush |
|
285 applying test.patch |
|
286 now at: test.patch |
|
287 $ hg tags > /dev/null |
|
288 |
|
289 .hg/tags.cache (post qpush): |
|
290 |
|
291 $ cat .hg/tags.cache |
|
292 2 [\da-f]{40} |
|
293 |
|
294 $ checkundo qpush |
|
295 $ cd .. |
|
296 |
|
297 |
|
298 pop/push outside repo |
|
299 $ hg -R a qpop |
|
300 popping test.patch |
|
301 patch queue now empty |
|
302 $ hg -R a qpush |
|
303 applying test.patch |
|
304 now at: test.patch |
|
305 |
|
306 $ cd a |
|
307 $ hg qnew test2.patch |
|
308 |
|
309 qrefresh in subdir |
|
310 |
|
311 $ cd b |
|
312 $ echo a > a |
|
313 $ hg add a |
|
314 $ hg qrefresh |
|
315 |
|
316 pop/push -a in subdir |
|
317 |
|
318 $ hg qpop -a |
|
319 popping test2.patch |
|
320 popping test.patch |
|
321 patch queue now empty |
|
322 $ hg --traceback qpush -a |
|
323 applying test.patch |
|
324 applying test2.patch |
|
325 now at: test2.patch |
|
326 |
|
327 |
|
328 setting columns & formatted tests truncating (issue1912) |
|
329 |
|
330 $ COLUMNS=4 hg qseries --config ui.formatted=true |
|
331 test.patch |
|
332 test2.patch |
|
333 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs |
|
334 0 A test.patch: f... |
|
335 1 A test2.patch: |
|
336 $ hg qpop |
|
337 popping test2.patch |
|
338 now at: test.patch |
|
339 $ hg qseries -vs |
|
340 0 A test.patch: foo bar |
|
341 1 U test2.patch: |
|
342 $ hg sum | grep mq |
|
343 mq: 1 applied, 1 unapplied |
|
344 $ hg qpush |
|
345 applying test2.patch |
|
346 now at: test2.patch |
|
347 $ hg sum | grep mq |
|
348 mq: 2 applied |
|
349 $ hg qapplied |
|
350 test.patch |
|
351 test2.patch |
|
352 $ hg qtop |
|
353 test2.patch |
|
354 |
|
355 |
|
356 prev |
|
357 |
|
358 $ hg qapp -1 |
|
359 test.patch |
|
360 |
|
361 next |
|
362 |
|
363 $ hg qunapp -1 |
|
364 all patches applied |
|
365 |
|
366 $ hg qpop |
|
367 popping test2.patch |
|
368 now at: test.patch |
|
369 |
|
370 commit should fail |
|
371 |
|
372 $ hg commit |
|
373 abort: cannot commit over an applied mq patch |
|
374 |
|
375 push should fail |
|
376 |
|
377 $ hg push ../../k |
|
378 pushing to ../../k |
|
379 abort: source has mq patches applied |
|
380 |
|
381 |
|
382 import should fail |
|
383 |
|
384 $ hg st . |
|
385 $ echo foo >> ../a |
|
386 $ hg diff > ../../import.diff |
|
387 $ hg revert --no-backup ../a |
|
388 $ hg import ../../import.diff |
|
389 abort: cannot import over an applied patch |
|
390 $ hg st |
|
391 |
|
392 import --no-commit should succeed |
|
393 |
|
394 $ hg import --no-commit ../../import.diff |
|
395 applying ../../import.diff |
|
396 $ hg st |
|
397 M a |
|
398 $ hg revert --no-backup ../a |
|
399 |
|
400 |
|
401 qunapplied |
|
402 |
|
403 $ hg qunapplied |
|
404 test2.patch |
|
405 |
|
406 |
|
407 qpush/qpop with index |
|
408 |
|
409 $ hg qnew test1b.patch |
|
410 $ echo 1b > 1b |
|
411 $ hg add 1b |
|
412 $ hg qrefresh |
|
413 $ hg qpush 2 |
|
414 applying test2.patch |
|
415 now at: test2.patch |
|
416 $ hg qpop 0 |
|
417 popping test2.patch |
|
418 popping test1b.patch |
|
419 now at: test.patch |
|
420 $ hg qpush test.patch+1 |
|
421 applying test1b.patch |
|
422 now at: test1b.patch |
|
423 $ hg qpush test.patch+2 |
|
424 applying test2.patch |
|
425 now at: test2.patch |
|
426 $ hg qpop test2.patch-1 |
|
427 popping test2.patch |
|
428 now at: test1b.patch |
|
429 $ hg qpop test2.patch-2 |
|
430 popping test1b.patch |
|
431 now at: test.patch |
|
432 $ hg qpush test1b.patch+1 |
|
433 applying test1b.patch |
|
434 applying test2.patch |
|
435 now at: test2.patch |
|
436 |
|
437 |
|
438 qpush --move |
|
439 |
|
440 $ hg qpop -a |
|
441 popping test2.patch |
|
442 popping test1b.patch |
|
443 popping test.patch |
|
444 patch queue now empty |
|
445 $ hg qguard test1b.patch -- -negguard |
|
446 $ hg qguard test2.patch -- +posguard |
|
447 $ hg qpush --move test2.patch # can't move guarded patch |
|
448 cannot push 'test2.patch' - guarded by ['+posguard'] |
|
449 $ hg qselect posguard |
|
450 number of unguarded, unapplied patches has changed from 2 to 3 |
|
451 $ hg qpush --move test2.patch # move to front |
|
452 applying test2.patch |
|
453 now at: test2.patch |
|
454 $ hg qpush --move test1b.patch # negative guard unselected |
|
455 applying test1b.patch |
|
456 now at: test1b.patch |
|
457 $ hg qpush --move test.patch # noop move |
|
458 applying test.patch |
|
459 now at: test.patch |
|
460 $ hg qseries -v |
|
461 0 A test2.patch |
|
462 1 A test1b.patch |
|
463 2 A test.patch |
|
464 $ hg qpop -a |
|
465 popping test.patch |
|
466 popping test1b.patch |
|
467 popping test2.patch |
|
468 patch queue now empty |
|
469 |
|
470 cleaning up |
|
471 |
|
472 $ hg qselect --none |
|
473 guards deactivated |
|
474 number of unguarded, unapplied patches has changed from 3 to 2 |
|
475 $ hg qguard --none test1b.patch |
|
476 $ hg qguard --none test2.patch |
|
477 $ hg qpush --move test.patch |
|
478 applying test.patch |
|
479 now at: test.patch |
|
480 $ hg qpush --move test1b.patch |
|
481 applying test1b.patch |
|
482 now at: test1b.patch |
|
483 $ hg qpush --move bogus # nonexistent patch |
|
484 abort: patch bogus not in series |
|
485 $ hg qpush --move # no patch |
|
486 abort: please specify the patch to move |
|
487 $ hg qpush --move test.patch # already applied |
|
488 abort: cannot push to a previous patch: test.patch |
|
489 $ hg qpush |
|
490 applying test2.patch |
|
491 now at: test2.patch |
|
492 |
|
493 |
|
494 series after move |
|
495 |
|
496 $ cat `hg root`/.hg/patches/series |
|
497 test.patch |
|
498 test1b.patch |
|
499 test2.patch |
|
500 # comment |
|
501 |
|
502 |
|
503 |
|
504 pop, qapplied, qunapplied |
|
505 |
|
506 $ hg qseries -v |
|
507 0 A test.patch |
|
508 1 A test1b.patch |
|
509 2 A test2.patch |
|
510 |
|
511 qapplied -1 test.patch |
|
512 |
|
513 $ hg qapplied -1 test.patch |
|
514 only one patch applied |
|
515 |
|
516 qapplied -1 test1b.patch |
|
517 |
|
518 $ hg qapplied -1 test1b.patch |
|
519 test.patch |
|
520 |
|
521 qapplied -1 test2.patch |
|
522 |
|
523 $ hg qapplied -1 test2.patch |
|
524 test1b.patch |
|
525 |
|
526 qapplied -1 |
|
527 |
|
528 $ hg qapplied -1 |
|
529 test1b.patch |
|
530 |
|
531 qapplied |
|
532 |
|
533 $ hg qapplied |
|
534 test.patch |
|
535 test1b.patch |
|
536 test2.patch |
|
537 |
|
538 qapplied test1b.patch |
|
539 |
|
540 $ hg qapplied test1b.patch |
|
541 test.patch |
|
542 test1b.patch |
|
543 |
|
544 qunapplied -1 |
|
545 |
|
546 $ hg qunapplied -1 |
|
547 all patches applied |
|
548 |
|
549 qunapplied |
|
550 |
|
551 $ hg qunapplied |
|
552 |
|
553 popping |
|
554 |
|
555 $ hg qpop |
|
556 popping test2.patch |
|
557 now at: test1b.patch |
|
558 |
|
559 qunapplied -1 |
|
560 |
|
561 $ hg qunapplied -1 |
|
562 test2.patch |
|
563 |
|
564 qunapplied |
|
565 |
|
566 $ hg qunapplied |
|
567 test2.patch |
|
568 |
|
569 qunapplied test2.patch |
|
570 |
|
571 $ hg qunapplied test2.patch |
|
572 |
|
573 qunapplied -1 test2.patch |
|
574 |
|
575 $ hg qunapplied -1 test2.patch |
|
576 all patches applied |
|
577 |
|
578 popping -a |
|
579 |
|
580 $ hg qpop -a |
|
581 popping test1b.patch |
|
582 popping test.patch |
|
583 patch queue now empty |
|
584 |
|
585 qapplied |
|
586 |
|
587 $ hg qapplied |
|
588 |
|
589 qapplied -1 |
|
590 |
|
591 $ hg qapplied -1 |
|
592 no patches applied |
|
593 $ hg qpush |
|
594 applying test.patch |
|
595 now at: test.patch |
|
596 |
|
597 |
|
598 push should succeed |
|
599 |
|
600 $ hg qpop -a |
|
601 popping test.patch |
|
602 patch queue now empty |
|
603 $ hg push ../../k |
|
604 pushing to ../../k |
|
605 searching for changes |
|
606 adding changesets |
|
607 adding manifests |
|
608 adding file changes |
|
609 added 1 changesets with 1 changes to 1 files |
|
610 |
|
611 |
|
612 qpush/qpop error codes |
|
613 |
|
614 $ errorcode() |
|
615 > { |
|
616 > hg "$@" && echo " $@ succeeds" || echo " $@ fails" |
|
617 > } |
|
618 |
|
619 |
|
620 we want to start with some patches applied |
|
621 |
|
622 $ hg qpush -a |
|
623 applying test.patch |
|
624 applying test1b.patch |
|
625 applying test2.patch |
|
626 now at: test2.patch |
|
627 |
|
628 % pops all patches and succeeds |
|
629 |
|
630 $ errorcode qpop -a |
|
631 popping test2.patch |
|
632 popping test1b.patch |
|
633 popping test.patch |
|
634 patch queue now empty |
|
635 qpop -a succeeds |
|
636 |
|
637 % does nothing and succeeds |
|
638 |
|
639 $ errorcode qpop -a |
|
640 no patches applied |
|
641 qpop -a succeeds |
|
642 |
|
643 % fails - nothing else to pop |
|
644 |
|
645 $ errorcode qpop |
|
646 no patches applied |
|
647 qpop fails |
|
648 |
|
649 % pushes a patch and succeeds |
|
650 |
|
651 $ errorcode qpush |
|
652 applying test.patch |
|
653 now at: test.patch |
|
654 qpush succeeds |
|
655 |
|
656 % pops a patch and succeeds |
|
657 |
|
658 $ errorcode qpop |
|
659 popping test.patch |
|
660 patch queue now empty |
|
661 qpop succeeds |
|
662 |
|
663 % pushes up to test1b.patch and succeeds |
|
664 |
|
665 $ errorcode qpush test1b.patch |
|
666 applying test.patch |
|
667 applying test1b.patch |
|
668 now at: test1b.patch |
|
669 qpush test1b.patch succeeds |
|
670 |
|
671 % does nothing and succeeds |
|
672 |
|
673 $ errorcode qpush test1b.patch |
|
674 qpush: test1b.patch is already at the top |
|
675 qpush test1b.patch succeeds |
|
676 |
|
677 % does nothing and succeeds |
|
678 |
|
679 $ errorcode qpop test1b.patch |
|
680 qpop: test1b.patch is already at the top |
|
681 qpop test1b.patch succeeds |
|
682 |
|
683 % fails - can't push to this patch |
|
684 |
|
685 $ errorcode qpush test.patch |
|
686 abort: cannot push to a previous patch: test.patch |
|
687 qpush test.patch fails |
|
688 |
|
689 % fails - can't pop to this patch |
|
690 |
|
691 $ errorcode qpop test2.patch |
|
692 abort: patch test2.patch is not applied |
|
693 qpop test2.patch fails |
|
694 |
|
695 % pops up to test.patch and succeeds |
|
696 |
|
697 $ errorcode qpop test.patch |
|
698 popping test1b.patch |
|
699 now at: test.patch |
|
700 qpop test.patch succeeds |
|
701 |
|
702 % pushes all patches and succeeds |
|
703 |
|
704 $ errorcode qpush -a |
|
705 applying test1b.patch |
|
706 applying test2.patch |
|
707 now at: test2.patch |
|
708 qpush -a succeeds |
|
709 |
|
710 % does nothing and succeeds |
|
711 |
|
712 $ errorcode qpush -a |
|
713 all patches are currently applied |
|
714 qpush -a succeeds |
|
715 |
|
716 % fails - nothing else to push |
|
717 |
|
718 $ errorcode qpush |
|
719 patch series already fully applied |
|
720 qpush fails |
|
721 |
|
722 % does nothing and succeeds |
|
723 |
|
724 $ errorcode qpush test2.patch |
|
725 qpush: test2.patch is already at the top |
|
726 qpush test2.patch succeeds |
|
727 |
|
728 |
|
729 |
|
730 strip |
|
731 |
|
732 $ cd ../../b |
|
733 $ echo x>x |
|
734 $ hg ci -Ama |
|
735 adding x |
|
736 $ hg strip tip | hidebackup |
|
737 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
738 saved backup bundle to |
|
739 $ hg unbundle .hg/strip-backup/* |
|
740 adding changesets |
|
741 adding manifests |
|
742 adding file changes |
|
743 added 1 changesets with 1 changes to 1 files |
|
744 (run 'hg update' to get a working copy) |
|
745 |
|
746 |
|
747 strip with local changes, should complain |
|
748 |
|
749 $ hg up |
|
750 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
751 $ echo y>y |
|
752 $ hg add y |
|
753 $ hg strip tip | hidebackup |
|
754 abort: local changes found |
|
755 |
|
756 --force strip with local changes |
|
757 |
|
758 $ hg strip -f tip | hidebackup |
|
759 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
760 saved backup bundle to |
|
761 |
|
762 |
|
763 cd b; hg qrefresh |
|
764 |
|
765 $ hg init refresh |
|
766 $ cd refresh |
|
767 $ echo a > a |
|
768 $ hg ci -Ama |
|
769 adding a |
|
770 $ hg qnew -mfoo foo |
|
771 $ echo a >> a |
|
772 $ hg qrefresh |
|
773 $ mkdir b |
|
774 $ cd b |
|
775 $ echo f > f |
|
776 $ hg add f |
|
777 $ hg qrefresh |
|
778 $ cat ../.hg/patches/foo |
|
779 foo |
|
780 |
|
781 diff -r cb9a9f314b8b a |
|
782 --- a/a\t(?P<date>.*) |
|
783 \+\+\+ b/a\t(?P<date>.*) |
|
784 @@ -1,1 +1,2 @@ |
|
785 a |
|
786 +a |
|
787 diff -r cb9a9f314b8b b/f |
|
788 --- /dev/null\t(?P<date>.*) |
|
789 \+\+\+ b/b/f\t(?P<date>.*) |
|
790 @@ -0,0 +1,1 @@ |
|
791 +f |
|
792 |
|
793 hg qrefresh . |
|
794 |
|
795 $ hg qrefresh . |
|
796 $ cat ../.hg/patches/foo |
|
797 foo |
|
798 |
|
799 diff -r cb9a9f314b8b b/f |
|
800 --- /dev/null\t(?P<date>.*) |
|
801 \+\+\+ b/b/f\t(?P<date>.*) |
|
802 @@ -0,0 +1,1 @@ |
|
803 +f |
|
804 $ hg status |
|
805 M a |
|
806 |
|
807 |
|
808 qpush failure |
|
809 |
|
810 $ cd .. |
|
811 $ hg qrefresh |
|
812 $ hg qnew -mbar bar |
|
813 $ echo foo > foo |
|
814 $ echo bar > bar |
|
815 $ hg add foo bar |
|
816 $ hg qrefresh |
|
817 $ hg qpop -a |
|
818 popping bar |
|
819 popping foo |
|
820 patch queue now empty |
|
821 $ echo bar > foo |
|
822 $ hg qpush -a |
|
823 applying foo |
|
824 applying bar |
|
825 file foo already exists |
|
826 1 out of 1 hunks FAILED -- saving rejects to file foo.rej |
|
827 patch failed, unable to continue (try -v) |
|
828 patch failed, rejects left in working dir |
|
829 errors during apply, please fix and refresh bar |
|
830 $ hg st |
|
831 ? foo |
|
832 ? foo.rej |
|
833 |
|
834 |
|
835 mq tags |
|
836 |
|
837 $ hg log --template '{rev} {tags}\n' -r qparent:qtip |
|
838 0 qparent |
|
839 1 foo qbase |
|
840 2 bar qtip tip |
|
841 |
|
842 |
|
843 bad node in status |
|
844 |
|
845 $ hg qpop |
|
846 popping bar |
|
847 now at: foo |
|
848 $ hg strip -qn tip |
|
849 $ hg tip |
|
850 changeset: 0:cb9a9f314b8b |
|
851 tag: tip |
|
852 user: test |
|
853 date: Thu Jan 01 00:00:00 1970 +0000 |
|
854 summary: a |
|
855 |
|
856 $ hg branches |
|
857 default 0:cb9a9f314b8b |
|
858 $ hg qpop |
|
859 no patches applied |
|
860 |
|
861 $ cat >>$HGRCPATH <<EOF |
|
862 > [diff] |
|
863 > git = True |
|
864 > EOF |
|
865 $ cd .. |
|
866 $ hg init git |
|
867 $ cd git |
|
868 $ hg qinit |
|
869 |
|
870 $ hg qnew -m'new file' new |
|
871 $ echo foo > new |
|
872 $ chmod +x new |
|
873 $ hg add new |
|
874 $ hg qrefresh |
|
875 $ cat .hg/patches/new |
|
876 new file |
|
877 |
|
878 diff --git a/new b/new |
|
879 new file mode 100755 |
|
880 --- /dev/null |
|
881 +++ b/new |
|
882 @@ -0,0 +1,1 @@ |
|
883 +foo |
|
884 |
|
885 $ hg qnew -m'copy file' copy |
|
886 $ hg cp new copy |
|
887 $ hg qrefresh |
|
888 $ cat .hg/patches/copy |
|
889 copy file |
|
890 |
|
891 diff --git a/new b/copy |
|
892 copy from new |
|
893 copy to copy |
|
894 |
|
895 $ hg qpop |
|
896 popping copy |
|
897 now at: new |
|
898 $ hg qpush |
|
899 applying copy |
|
900 now at: copy |
|
901 $ hg qdiff |
|
902 diff --git a/new b/copy |
|
903 copy from new |
|
904 copy to copy |
|
905 $ cat >>$HGRCPATH <<EOF |
|
906 > [diff] |
|
907 > git = False |
|
908 > EOF |
|
909 $ hg qdiff --git |
|
910 diff --git a/new b/copy |
|
911 copy from new |
|
912 copy to copy |
|
913 $ cd .. |
|
914 |
|
915 |
|
916 test file addition in slow path |
|
917 |
|
918 $ hg init slow |
|
919 $ cd slow |
|
920 $ hg qinit |
|
921 $ echo foo > foo |
|
922 $ hg add foo |
|
923 $ hg ci -m 'add foo' |
|
924 $ hg qnew bar |
|
925 $ echo bar > bar |
|
926 $ hg add bar |
|
927 $ hg mv foo baz |
|
928 $ hg qrefresh --git |
|
929 $ hg up -C 0 |
|
930 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
931 $ echo >> foo |
|
932 $ hg ci -m 'change foo' |
|
933 created new head |
|
934 $ hg up -C 1 |
|
935 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
936 $ hg qrefresh --git 2>&1 | grep -v 'saving bundle' |
|
937 $ cat .hg/patches/bar |
|
938 diff --git a/bar b/bar |
|
939 new file mode 100644 |
|
940 --- /dev/null |
|
941 +++ b/bar |
|
942 @@ -0,0 +1,1 @@ |
|
943 +bar |
|
944 diff --git a/foo b/baz |
|
945 rename from foo |
|
946 rename to baz |
|
947 $ hg log -v --template '{rev} {file_copies}\n' -r . |
|
948 2 baz (foo) |
|
949 $ hg qrefresh --git |
|
950 $ cat .hg/patches/bar |
|
951 diff --git a/bar b/bar |
|
952 new file mode 100644 |
|
953 --- /dev/null |
|
954 +++ b/bar |
|
955 @@ -0,0 +1,1 @@ |
|
956 +bar |
|
957 diff --git a/foo b/baz |
|
958 rename from foo |
|
959 rename to baz |
|
960 $ hg log -v --template '{rev} {file_copies}\n' -r . |
|
961 2 baz (foo) |
|
962 $ hg qrefresh |
|
963 $ grep 'diff --git' .hg/patches/bar |
|
964 diff --git a/bar b/bar |
|
965 diff --git a/foo b/baz |
|
966 |
|
967 |
|
968 test file move chains in the slow path |
|
969 |
|
970 $ hg up -C 1 |
|
971 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
972 $ echo >> foo |
|
973 $ hg ci -m 'change foo again' |
|
974 $ hg up -C 2 |
|
975 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
976 $ hg mv bar quux |
|
977 $ hg mv baz bleh |
|
978 $ hg qrefresh --git 2>&1 | grep -v 'saving bundle' |
|
979 $ cat .hg/patches/bar |
|
980 diff --git a/foo b/bleh |
|
981 rename from foo |
|
982 rename to bleh |
|
983 diff --git a/quux b/quux |
|
984 new file mode 100644 |
|
985 --- /dev/null |
|
986 +++ b/quux |
|
987 @@ -0,0 +1,1 @@ |
|
988 +bar |
|
989 $ hg log -v --template '{rev} {file_copies}\n' -r . |
|
990 3 bleh (foo) |
|
991 $ hg mv quux fred |
|
992 $ hg mv bleh barney |
|
993 $ hg qrefresh --git |
|
994 $ cat .hg/patches/bar |
|
995 diff --git a/foo b/barney |
|
996 rename from foo |
|
997 rename to barney |
|
998 diff --git a/fred b/fred |
|
999 new file mode 100644 |
|
1000 --- /dev/null |
|
1001 +++ b/fred |
|
1002 @@ -0,0 +1,1 @@ |
|
1003 +bar |
|
1004 $ hg log -v --template '{rev} {file_copies}\n' -r . |
|
1005 3 barney (foo) |
|
1006 |
|
1007 |
|
1008 refresh omitting an added file |
|
1009 |
|
1010 $ hg qnew baz |
|
1011 $ echo newfile > newfile |
|
1012 $ hg add newfile |
|
1013 $ hg qrefresh |
|
1014 $ hg st -A newfile |
|
1015 C newfile |
|
1016 $ hg qrefresh -X newfile |
|
1017 $ hg st -A newfile |
|
1018 A newfile |
|
1019 $ hg revert newfile |
|
1020 $ rm newfile |
|
1021 $ hg qpop |
|
1022 popping baz |
|
1023 now at: bar |
|
1024 $ hg qdel baz |
|
1025 |
|
1026 |
|
1027 create a git patch |
|
1028 |
|
1029 $ echo a > alexander |
|
1030 $ hg add alexander |
|
1031 $ hg qnew -f --git addalexander |
|
1032 $ grep diff .hg/patches/addalexander |
|
1033 diff --git a/alexander b/alexander |
|
1034 |
|
1035 |
|
1036 create a git binary patch |
|
1037 |
|
1038 $ cat > writebin.py <<EOF |
|
1039 > import sys |
|
1040 > path = sys.argv[1] |
|
1041 > open(path, 'wb').write('BIN\x00ARY') |
|
1042 > EOF |
|
1043 $ python writebin.py bucephalus |
|
1044 |
|
1045 $ python "$TESTDIR/md5sum.py" bucephalus |
|
1046 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus |
|
1047 $ hg add bucephalus |
|
1048 $ hg qnew -f --git addbucephalus |
|
1049 $ grep diff .hg/patches/addbucephalus |
|
1050 diff --git a/bucephalus b/bucephalus |
|
1051 |
|
1052 |
|
1053 check binary patches can be popped and pushed |
|
1054 |
|
1055 $ hg qpop |
|
1056 popping addbucephalus |
|
1057 now at: addalexander |
|
1058 $ test -f bucephalus && echo % bucephalus should not be there |
|
1059 $ hg qpush |
|
1060 applying addbucephalus |
|
1061 now at: addbucephalus |
|
1062 $ test -f bucephalus || echo % bucephalus should be there |
|
1063 $ python "$TESTDIR/md5sum.py" bucephalus |
|
1064 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus |
|
1065 |
|
1066 |
|
1067 |
|
1068 strip again |
|
1069 |
|
1070 $ cd .. |
|
1071 $ hg init strip |
|
1072 $ cd strip |
|
1073 $ touch foo |
|
1074 $ hg add foo |
|
1075 $ hg ci -m 'add foo' |
|
1076 $ echo >> foo |
|
1077 $ hg ci -m 'change foo 1' |
|
1078 $ hg up -C 0 |
|
1079 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1080 $ echo 1 >> foo |
|
1081 $ hg ci -m 'change foo 2' |
|
1082 created new head |
|
1083 $ HGMERGE=true hg merge |
|
1084 merging foo |
|
1085 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1086 (branch merge, don't forget to commit) |
|
1087 $ hg ci -m merge |
|
1088 $ hg log |
|
1089 changeset: 3:99615015637b |
|
1090 tag: tip |
|
1091 parent: 2:20cbbe65cff7 |
|
1092 parent: 1:d2871fc282d4 |
|
1093 user: test |
|
1094 date: Thu Jan 01 00:00:00 1970 +0000 |
|
1095 summary: merge |
|
1096 |
|
1097 changeset: 2:20cbbe65cff7 |
|
1098 parent: 0:53245c60e682 |
|
1099 user: test |
|
1100 date: Thu Jan 01 00:00:00 1970 +0000 |
|
1101 summary: change foo 2 |
|
1102 |
|
1103 changeset: 1:d2871fc282d4 |
|
1104 user: test |
|
1105 date: Thu Jan 01 00:00:00 1970 +0000 |
|
1106 summary: change foo 1 |
|
1107 |
|
1108 changeset: 0:53245c60e682 |
|
1109 user: test |
|
1110 date: Thu Jan 01 00:00:00 1970 +0000 |
|
1111 summary: add foo |
|
1112 |
|
1113 $ hg strip 1 | hidebackup |
|
1114 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1115 saved backup bundle to |
|
1116 $ checkundo strip |
|
1117 $ hg log |
|
1118 changeset: 1:20cbbe65cff7 |
|
1119 tag: tip |
|
1120 user: test |
|
1121 date: Thu Jan 01 00:00:00 1970 +0000 |
|
1122 summary: change foo 2 |
|
1123 |
|
1124 changeset: 0:53245c60e682 |
|
1125 user: test |
|
1126 date: Thu Jan 01 00:00:00 1970 +0000 |
|
1127 summary: add foo |
|
1128 |
|
1129 $ cd .. |
|
1130 |
|
1131 |
|
1132 qclone |
|
1133 |
|
1134 $ qlog() |
|
1135 > { |
|
1136 > echo 'main repo:' |
|
1137 > hg log --template ' rev {rev}: {desc}\n' |
|
1138 > echo 'patch repo:' |
|
1139 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n' |
|
1140 > } |
|
1141 $ hg init qclonesource |
|
1142 $ cd qclonesource |
|
1143 $ echo foo > foo |
|
1144 $ hg add foo |
|
1145 $ hg ci -m 'add foo' |
|
1146 $ hg qinit |
|
1147 $ hg qnew patch1 |
|
1148 $ echo bar >> foo |
|
1149 $ hg qrefresh -m 'change foo' |
|
1150 $ cd .. |
|
1151 |
|
1152 |
|
1153 repo with unversioned patch dir |
|
1154 |
|
1155 $ hg qclone qclonesource failure |
|
1156 abort: versioned patch repository not found (see init --mq) |
|
1157 |
|
1158 $ cd qclonesource |
|
1159 $ hg qinit -c |
|
1160 adding .hg/patches/patch1 |
|
1161 $ hg qci -m checkpoint |
|
1162 $ qlog |
|
1163 main repo: |
|
1164 rev 1: change foo |
|
1165 rev 0: add foo |
|
1166 patch repo: |
|
1167 rev 0: checkpoint |
|
1168 $ cd .. |
|
1169 |
|
1170 |
|
1171 repo with patches applied |
|
1172 |
|
1173 $ hg qclone qclonesource qclonedest |
|
1174 updating to branch default |
|
1175 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1177 $ cd qclonedest |
|
1178 $ qlog |
|
1179 main repo: |
|
1180 rev 0: add foo |
|
1181 patch repo: |
|
1182 rev 0: checkpoint |
|
1183 $ cd .. |
|
1184 |
|
1185 |
|
1186 repo with patches unapplied |
|
1187 |
|
1188 $ cd qclonesource |
|
1189 $ hg qpop -a |
|
1190 popping patch1 |
|
1191 patch queue now empty |
|
1192 $ qlog |
|
1193 main repo: |
|
1194 rev 0: add foo |
|
1195 patch repo: |
|
1196 rev 0: checkpoint |
|
1197 $ cd .. |
|
1198 $ hg qclone qclonesource qclonedest2 |
|
1199 updating to branch default |
|
1200 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1201 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1202 $ cd qclonedest2 |
|
1203 $ qlog |
|
1204 main repo: |
|
1205 rev 0: add foo |
|
1206 patch repo: |
|
1207 rev 0: checkpoint |
|
1208 $ cd .. |
|
1209 |
|
1210 |
|
1211 test applying on an empty file (issue 1033) |
|
1212 |
|
1213 $ hg init empty |
|
1214 $ cd empty |
|
1215 $ touch a |
|
1216 $ hg ci -Am addempty |
|
1217 adding a |
|
1218 $ echo a > a |
|
1219 $ hg qnew -f -e changea |
|
1220 $ hg qpop |
|
1221 popping changea |
|
1222 patch queue now empty |
|
1223 $ hg qpush |
|
1224 applying changea |
|
1225 now at: changea |
|
1226 $ cd .. |
|
1227 |
|
1228 |
|
1229 test qpush with --force, issue1087 |
|
1230 |
|
1231 $ hg init forcepush |
|
1232 $ cd forcepush |
|
1233 $ echo hello > hello.txt |
|
1234 $ echo bye > bye.txt |
|
1235 $ hg ci -Ama |
|
1236 adding bye.txt |
|
1237 adding hello.txt |
|
1238 $ hg qnew -d '0 0' empty |
|
1239 $ hg qpop |
|
1240 popping empty |
|
1241 patch queue now empty |
|
1242 $ echo world >> hello.txt |
|
1243 |
|
1244 |
|
1245 qpush should fail, local changes |
|
1246 |
|
1247 $ hg qpush |
|
1248 abort: local changes found, refresh first |
|
1249 |
|
1250 |
|
1251 apply force, should not discard changes with empty patch |
|
1252 |
|
1253 $ hg qpush -f |
|
1254 applying empty |
|
1255 patch empty is empty |
|
1256 now at: empty |
|
1257 $ hg diff --config diff.nodates=True |
|
1258 diff -r bf5fc3f07a0a hello.txt |
|
1259 --- a/hello.txt |
|
1260 +++ b/hello.txt |
|
1261 @@ -1,1 +1,2 @@ |
|
1262 hello |
|
1263 +world |
|
1264 $ hg qdiff --config diff.nodates=True |
|
1265 diff -r 9ecee4f634e3 hello.txt |
|
1266 --- a/hello.txt |
|
1267 +++ b/hello.txt |
|
1268 @@ -1,1 +1,2 @@ |
|
1269 hello |
|
1270 +world |
|
1271 $ hg log -l1 -p |
|
1272 changeset: 1:bf5fc3f07a0a |
|
1273 tag: empty |
|
1274 tag: qbase |
|
1275 tag: qtip |
|
1276 tag: tip |
|
1277 user: test |
|
1278 date: Thu Jan 01 00:00:00 1970 +0000 |
|
1279 summary: imported patch empty |
|
1280 |
|
1281 |
|
1282 $ hg qref -d '0 0' |
|
1283 $ hg qpop |
|
1284 popping empty |
|
1285 patch queue now empty |
|
1286 $ echo universe >> hello.txt |
|
1287 $ echo universe >> bye.txt |
|
1288 |
|
1289 |
|
1290 qpush should fail, local changes |
|
1291 |
|
1292 $ hg qpush |
|
1293 abort: local changes found, refresh first |
|
1294 |
|
1295 |
|
1296 apply force, should discard changes in hello, but not bye |
|
1297 |
|
1298 $ hg qpush -f |
|
1299 applying empty |
|
1300 now at: empty |
|
1301 $ hg st |
|
1302 M bye.txt |
|
1303 $ hg diff --config diff.nodates=True |
|
1304 diff -r ba252371dbc1 bye.txt |
|
1305 --- a/bye.txt |
|
1306 +++ b/bye.txt |
|
1307 @@ -1,1 +1,2 @@ |
|
1308 bye |
|
1309 +universe |
|
1310 $ hg qdiff --config diff.nodates=True |
|
1311 diff -r 9ecee4f634e3 bye.txt |
|
1312 --- a/bye.txt |
|
1313 +++ b/bye.txt |
|
1314 @@ -1,1 +1,2 @@ |
|
1315 bye |
|
1316 +universe |
|
1317 diff -r 9ecee4f634e3 hello.txt |
|
1318 --- a/hello.txt |
|
1319 +++ b/hello.txt |
|
1320 @@ -1,1 +1,3 @@ |
|
1321 hello |
|
1322 +world |
|
1323 +universe |
|
1324 |
|
1325 |
|
1326 test popping revisions not in working dir ancestry |
|
1327 |
|
1328 $ hg qseries -v |
|
1329 0 A empty |
|
1330 $ hg up qparent |
|
1331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1332 $ hg qpop |
|
1333 popping empty |
|
1334 patch queue now empty |
|
1335 |
|
1336 $ cd .. |
|
1337 $ hg init deletion-order |
|
1338 $ cd deletion-order |
|
1339 |
|
1340 $ touch a |
|
1341 $ hg ci -Aqm0 |
|
1342 |
|
1343 $ hg qnew rename-dir |
|
1344 $ hg rm a |
|
1345 $ hg qrefresh |
|
1346 |
|
1347 $ mkdir a b |
|
1348 $ touch a/a b/b |
|
1349 $ hg add -q a b |
|
1350 $ hg qrefresh |
|
1351 |
|
1352 |
|
1353 test popping must remove files added in subdirectories first |
|
1354 |
|
1355 $ hg qpop |
|
1356 popping rename-dir |
|
1357 patch queue now empty |
|
1358 $ cd .. |
|
1359 |