From c62156e618ede0c4e069cb40107ad931be580f8e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 26 Jul 2018 16:04:59 +0800 Subject: mailscripts.el: add `notmuch-extract-thread-patches' Adapted from Aurelien Aptel's example in notmuch-extract-patch/README. Signed-off-by: Sean Whitton --- mailscripts.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mailscripts.el') diff --git a/mailscripts.el b/mailscripts.el index 1d8d406..33b6187 100644 --- a/mailscripts.el +++ b/mailscripts.el @@ -41,6 +41,20 @@ If NO-OPEN, don't open the thread." (notmuch-slurp-debbug (match-string 1 subject) t)) (notmuch-refresh-this-buffer))) +;;;###autoload +(defun notmuch-extract-thread-patches (repo branch) + "Extract patch series in current thread to new branch BRANCH in repo REPO." + (interactive "Dgit repo: \nsnew branch name: ") + (let ((thread-id notmuch-show-thread-id) + (default-directory (expand-file-name repo))) + (call-process-shell-command + (format "git checkout -b %s" + (shell-quote-argument branch))) + (shell-command + (format "notmuch-extract-patch %s | git am" + (shell-quote-argument thread-id)) + "*notmuch-apply-thread-series*"))) + (provide 'mailscripts) ;;; mailscripts.el ends here -- cgit v1.2.3