;; Set up key bindings for use while editing log messages
(declare-function log-edit-empty-buffer-p "log-edit" ())
+(declare-function log-edit-diff-fileset "log-edit" ())
+(declare-function log-edit-diff-patch "log-edit" ())
(defvar vc-patch-string)
-(defun vc-log-edit (fileset mode backend)
+(defun vc-log-edit (fileset mode backend &optional diff-function)
"Set up `log-edit' for use on FILE."
(setq default-directory
(buffer-local-value 'default-directory vc-parent-buffer))
(lambda (file) (file-relative-name file root))
fileset))))
(log-edit-diff-function
- . ,(if vc-patch-string 'log-edit-diff-patch 'log-edit-diff-fileset))
+ . ,(cond (diff-function)
+ (vc-patch-string #'log-edit-diff-patch)
+ (t #'log-edit-diff-fileset)))
(log-edit-vc-backend . ,backend)
(vc-log-fileset . ,fileset)
(vc-patch-string . ,vc-patch-string))
(set-buffer-modified-p nil)
(setq buffer-file-name nil))
-(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend patch-string)
+(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend patch-string diff-function)
"Accept a comment for an operation on FILES.
If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the
action on close to ACTION. If COMMENT is a string and
MODE, defaulting to `log-edit-mode' if MODE is nil.
AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'.
BACKEND, if non-nil, specifies a VC backend for the Log Edit buffer.
-PATCH-STRING is a patch to check in."
+PATCH-STRING is a patch to check in.
+DIFF-FUNCTION is `log-edit-diff-function' for the Log Edit buffer."
(let ((parent (if (and (length= files 1)
(not (vc-dispatcher-browsing)))
(get-file-buffer (car files))
(concat " from " (buffer-name vc-parent-buffer)))
(when patch-string
(setq-local vc-patch-string patch-string))
- (vc-log-edit files mode backend)
+ (vc-log-edit files mode backend diff-function)
(make-local-variable 'vc-log-after-operation-hook)
(when after-hook
(setq vc-log-after-operation-hook after-hook))
;; So refresh the view.
(when (derived-mode-p 'log-view-mode)
(revert-buffer)))
- nil backend)))
+ nil backend nil
+ (lambda ()
+ ;; Here we want the root diff for REV, even if we were called
+ ;; from a buffer generated by C-x v l, because the change comment
+ ;; we will edit applies to the whole revision.
+ (let* ((rootdir
+ (vc-call-backend backend 'root default-directory))
+ (prevrev
+ (vc-call-backend backend
+ 'previous-revision rootdir rev)))
+ (vc-diff-internal nil (list backend (list rootdir))
+ prevrev rev))))))
;;;###autoload
(defun vc-merge ()