diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-05-11 15:25:35 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-05-11 15:25:35 -0700 |
commit | 75df035544868a65e2a3d5603e65fc6f578e1550 (patch) | |
tree | b8b0cfde404dcb0dd84e5b986f5107ae560b7b9c /mailscripts.el | |
parent | c92a2b7d7aa9467e9ff69643ee46874dfb9eb829 (diff) | |
parent | ab4acbc313dc1a20e166045e61c603053c4f00dc (diff) | |
download | mailscripts-75df035544868a65e2a3d5603e65fc6f578e1550.tar.gz |
Merge tag 'debian/0.20-1' into buster-bpo
mailscripts release 0.20-1 for unstable (sid) [dgit]
[dgit distro=debian no-split --quilt=linear]
# gpg: Signature made Tue 05 May 2020 10:57:07 AM MST
# gpg: using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240
# gpg: Good signature from "Sean Whitton <spwhitton@spwhitton.name>" [ultimate]
# Primary key fingerprint: 8DC2 487E 51AB DD90 B5C4 753F 0F56 D055 3B6D 411B
# Subkey fingerprint: 9B91 7007 AE03 0E36 E4FC 248B 695B 7AE4 BF06 6240
Diffstat (limited to 'mailscripts.el')
-rw-r--r-- | mailscripts.el | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/mailscripts.el b/mailscripts.el index 0658c76..2280f5a 100644 --- a/mailscripts.el +++ b/mailscripts.el @@ -1,7 +1,7 @@ ;;; mailscripts.el --- functions to access tools in the mailscripts package ;; Author: Sean Whitton <spwhitton@spwhitton.name> -;; Version: 0.18 +;; Version: 0.20 ;; Package-Requires: (notmuch projectile) ;; Copyright (C) 2018, 2019 Sean Whitton @@ -34,6 +34,17 @@ E.g. `email/'." :type 'string :group 'mailscripts) +(defcustom mailscripts-detach-head-from-existing-branch nil + "Whether to detach HEAD before applying patches to an existing branch. + +This is useful if you want to manually review the result of +applying patches before updating any of your existing branches, +or for quick, ad hoc testing of a patch series. + +Note that this does not prevent the creation of new branches." + :type 'boolean + :group 'mailscripts) + ;;;###autoload (defun notmuch-slurp-debbug (bug &optional no-open) "Slurp Debian bug with bug number BUG and open the thread in notmuch. @@ -67,7 +78,7 @@ See notmuch-extract-patch(1) manpage for limitations: in particular, this Emacs Lisp function supports passing only entire threads to the notmuch-extract-patch(1) command." (interactive - "Dgit repo: \nsbranch name (or leave blank to apply to current HEAD): \nP") + "Dgit repo: \nsnew branch name (or leave blank to apply to current HEAD): \nP") (let ((thread-id ;; If `notmuch-show' was called with a notmuch query rather ;; than a thread ID, as `org-notmuch-follow-link' in @@ -109,18 +120,18 @@ Patches are applied using git-am(1), so we only consider attachments with filenames which look like they were generated by git-format-patch(1)." (interactive - "Dgit repo: \nsbranch name (or leave blank to apply to current HEAD): ") + "Dgit repo: \nsnew branch name (or leave blank to apply to current HEAD): ") (with-current-notmuch-show-message (let ((default-directory (expand-file-name repo)) - (mm-handle (mm-dissect-buffer))) + (mm-handle (mm-dissect-buffer t))) (mailscripts--check-out-branch branch) (notmuch-foreach-mime-part (lambda (p) (let* ((disposition (mm-handle-disposition p)) (filename (cdr (assq 'filename disposition)))) (and filename - (string-match - "^\\(v[0-9]+-\\)?[0-9]+-.+\.\\(patch\\|diff\\|txt\\)$" filename) + (string-match "^\\(v?[0-9]+\\)-.+\\.\\(patch\\|diff\\|txt\\)$" + filename) (mm-pipe-part p "git am")))) mm-handle)))) @@ -131,7 +142,9 @@ git-format-patch(1)." (mailscripts--projectile-repo-and-branch 'notmuch-extract-message-patches)) (defun mailscripts--check-out-branch (branch) - (unless (string= branch "") + (if (string= branch "") + (when mailscripts-detach-head-from-existing-branch + (call-process-shell-command "git checkout --detach")) (call-process-shell-command (format "git checkout -b %s" (shell-quote-argument |