* (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.
This commit is contained in:
Eric S. Raymond
2007-12-27 11:26:27 +00:00
parent 86c3a9fbd9
commit 9b64a7f0cf
7 changed files with 74 additions and 1 deletions

View File

@@ -1,3 +1,12 @@
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

View File

@@ -128,7 +128,7 @@
'(("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)
@@ -411,6 +411,31 @@ log entries."
(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")

View File

@@ -494,6 +494,10 @@ The changes are between FIRST-REVISION and SECOND-REVISION."
(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

View File

@@ -432,6 +432,12 @@ The changes are between FIRST-REVISION and SECOND-REVISION."
(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
;;;

View File

@@ -510,6 +510,11 @@ Needs RCS 5.6.2 or later for -M."
;; 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))))
;;;

View File

@@ -285,6 +285,12 @@ locked. REV is the revision to check out."
(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))))
;;;
;;; History functions

View File

@@ -318,6 +318,11 @@
;; 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)
@@ -2137,6 +2142,19 @@ The headers are reset to their non-expanded form."
(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.