[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vc-modify-change-comment for "modern" backend fix
From: |
Alfred M. Szmidt |
Subject: |
Re: vc-modify-change-comment for "modern" backend fix |
Date: |
Wed, 18 May 2022 02:34:48 -0400 |
What about something like this, I've tested it briefly with a
vc-fossil-get-log-entry, and with RCS and it seems to behave as it
does previously -- though slightly confused by what it does for RCS
(it inserts the header, but not the commit?).
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 415b1564ed..93e38bf3d2 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -521,17 +520,6 @@
(defun log-view-extract-comment ()
- "Parse comment from around the current point in the log."
- (save-excursion
- (let (st en (backend (vc-backend (log-view-current-file))))
- (log-view-end-of-defun)
- (cond ((eq backend 'SVN)
- (forward-line -1)))
- (setq en (point))
- (or (log-view-current-entry nil t)
- (throw 'beginning-of-buffer nil))
- (cond ((memq backend '(SCCS RCS CVS SVN))
- (forward-line 2))
- ((eq backend 'Hg)
- (forward-line 4)
- (re-search-forward "summary: *" nil t)))
- (setq st (point))
- (buffer-substring st en))))
+ "Extract the commit message for the current file."
+ (vc-call-backend log-view-vc-backend
+ 'get-log-entry
+ (log-view-current-file)
+ (log-view-current-tag)))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 3508f684c4..01ff7db356 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -359,6 +359,11 @@
;; and make sure it is displayed in the buffer's window. The default
;; implementation of this function works for RCS-style logs.
;;
+;; - get-log-entry (file revision)
+;;
+;; Return a string containing the log entry for FILE at revision
+;; REVISION.
+
;; - comment-history (file)
;;
;; Return a string containing all log entries that were made for FILE.
@@ -671,12 +676,7 @@
;; - The git backend supports amending, but in a different
;; way (press `C-c C-e' in log-edit buffer, when making a new commit).
;;
-;; - Second, `log-view-modify-change-comment' doesn't seem to support
-;; modern backends at all because `log-view-extract-comment'
-;; unconditionally calls `log-view-current-file'. This should be easy to
-;; fix.
-;;
-;; - Third, doing message editing in log-view might be a natural way to go
+;; - Second, doing message editing in log-view might be a natural way to go
;; about it, but editing any but the last commit (and even it, if it's
;; been pushed) is a dangerous operation in Git, which we shouldn't make
;; too easy for users to perform.
@@ -3158,6 +3158,23 @@ vc-default-show-log-entry
(with-no-warnings
(log-view-goto-rev rev)))
+(defun vc-default-get-log-entry (_backend _file _revision)
+ (save-excursion
+ (let (st en (backend (vc-backend (log-view-current-file))))
+ (log-view-end-of-defun)
+ (cond ((eq backend 'SVN)
+ (forward-line -1)))
+ (setq en (point))
+ (or (log-view-current-entry nil t)
+ (throw 'beginning-of-buffer nil))
+ (cond ((memq backend '(SCCS RCS CVS SVN))
+ (forward-line 2))
+ ((eq backend 'Hg)
+ (forward-line 4)
+ (re-search-forward "summary: *" nil t)))
+ (setq st (point))
+ (buffer-substring st en))))
+
(defun vc-default-comment-history (backend file)
"Return a string with all log entries stored in BACKEND for FILE."
(when (vc-find-backend-function backend 'print-log)
- vc-modify-change-comment for "modern" backend fix, Alfred M. Szmidt, 2022/05/17
- Re: vc-modify-change-comment for "modern" backend fix, Alfred M. Szmidt, 2022/05/17
- Re: vc-modify-change-comment for "modern" backend fix, Eli Zaretskii, 2022/05/17
- Re: vc-modify-change-comment for "modern" backend fix, Stefan Monnier, 2022/05/17
- Re: vc-modify-change-comment for "modern" backend fix,
Alfred M. Szmidt <=
- Re: vc-modify-change-comment for "modern" backend fix, Eli Zaretskii, 2022/05/18
- Re: vc-modify-change-comment for "modern" backend fix, Alfred M. Szmidt, 2022/05/19
- Re: vc-modify-change-comment for "modern" backend fix, Stefan Monnier, 2022/05/19
- Re: vc-modify-change-comment for "modern" backend fix, Dmitry Gutov, 2022/05/18
- Re: vc-modify-change-comment for "modern" backend fix, Alfred M. Szmidt, 2022/05/19
- Re: vc-modify-change-comment for "modern" backend fix, Dmitry Gutov, 2022/05/19
- Re: vc-modify-change-comment for "modern" backend fix, Alfred M. Szmidt, 2022/05/19
- Re: vc-modify-change-comment for "modern" backend fix, Dmitry Gutov, 2022/05/19