{"thread":{"id":"1279","subject":"[PATCH] tools/applymbox: allow manual fixing and continuing after a failure.","startedAt":"2005-07-20T23:31:23Z","lastAt":"2005-07-20T23:31:23Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6283","messageId":"7vsly9dph0.fsf@assigned-by-dhcp.cox.net","threadId":"1279","inReplyTo":null,"subject":"[PATCH] tools/applymbox: allow manual fixing and continuing after a failure.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-20T23:31:23Z","receivedAt":"2005-07-20T23:31:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"With \"-c .dotest/0002\" flag, the applymbox command can be told\nto use existing .dotest/patch file after hand-fixing the patch\nconflicts for the second patch in the mailbox, and continue on\nfrom that message, skipping the already applied first patch in\n.dotest/0001.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n tools/applymbox |   48 ++++++++++++++++++++++++++++++++++++++----------\n 1 files changed, 38 insertions(+), 10 deletions(-)\n\n688c63d625903ea3972deb3ec5c6dc3ef00f950e\ndiff --git a/tools/applymbox b/tools/applymbox\n--- a/tools/applymbox\n+++ b/tools/applymbox\n@@ -9,20 +9,48 @@\n ## You give it a mbox-format collection of emails, and it will try to\n ## apply them to the kernel using \"applypatch\"\n ##\n-## dotest [ -q ] mail_archive [Signoff_file]\n+## applymbox [ -c .dotest/msg-number ] [ -q ] mail_archive [Signoff_file]\"\n ##\n-rm -rf .dotest\n-mkdir .dotest\n-case $1 in\n+## The patch application may fail in the middle.  In which case:\n+## (1) look at .dotest/patch and fix it up to apply\n+## (2) re-run applymbox with -c .dotest/msg-number for the current one.\n+## Pay a special attention to the commit log message if you do this and\n+## use a Signoff_file, because applypatch wants to append the sign-off\n+## message to msg-clean every time it is run.\n \n-\t-q)\ttouch .dotest/.query_apply\n-\t\tshift;;\n+query_apply= continue= resume=t\n+while case \"$#\" in 0) break ;; esac\n+do\n+\tcase \"$1\" in\n+\t-q)\tquery_apply=t ;;\n+\t-c)\tcontinue=\"$2\"; resume=f; shift ;;\n+\t-*)\tusage ;;\n+\t*)\tbreak ;;\n+\tesac\n+\tshift\n+done\n+\n+case \"$continue\" in\n+'')\n+\trm -rf .dotest\n+\tmkdir .dotest\n+\tmailsplit \"$1\" .dotest || exit 1\n esac\n-mailsplit $1 .dotest || exit 1\n-for i in .dotest/*\n+\n+case \"$query_apply\" in\n+t)\ttouch .dotest/.query_apply\n+esac\n+\n+for i in .dotest/0*\n do\n-\tmailinfo .dotest/msg .dotest/patch < $i > .dotest/info || exit 1\n-\tgit-stripspace < .dotest/msg > .dotest/msg-clean\n+\tcase \"$resume,$continue\" in\n+\tf,$i)\tresume=t;;\n+\tf,*)\tcontinue;;\n+\t*)\n+\t\tmailinfo .dotest/msg .dotest/patch <$i >.dotest/info || exit 1\n+\t\tgit-stripspace < .dotest/msg > .dotest/msg-clean\n+\t\t;;\n+\tesac\n \tapplypatch .dotest/msg-clean .dotest/patch .dotest/info \"$2\"\n \tret=$?\n \tif [ $ret -ne 0 ]; then\n"}]}