Function: vc-modify-change-comment

vc-modify-change-comment is a byte-compiled function defined in vc.el.gz.

Signature

(vc-modify-change-comment FILES REV OLDCOMMENT)

Documentation

Edit the comment associated with the given files and revision.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc-modify-change-comment (files rev oldcomment)
  "Edit the comment associated with the given files and revision."
  ;; Less of a kluge than it looks like; log-view mode only passes
  ;; this function a singleton list.  Arguments left in this form in
  ;; case the more general operation ever becomes meaningful.
  (let ((backend (vc-responsible-backend (car files))))
    (vc-start-logentry
     files oldcomment t
     "Enter a replacement change comment."
     "*vc-log*"
     (lambda () (vc-call-backend backend 'log-edit-mode))
     (lambda (files comment)
       (vc-call-backend backend
                        'modify-change-comment files rev comment)
       ;; We are now back in `vc-parent-buffer'.
       ;; If this is Log View, then revision IDs might now be
       ;; out-of-date, which could be hazardous if the user immediately
       ;; tries to use `log-view-modify-change-comment' a second time.
       ;; E.g. with Git, `vc-git-modify-change-comment' could create an
       ;; "amend!" commit referring to a commit which no longer exists
       ;; on the branch, such that it wouldn't be autosquashed.
       ;; So refresh the view.
       (when (derived-mode-p 'log-view-mode)
         (revert-buffer)))
     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))))))