+2007-12-27 Eric S. Raymond <esr@snark.thyrsus.com>
+
+ * (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
+ machinery in place to support editing of change comments
+ with 'e' in a log-view buffer. Not documented yet as this
+ only works for SCCS, RCS, and maybe CVS if you have admin
+ privileges. When we have backend support for Subversion and
+ more modern systems it will ve time to write this up.
+
2007-12-27 Kenichi Handa <handa@ni.aist.go.jp>
* international/mule-cmds.el (select-safe-coding-system): When a
'(("q" . quit-window)
("z" . kill-this-buffer)
("m" . log-view-toggle-mark-entry)
- ;; ("e" . cvs-mode-edit-log)
+ ("e" . log-view-modify-change-comment)
("d" . log-view-diff)
("a" . log-view-annotate-version)
("f" . log-view-find-revision)
(switch-to-buffer (vc-find-revision (log-view-current-file)
(log-view-current-tag)))))
+
+(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))
+ (log-view-beginning-of-defun)
+ (cond ((memq backend '(SCCS RCS CVS MCVS SVN))
+ (forward-line 2))
+ ((eq backend 'Hg)
+ (forward-line 4)
+ (re-search-forward "summary: *" nil t)))
+ (setq st (point))
+ (buffer-substring st en))))
+
+(defun log-view-modify-change-comment ()
+ "Edit the change comment displayed at point."
+ (interactive)
+ (vc-modify-change-comment (list (log-view-current-file))
+ (log-view-current-tag)
+ (log-view-extract-comment)))
+
(defun log-view-annotate-version (pos)
"Annotate the version at point."
(interactive "d")
(error "Couldn't analyze cvs update result")))
(message "Merging changes into %s...done" file))))
+(defun vc-cvs-modify-change-comment (files rev comment)
+ "Modify the change comments for FILES on a specified REV.
+Will fail unless you have administrative privileges on the repo."
+ (vc-cvs-command nil 0 files "rcs" (concat "-m" comment ":" rev)))
;;;
;;; History functions
(error "Couldn't analyze mcvs update result")))
(message "Merging changes into %s...done" file))))
+(defun vc-mcvs-modify-change-comment (files rev comment)
+ "Modify the change comments for FILES on a specified REV.
+Will fail unless you have administrative privileges on the repo."
+ (vc-mcvs-command nil 0 files "rcs" (concat "-m" comment ":" rev)))
+
+
;;;
;;; History functions
;;;
;; expanded headers.
(vc-do-command nil 0 "co" (vc-name file) "-f" (concat "-l" rev)))
+(defun vc-rcs-modify-change-comment (files rev comment)
+ "Modify the change comments change on FILES on a specified REV."
+ (dolist (file files)
+ (vc-do-command nil 0 "rcs" (vc-name file)
+ (concat "-m" comment ":" rev))))
\f
;;;
(vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev)))
(vc-do-command nil 0 "get" (vc-name file) "-g" (if rev (concat "-r" rev))))
+(defun vc-sccs-modify-change-comment (files rev comment)
+ "Modify (actually, append to) the change comments for FILES on a specified REV."
+ (dolist (file files)
+ (vc-do-command nil 0 "cdc" (vc-name file)
+ (concat "-y" comment) (concat "-r" rev))))
+
\f
;;;
;;; History functions
;; used for files under this backend, and if files can indeed be
;; locked by other users.
;;
+;; - modify-change-comment (files rev comment)
+;;
+;; Modify the change comments associated with the files at the
+;; given revision. This is optional, many backends do not support it.
+;;
;; HISTORY FUNCTIONS
;;
;; * print-log (files &optional buffer)
(vc-call-backend backend 'clear-headers)
(kill-buffer filename)))))
+(defun vc-modify-change-comment (files rev oldcomment)
+ "Edit the comment associated with the given files and revision."
+ (vc-start-entry
+ files rev oldcomment t
+ "Enter a replacement change comment."
+ (lambda (files rev comment)
+ (vc-call-backend
+ ;; 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.
+ (vc-responsible-backend (car files))
+ 'modify-change-comment files rev comment))))
+
;;;###autoload
(defun vc-merge ()
"Merge changes between two revisions into the current buffer's file.