]> git.eshelyaron.com Git - emacs.git/commitdiff
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
authorEric S. Raymond <esr@snark.thyrsus.com>
Thu, 27 Dec 2007 11:26:27 +0000 (11:26 +0000)
committerEric S. Raymond <esr@snark.thyrsus.com>
Thu, 27 Dec 2007 11:26:27 +0000 (11:26 +0000)
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.

lisp/ChangeLog
lisp/log-view.el
lisp/vc-cvs.el
lisp/vc-mcvs.el
lisp/vc-rcs.el
lisp/vc-sccs.el
lisp/vc.el

index 0de84114ed5140fba961f40dbc301d2082f60ff7..f9ae2f491589faa4ef37049702a716362e8ef907 100644 (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
index ceda42eb6874ef7870b93d14a25a829d03854ad3..d14b33262cc96eb4bad903a4360cdb3f44fe7c0a 100644 (file)
   '(("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")
index 337170ab8963fdcaf1ef809d8ee6ca9887498211..cdb3aae802021b25c7a57de8ea499fd136ea35e2 100644 (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
index 70d502c7670a40ca6a4c2aaf49d5fc9ce8fe7c07..ba0ccf47747070b57dc19ecb96fe2eea4336dc99 100644 (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
 ;;;
index 35eba607bea3c98caa46e887b9b5c08de32d4404..a092a91e918505abe945b3e8a985e9c0484f12a3 100644 (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))))
 
 \f
 ;;;
index 06fcff3ceb5860d726fae5239f1cb91c8fbfca04..749ec83a196aba78e5552588b8c7f65d5565e42c 100644 (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))))
+
 \f
 ;;;
 ;;; History functions
index d8c99b251086cb45165ab6befca0ec6dddf5f834..3d1132aab77ad9da5fb2e811c59e22f1da8b6296 100644 (file)
 ;;   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.