summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2018-07-26 16:04:59 +0800
committerSean Whitton <spwhitton@spwhitton.name>2018-07-26 16:16:46 +0800
commitc62156e618ede0c4e069cb40107ad931be580f8e (patch)
treeff8d6cacf6fff20ba3a3aa49709e0e3850fcf222
parent2e72667de60536257e2ae52e6f86a12e7a469eed (diff)
downloadmailscripts-c62156e618ede0c4e069cb40107ad931be580f8e.tar.gz
mailscripts.el: add `notmuch-extract-thread-patches'
Adapted from Aurelien Aptel's example in notmuch-extract-patch/README. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--mailscripts.el14
1 files changed, 14 insertions, 0 deletions
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