1 % help |
|
2 mq extension - manage a stack of patches |
|
3 |
|
4 This extension lets you work with a stack of patches in a Mercurial |
|
5 repository. It manages two stacks of patches - all known patches, and applied |
|
6 patches (subset of known patches). |
|
7 |
|
8 Known patches are represented as patch files in the .hg/patches directory. |
|
9 Applied patches are both patch files and changesets. |
|
10 |
|
11 Common tasks (use "hg help command" for more details): |
|
12 |
|
13 create new patch qnew |
|
14 import existing patch qimport |
|
15 |
|
16 print patch series qseries |
|
17 print applied patches qapplied |
|
18 |
|
19 add known patch to applied stack qpush |
|
20 remove patch from applied stack qpop |
|
21 refresh contents of top applied patch qrefresh |
|
22 |
|
23 By default, mq will automatically use git patches when required to avoid |
|
24 losing file mode changes, copy records, binary files or empty files creations |
|
25 or deletions. This behaviour can be configured with: |
|
26 |
|
27 [mq] |
|
28 git = auto/keep/yes/no |
|
29 |
|
30 If set to 'keep', mq will obey the [diff] section configuration while |
|
31 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq |
|
32 will override the [diff] section and always generate git or regular patches, |
|
33 possibly losing data in the second case. |
|
34 |
|
35 You will by default be managing a patch queue named "patches". You can create |
|
36 other, independent patch queues with the "hg qqueue" command. |
|
37 |
|
38 list of commands: |
|
39 |
|
40 qapplied print the patches already applied |
|
41 qclone clone main and patch repository at same time |
|
42 qdelete remove patches from queue |
|
43 qdiff diff of the current patch and subsequent modifications |
|
44 qfinish move applied patches into repository history |
|
45 qfold fold the named patches into the current patch |
|
46 qgoto push or pop patches until named patch is at top of stack |
|
47 qguard set or print guards for a patch |
|
48 qheader print the header of the topmost or specified patch |
|
49 qimport import a patch |
|
50 qnew create a new patch |
|
51 qnext print the name of the next patch |
|
52 qpop pop the current patch off the stack |
|
53 qprev print the name of the previous patch |
|
54 qpush push the next patch onto the stack |
|
55 qqueue manage multiple patch queues |
|
56 qrefresh update the current patch |
|
57 qrename rename a patch |
|
58 qselect set or print guarded patches to push |
|
59 qseries print the entire series file |
|
60 qtop print the name of the current patch |
|
61 qunapplied print the patches not yet applied |
|
62 strip strip changesets and all their descendants from the repository |
|
63 |
|
64 use "hg -v help mq" to show aliases and global options |
|
65 adding a |
|
66 updating to branch default |
|
67 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
68 adding b/z |
|
69 % qinit |
|
70 % -R qinit |
|
71 % qinit -c |
|
72 A .hgignore |
|
73 A series |
|
74 % qinit; qinit -c |
|
75 .hgignore: |
|
76 ^\.hg |
|
77 ^\.mq |
|
78 syntax: glob |
|
79 status |
|
80 guards |
|
81 series: |
|
82 abort: repository already exists! |
|
83 % qinit; <stuff>; qinit -c |
|
84 adding .hg/patches/A |
|
85 adding .hg/patches/B |
|
86 A .hgignore |
|
87 A A |
|
88 A B |
|
89 A series |
|
90 .hgignore: |
|
91 status |
|
92 bleh |
|
93 series: |
|
94 A |
|
95 B |
|
96 % status --mq with color (issue2096) |
|
97 [0;32;1mA .hgignore[0m |
|
98 [0;32;1mA A[0m |
|
99 [0;32;1mA B[0m |
|
100 [0;32;1mA series[0m |
|
101 % init --mq without repo |
|
102 abort: There is no Mercurial repository here (.hg not found) |
|
103 % init --mq with repo path |
|
104 ok |
|
105 % init --mq with nonexistent directory |
|
106 abort: repository nonexistentdir not found! |
|
107 % init --mq with bundle (non "local") |
|
108 abort: only a local queue repository may be initialized |
|
109 % qrefresh |
|
110 foo bar |
|
111 |
|
112 diff -r xa |
|
113 --- a/a |
|
114 +++ b/a |
|
115 @@ -1,1 +1,2 @@ |
|
116 a |
|
117 +a |
|
118 % empty qrefresh |
|
119 revision: |
|
120 patch: |
|
121 foo bar |
|
122 |
|
123 working dir diff: |
|
124 --- a/a |
|
125 +++ b/a |
|
126 @@ -1,1 +1,2 @@ |
|
127 a |
|
128 +a |
|
129 % qpop |
|
130 popping test.patch |
|
131 patch queue now empty |
|
132 % qpush with dump of tag cache |
|
133 .hg/tags.cache (pre qpush): |
|
134 1 |
|
135 |
|
136 applying test.patch |
|
137 now at: test.patch |
|
138 .hg/tags.cache (post qpush): |
|
139 2 |
|
140 |
|
141 % pop/push outside repo |
|
142 popping test.patch |
|
143 patch queue now empty |
|
144 applying test.patch |
|
145 now at: test.patch |
|
146 % qrefresh in subdir |
|
147 % pop/push -a in subdir |
|
148 popping test2.patch |
|
149 popping test.patch |
|
150 patch queue now empty |
|
151 applying test.patch |
|
152 applying test2.patch |
|
153 now at: test2.patch |
|
154 % qseries |
|
155 test.patch |
|
156 test2.patch |
|
157 0 A test.patch: f... |
|
158 1 A test2.patch: |
|
159 popping test2.patch |
|
160 now at: test.patch |
|
161 0 A test.patch: foo bar |
|
162 1 U test2.patch: |
|
163 mq: 1 applied, 1 unapplied |
|
164 applying test2.patch |
|
165 now at: test2.patch |
|
166 mq: 2 applied |
|
167 % qapplied |
|
168 test.patch |
|
169 test2.patch |
|
170 % qtop |
|
171 test2.patch |
|
172 % prev |
|
173 test.patch |
|
174 % next |
|
175 all patches applied |
|
176 popping test2.patch |
|
177 now at: test.patch |
|
178 % commit should fail |
|
179 abort: cannot commit over an applied mq patch |
|
180 % push should fail |
|
181 pushing to ../../k |
|
182 abort: source has mq patches applied |
|
183 % import should fail |
|
184 abort: cannot import over an applied patch |
|
185 % import --no-commit should succeed |
|
186 applying ../../import.diff |
|
187 M a |
|
188 % qunapplied |
|
189 test2.patch |
|
190 % qpush/qpop with index |
|
191 applying test2.patch |
|
192 now at: test2.patch |
|
193 popping test2.patch |
|
194 popping test1b.patch |
|
195 now at: test.patch |
|
196 applying test1b.patch |
|
197 now at: test1b.patch |
|
198 applying test2.patch |
|
199 now at: test2.patch |
|
200 popping test2.patch |
|
201 now at: test1b.patch |
|
202 popping test1b.patch |
|
203 now at: test.patch |
|
204 applying test1b.patch |
|
205 applying test2.patch |
|
206 now at: test2.patch |
|
207 % qpush --move |
|
208 popping test2.patch |
|
209 popping test1b.patch |
|
210 popping test.patch |
|
211 patch queue now empty |
|
212 cannot push 'test2.patch' - guarded by ['+posguard'] |
|
213 number of unguarded, unapplied patches has changed from 2 to 3 |
|
214 applying test2.patch |
|
215 now at: test2.patch |
|
216 applying test1b.patch |
|
217 now at: test1b.patch |
|
218 applying test.patch |
|
219 now at: test.patch |
|
220 0 A test2.patch |
|
221 1 A test1b.patch |
|
222 2 A test.patch |
|
223 popping test.patch |
|
224 popping test1b.patch |
|
225 popping test2.patch |
|
226 patch queue now empty |
|
227 guards deactivated |
|
228 number of unguarded, unapplied patches has changed from 3 to 2 |
|
229 applying test.patch |
|
230 now at: test.patch |
|
231 applying test1b.patch |
|
232 now at: test1b.patch |
|
233 abort: patch bogus not in series |
|
234 abort: please specify the patch to move |
|
235 abort: cannot push to a previous patch: test.patch |
|
236 applying test2.patch |
|
237 now at: test2.patch |
|
238 % series after move |
|
239 test.patch |
|
240 test1b.patch |
|
241 test2.patch |
|
242 # comment |
|
243 |
|
244 % pop, qapplied, qunapplied |
|
245 0 A test.patch |
|
246 1 A test1b.patch |
|
247 2 A test2.patch |
|
248 % qapplied -1 test.patch |
|
249 only one patch applied |
|
250 % qapplied -1 test1b.patch |
|
251 test.patch |
|
252 % qapplied -1 test2.patch |
|
253 test1b.patch |
|
254 % qapplied -1 |
|
255 test1b.patch |
|
256 % qapplied |
|
257 test.patch |
|
258 test1b.patch |
|
259 test2.patch |
|
260 % qapplied test1b.patch |
|
261 test.patch |
|
262 test1b.patch |
|
263 % qunapplied -1 |
|
264 all patches applied |
|
265 % qunapplied |
|
266 % popping |
|
267 popping test2.patch |
|
268 now at: test1b.patch |
|
269 % qunapplied -1 |
|
270 test2.patch |
|
271 % qunapplied |
|
272 test2.patch |
|
273 % qunapplied test2.patch |
|
274 % qunapplied -1 test2.patch |
|
275 all patches applied |
|
276 % popping -a |
|
277 popping test1b.patch |
|
278 popping test.patch |
|
279 patch queue now empty |
|
280 % qapplied |
|
281 % qapplied -1 |
|
282 no patches applied |
|
283 applying test.patch |
|
284 now at: test.patch |
|
285 % push should succeed |
|
286 popping test.patch |
|
287 patch queue now empty |
|
288 pushing to ../../k |
|
289 searching for changes |
|
290 adding changesets |
|
291 adding manifests |
|
292 adding file changes |
|
293 added 1 changesets with 1 changes to 1 files |
|
294 % qpush/qpop error codes |
|
295 applying test.patch |
|
296 applying test1b.patch |
|
297 applying test2.patch |
|
298 now at: test2.patch |
|
299 % pops all patches and succeeds |
|
300 popping test2.patch |
|
301 popping test1b.patch |
|
302 popping test.patch |
|
303 patch queue now empty |
|
304 qpop -a succeeds |
|
305 % does nothing and succeeds |
|
306 no patches applied |
|
307 qpop -a succeeds |
|
308 % fails - nothing else to pop |
|
309 no patches applied |
|
310 qpop fails |
|
311 % pushes a patch and succeeds |
|
312 applying test.patch |
|
313 now at: test.patch |
|
314 qpush succeeds |
|
315 % pops a patch and succeeds |
|
316 popping test.patch |
|
317 patch queue now empty |
|
318 qpop succeeds |
|
319 % pushes up to test1b.patch and succeeds |
|
320 applying test.patch |
|
321 applying test1b.patch |
|
322 now at: test1b.patch |
|
323 qpush test1b.patch succeeds |
|
324 % does nothing and succeeds |
|
325 qpush: test1b.patch is already at the top |
|
326 qpush test1b.patch succeeds |
|
327 % does nothing and succeeds |
|
328 qpop: test1b.patch is already at the top |
|
329 qpop test1b.patch succeeds |
|
330 % fails - can't push to this patch |
|
331 abort: cannot push to a previous patch: test.patch |
|
332 qpush test.patch fails |
|
333 % fails - can't pop to this patch |
|
334 abort: patch test2.patch is not applied |
|
335 qpop test2.patch fails |
|
336 % pops up to test.patch and succeeds |
|
337 popping test1b.patch |
|
338 now at: test.patch |
|
339 qpop test.patch succeeds |
|
340 % pushes all patches and succeeds |
|
341 applying test1b.patch |
|
342 applying test2.patch |
|
343 now at: test2.patch |
|
344 qpush -a succeeds |
|
345 % does nothing and succeeds |
|
346 all patches are currently applied |
|
347 qpush -a succeeds |
|
348 % fails - nothing else to push |
|
349 patch series already fully applied |
|
350 qpush fails |
|
351 % does nothing and succeeds |
|
352 qpush: test2.patch is already at the top |
|
353 qpush test2.patch succeeds |
|
354 % strip |
|
355 adding x |
|
356 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
357 saved backup bundle to |
|
358 adding changesets |
|
359 adding manifests |
|
360 adding file changes |
|
361 added 1 changesets with 1 changes to 1 files |
|
362 (run 'hg update' to get a working copy) |
|
363 % strip with local changes, should complain |
|
364 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
365 abort: local changes found |
|
366 % --force strip with local changes |
|
367 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
368 saved backup bundle to |
|
369 % cd b; hg qrefresh |
|
370 adding a |
|
371 foo |
|
372 |
|
373 diff -r cb9a9f314b8b a |
|
374 --- a/a |
|
375 +++ b/a |
|
376 @@ -1,1 +1,2 @@ |
|
377 a |
|
378 +a |
|
379 diff -r cb9a9f314b8b b/f |
|
380 --- /dev/null |
|
381 +++ b/b/f |
|
382 @@ -0,0 +1,1 @@ |
|
383 +f |
|
384 % hg qrefresh . |
|
385 foo |
|
386 |
|
387 diff -r cb9a9f314b8b b/f |
|
388 --- /dev/null |
|
389 +++ b/b/f |
|
390 @@ -0,0 +1,1 @@ |
|
391 +f |
|
392 M a |
|
393 % qpush failure |
|
394 popping bar |
|
395 popping foo |
|
396 patch queue now empty |
|
397 applying foo |
|
398 applying bar |
|
399 file foo already exists |
|
400 1 out of 1 hunks FAILED -- saving rejects to file foo.rej |
|
401 patch failed, unable to continue (try -v) |
|
402 patch failed, rejects left in working dir |
|
403 errors during apply, please fix and refresh bar |
|
404 ? foo |
|
405 ? foo.rej |
|
406 % mq tags |
|
407 0 qparent |
|
408 1 foo qbase |
|
409 2 bar qtip tip |
|
410 % bad node in status |
|
411 popping bar |
|
412 now at: foo |
|
413 changeset: 0:cb9a9f314b8b |
|
414 tag: tip |
|
415 user: test |
|
416 date: Thu Jan 01 00:00:00 1970 +0000 |
|
417 summary: a |
|
418 |
|
419 default 0:cb9a9f314b8b |
|
420 no patches applied |
|
421 new file |
|
422 |
|
423 diff --git a/new b/new |
|
424 new file mode 100755 |
|
425 --- /dev/null |
|
426 +++ b/new |
|
427 @@ -0,0 +1,1 @@ |
|
428 +foo |
|
429 copy file |
|
430 |
|
431 diff --git a/new b/copy |
|
432 copy from new |
|
433 copy to copy |
|
434 popping copy |
|
435 now at: new |
|
436 applying copy |
|
437 now at: copy |
|
438 diff --git a/new b/copy |
|
439 copy from new |
|
440 copy to copy |
|
441 diff --git a/new b/copy |
|
442 copy from new |
|
443 copy to copy |
|
444 % test file addition in slow path |
|
445 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
446 created new head |
|
447 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
448 diff --git a/bar b/bar |
|
449 new file mode 100644 |
|
450 --- /dev/null |
|
451 +++ b/bar |
|
452 @@ -0,0 +1,1 @@ |
|
453 +bar |
|
454 diff --git a/foo b/baz |
|
455 rename from foo |
|
456 rename to baz |
|
457 2 baz (foo) |
|
458 diff --git a/bar b/bar |
|
459 new file mode 100644 |
|
460 --- /dev/null |
|
461 +++ b/bar |
|
462 @@ -0,0 +1,1 @@ |
|
463 +bar |
|
464 diff --git a/foo b/baz |
|
465 rename from foo |
|
466 rename to baz |
|
467 2 baz (foo) |
|
468 diff --git a/bar b/bar |
|
469 diff --git a/foo b/baz |
|
470 % test file move chains in the slow path |
|
471 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
472 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
473 diff --git a/foo b/bleh |
|
474 rename from foo |
|
475 rename to bleh |
|
476 diff --git a/quux b/quux |
|
477 new file mode 100644 |
|
478 --- /dev/null |
|
479 +++ b/quux |
|
480 @@ -0,0 +1,1 @@ |
|
481 +bar |
|
482 3 bleh (foo) |
|
483 diff --git a/foo b/barney |
|
484 rename from foo |
|
485 rename to barney |
|
486 diff --git a/fred b/fred |
|
487 new file mode 100644 |
|
488 --- /dev/null |
|
489 +++ b/fred |
|
490 @@ -0,0 +1,1 @@ |
|
491 +bar |
|
492 3 barney (foo) |
|
493 % refresh omitting an added file |
|
494 C newfile |
|
495 A newfile |
|
496 popping baz |
|
497 now at: bar |
|
498 % create a git patch |
|
499 diff --git a/alexander b/alexander |
|
500 % create a git binary patch |
|
501 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus |
|
502 diff --git a/bucephalus b/bucephalus |
|
503 % check binary patches can be popped and pushed |
|
504 popping addbucephalus |
|
505 now at: addalexander |
|
506 applying addbucephalus |
|
507 now at: addbucephalus |
|
508 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus |
|
509 % strip again |
|
510 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
511 created new head |
|
512 merging foo |
|
513 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
514 (branch merge, don't forget to commit) |
|
515 changeset: 3:99615015637b |
|
516 tag: tip |
|
517 parent: 2:20cbbe65cff7 |
|
518 parent: 1:d2871fc282d4 |
|
519 user: test |
|
520 date: Thu Jan 01 00:00:00 1970 +0000 |
|
521 summary: merge |
|
522 |
|
523 changeset: 2:20cbbe65cff7 |
|
524 parent: 0:53245c60e682 |
|
525 user: test |
|
526 date: Thu Jan 01 00:00:00 1970 +0000 |
|
527 summary: change foo 2 |
|
528 |
|
529 changeset: 1:d2871fc282d4 |
|
530 user: test |
|
531 date: Thu Jan 01 00:00:00 1970 +0000 |
|
532 summary: change foo 1 |
|
533 |
|
534 changeset: 0:53245c60e682 |
|
535 user: test |
|
536 date: Thu Jan 01 00:00:00 1970 +0000 |
|
537 summary: add foo |
|
538 |
|
539 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
540 saved backup bundle to |
|
541 changeset: 1:20cbbe65cff7 |
|
542 tag: tip |
|
543 user: test |
|
544 date: Thu Jan 01 00:00:00 1970 +0000 |
|
545 summary: change foo 2 |
|
546 |
|
547 changeset: 0:53245c60e682 |
|
548 user: test |
|
549 date: Thu Jan 01 00:00:00 1970 +0000 |
|
550 summary: add foo |
|
551 |
|
552 % qclone |
|
553 abort: versioned patch repository not found (see init --mq) |
|
554 adding .hg/patches/patch1 |
|
555 main repo: |
|
556 rev 1: change foo |
|
557 rev 0: add foo |
|
558 patch repo: |
|
559 rev 0: checkpoint |
|
560 updating to branch default |
|
561 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
562 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
563 main repo: |
|
564 rev 0: add foo |
|
565 patch repo: |
|
566 rev 0: checkpoint |
|
567 popping patch1 |
|
568 patch queue now empty |
|
569 main repo: |
|
570 rev 0: add foo |
|
571 patch repo: |
|
572 rev 0: checkpoint |
|
573 updating to branch default |
|
574 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
575 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
576 main repo: |
|
577 rev 0: add foo |
|
578 patch repo: |
|
579 rev 0: checkpoint |
|
580 % test applying on an empty file (issue 1033) |
|
581 adding a |
|
582 popping changea |
|
583 patch queue now empty |
|
584 applying changea |
|
585 now at: changea |
|
586 % test qpush with --force, issue1087 |
|
587 adding bye.txt |
|
588 adding hello.txt |
|
589 popping empty |
|
590 patch queue now empty |
|
591 % qpush should fail, local changes |
|
592 abort: local changes found, refresh first |
|
593 % apply force, should not discard changes with empty patch |
|
594 applying empty |
|
595 patch empty is empty |
|
596 now at: empty |
|
597 diff -r bf5fc3f07a0a hello.txt |
|
598 --- a/hello.txt |
|
599 +++ b/hello.txt |
|
600 @@ -1,1 +1,2 @@ |
|
601 hello |
|
602 +world |
|
603 diff -r 9ecee4f634e3 hello.txt |
|
604 --- a/hello.txt |
|
605 +++ b/hello.txt |
|
606 @@ -1,1 +1,2 @@ |
|
607 hello |
|
608 +world |
|
609 changeset: 1:bf5fc3f07a0a |
|
610 tag: empty |
|
611 tag: qbase |
|
612 tag: qtip |
|
613 tag: tip |
|
614 user: test |
|
615 date: Thu Jan 01 00:00:00 1970 +0000 |
|
616 summary: imported patch empty |
|
617 |
|
618 |
|
619 popping empty |
|
620 patch queue now empty |
|
621 % qpush should fail, local changes |
|
622 abort: local changes found, refresh first |
|
623 % apply force, should discard changes in hello, but not bye |
|
624 applying empty |
|
625 now at: empty |
|
626 M bye.txt |
|
627 diff -r ba252371dbc1 bye.txt |
|
628 --- a/bye.txt |
|
629 +++ b/bye.txt |
|
630 @@ -1,1 +1,2 @@ |
|
631 bye |
|
632 +universe |
|
633 diff -r 9ecee4f634e3 bye.txt |
|
634 --- a/bye.txt |
|
635 +++ b/bye.txt |
|
636 @@ -1,1 +1,2 @@ |
|
637 bye |
|
638 +universe |
|
639 diff -r 9ecee4f634e3 hello.txt |
|
640 --- a/hello.txt |
|
641 +++ b/hello.txt |
|
642 @@ -1,1 +1,3 @@ |
|
643 hello |
|
644 +world |
|
645 +universe |
|
646 % test popping revisions not in working dir ancestry |
|
647 0 A empty |
|
648 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
649 popping empty |
|
650 patch queue now empty |
|
651 % test popping must remove files added in subdirectories first |
|
652 popping rename-dir |
|
653 patch queue now empty |
|