[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/debbugs 743f65c 258/311: Allow applying patches selecti
From: |
Stefan Monnier |
Subject: |
[elpa] externals/debbugs 743f65c 258/311: Allow applying patches selectively |
Date: |
Sun, 29 Nov 2020 18:42:24 -0500 (EST) |
branch: externals/debbugs
commit 743f65c1e66f56cf202e8fbe37200ca960611957
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Allow applying patches selectively
---
debbugs-gnu.el | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 716c37d..7913e96 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -2155,9 +2155,11 @@ or bug ranges, with default to
`debbugs-gnu-default-bug-number-list'."
"Emacs repository location: "
debbugs-gnu-current-directory nil t nil 'file-directory-p))))
-(defun debbugs-gnu-apply-patch (&optional branch)
+(defun debbugs-gnu-apply-patch (&optional branch selectively)
"Apply the patch from the current message.
-If given a prefix, patch in the branch directory instead."
+If given a prefix, patch in the branch directory instead.
+
+If SELECTIVELY, query the user before applying the patch."
(interactive "P")
(add-hook 'emacs-lisp-mode-hook #'debbugs-gnu-lisp-mode)
(add-hook 'diff-mode-hook #'debbugs-gnu-diff-mode)
@@ -2192,14 +2194,21 @@ If given a prefix, patch in the branch directory
instead."
(base64-decode-region (point-min) (point-max)))
((eq (car elem) 'quoted-printable)
(quoted-printable-decode-region (point-min) (point-max))))
+ (goto-char (point-min))
+ (while (search-forward "\r\n" nil t)
+ (replace-match "\n" t t))
(debbugs-gnu-fix-patch debbugs-gnu-current-directory)
- (call-process-region (point-min) (point-max)
- "patch" nil output-buffer nil
- "-r" rej "--no-backup-if-mismatch"
- "-l" "-f"
- "-d" (expand-file-name
- debbugs-gnu-current-directory)
- "-p1")))
+ (when (or (not selectively)
+ (y-or-n-p (format "%s\nApply?"
+ (buffer-substring (point-min)
+ (min 200 (point-max))))))
+ (call-process-region (point-min) (point-max)
+ "patch" nil output-buffer nil
+ "-r" rej "--no-backup-if-mismatch"
+ "-l" "-f"
+ "-d" (expand-file-name
+ debbugs-gnu-current-directory)
+ "-p1"))))
(set-buffer output-buffer)
(when (file-exists-p rej)
(goto-char (point-max))
@@ -2267,7 +2276,8 @@ If given a prefix, patch in the branch directory instead."
(while (re-search-forward diff-file-header-re nil t)
(goto-char (match-beginning 0))
(when-let ((target-name (debbugs-gnu-diff-hunk-target-name dir)))
- (when (re-search-forward "^\\([+]+\\|-+\\) .*" nil t)
+ (when (and (string-match "^/" target-name)
+ (re-search-forward "^\\([+]+\\|-+\\) .*" nil t))
(replace-match (concat (match-string 1)
" a"
(substring target-name (length dir)))
- [elpa] externals/debbugs 112f78c 274/311: Fix leftover oddities in debbugs, (continued)
- [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, 2020/11/29
- [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 <=
- [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
- [elpa] externals/debbugs cca9282 297/311: Make the debbugs display more compact so that you can read the titles, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 6bb1538 298/311: Add support for marking bugs as well, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 86a7788 220/311: Add "guix-patches" to debbugs, Stefan Monnier, 2020/11/29
- [elpa] externals/debbugs 8aa30e4 227/311: Recognize bugs.gnu.org in debbugs, Stefan Monnier, 2020/11/29