[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/debbugs 649b0c8 181/311: Get more info from patches in
From: |
Stefan Monnier |
Subject: |
[elpa] externals/debbugs 649b0c8 181/311: Get more info from patches in debbugs-gnu |
Date: |
Sun, 29 Nov 2020 18:42:07 -0500 (EST) |
branch: externals/debbugs
commit 649b0c8eb426f4b786e77e667047b68df1c062df
Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
Commit: Lars Magne Ingebrigtsen <larsi@gnus.org>
Get more info from patches in debbugs-gnu
* packages/debbugs/debbugs-gnu.el (debbugs-gnu-insert-changelog):
When handling git-formatted patches, get all the info from the
patches automatically.
---
debbugs-gnu.el | 86 ++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 62 insertions(+), 24 deletions(-)
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 378937b..316a654 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -1574,18 +1574,48 @@ If given a prefix, patch in the branch directory
instead."
(message "%s is a contributor %d times" string found)
found))
+(defvar debbugs-gnu-patch-subject nil)
+
(defun debbugs-gnu-insert-changelog ()
"Add a ChangeLog from a recently applied patch from a third party."
(interactive)
- (let (from subject)
+ (let (from subject patch-subject changelog)
(gnus-with-article-buffer
(widen)
(goto-char (point-min))
(setq from (mail-extract-address-components (gnus-fetch-field "from"))
- subject (gnus-fetch-field "subject")))
+ subject (gnus-fetch-field "subject"))
+ ;; If it's a patch formatted the right way, extract that data.
+ (dolist (handle (mapcar 'cdr (gnus-article-mime-handles)))
+ (when (string-match "diff\\|patch\\|plain"
+ (mm-handle-media-type handle))
+ (with-temp-buffer
+ (insert-buffer-substring (mm-handle-buffer handle))
+ (cond ((eq (mm-handle-encoding handle) 'base64)
+ (base64-decode-region (point-min) (point-max)))
+ ((eq (mm-handle-encoding handle) 'quoted-printable)
+ (quoted-printable-decode-region (point-min) (point-max))))
+ (setq patch-subject
+ (or (gnus-fetch-field "subject") patch-subject))
+ (goto-char (point-min))
+ (when (re-search-forward "^[*] " nil t)
+ (let ((start (match-beginning 0)))
+ (while (and (not (eobp))
+ (not (looking-at "---")))
+ (forward-line 1))
+ (setq changelog (buffer-substring
+ start (line-end-position 0)))))))))
(let ((add-log-full-name (car from))
(add-log-mailing-address (cadr from)))
(add-change-log-entry-other-window)
+ (when patch-subject
+ (setq-local debbugs-gnu-patch-subject patch-subject))
+ (when changelog
+ (delete-region (line-beginning-position) (point-max))
+ (save-restriction
+ (narrow-to-region (point) (point))
+ (insert changelog)
+ (indent-region (point-min) (point-max))))
(let ((point (point)))
(when (string-match "\\(bug#[0-9]+\\)" subject)
(insert " (" (match-string 1 subject) ")."))
@@ -1601,6 +1631,8 @@ If given a prefix, patch in the branch directory instead."
(cadr from))))))
(goto-char (point-max))
(end-of-line)
+ (when changelog
+ (insert "\n\n"))
(insert " Copyright-paperwork-exempt: yes"))
(goto-char point)))))
@@ -1644,28 +1676,34 @@ If given a prefix, patch in the branch directory
instead."
"Prepare checking in the current changes."
(interactive)
(save-some-buffers t)
- (when (get-buffer "*vc-dir*")
- (kill-buffer (get-buffer "*vc-dir*")))
- (let ((trunk (expand-file-name debbugs-gnu-trunk-directory)))
- (if (equal (cl-subseq default-directory 0 (length trunk))
- trunk)
- (vc-dir debbugs-gnu-trunk-directory)
- (vc-dir debbugs-gnu-branch-directory)))
- (goto-char (point-min))
- (while (not (search-forward "edited" nil t))
- (sit-for 0.01))
- (beginning-of-line)
- (while (search-forward "edited" nil t)
- (vc-dir-mark)
- (beginning-of-line))
- (vc-diff nil)
- (vc-next-action nil)
- (log-edit-insert-changelog t)
- (delete-other-windows)
- (split-window)
- (other-window 1)
- (switch-to-buffer "*vc-diff*")
- (other-window 1))
+ (when (get-buffer "*vc-dir*")
+ (kill-buffer (get-buffer "*vc-dir*")))
+ (let ((patch-subject debbugs-gnu-patch-subject))
+ (let ((trunk (expand-file-name debbugs-gnu-trunk-directory)))
+ (if (equal (cl-subseq default-directory 0 (length trunk))
+ trunk)
+ (vc-dir debbugs-gnu-trunk-directory)
+ (vc-dir debbugs-gnu-branch-directory)))
+ (goto-char (point-min))
+ (while (not (search-forward "edited" nil t))
+ (sit-for 0.01))
+ (beginning-of-line)
+ (while (search-forward "edited" nil t)
+ (vc-dir-mark)
+ (beginning-of-line))
+ (vc-diff nil)
+ (vc-next-action nil)
+ (delete-region (point-min) (point-max))
+ (log-edit-insert-changelog t)
+ (delete-other-windows)
+ (split-window)
+ (other-window 1)
+ (switch-to-buffer "*vc-diff*")
+ (other-window 1)
+ (when patch-subject
+ (insert "Summary: "
+ (replace-regexp-in-string "^ *\\[PATCH\\] *" "" patch-subject)
+ "\n"))))
(defun debbugs-gnu-save-cache ()
"Save the bugs cache to a file."
- [elpa] externals/debbugs 7f6186e 260/311: Also accept octet parts in debbugs-gnu patches, (continued)
- [elpa] externals/debbugs 7f6186e 260/311: Also accept octet parts in debbugs-gnu patches, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs d0d2ce3 266/311: Correctly parse non-ascii names in debbugs-gnu, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 87708cd 265/311: * packages/debbugs/debbugs-gnu.el (debbugs-gnu, debbugs-gnu-bugs): Send final, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 131a4a9 267/311: Release debbugs 0.20, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 112f78c 274/311: Fix leftover oddities in debbugs, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 2ceb7cd 288/311: Don't cache the debbugs directory but allow setting it per invocation, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 38ae622 307/311: Remove blank header line in debbugs-gnu.el, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 43b142a 305/311: Declare variables in debbugs-gnu.el, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs f2be042 309/311: Fix typo in previous debbugs-gnu change, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 528825b 311/311: * .gitignore: New file, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 649b0c8 181/311: Get more info from patches in debbugs-gnu,
Stefan Monnier <=
- [elpa] externals/debbugs ffe5b92 231/311: Fix previous patch, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 5179be4 222/311: Increase debbugs version to 0.14, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 4a24833 245/311: Fix previous change, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 743f65c 258/311: Allow applying patches selectively, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs ff6784a 273/311: Replace http:// by https:// in debbugs, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 36e5d9a 279/311: Add command to show mailboxes for all currently shown reports, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs c3ec95a 282/311: Implement debbugs-gnu-select-current-bugs-with-rmail, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 01c2322 283/311: Release debbugs 0.21, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 1563806 290/311: Release debbugs 0.23, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs dc88f7d 291/311: Autoload debbugs-browse-url., Stefan Monnier, 2020/11/29