gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vc.el - Implementation of cvs admin -mrev:message file


From: Sandip Chitale
Subject: vc.el - Implementation of cvs admin -mrev:message file
Date: Sat, 14 Aug 2004 07:17:54 GMT

The CVS admin -m command allows updating of checkin comments of any version.
The following implements that functionality.

I would like to use completing-read to read the REV number? Anyone know how to 
do it?

(require 'vc)
(require 'vc-cvs)

;;; This could go in vc.el
;;;###autoload
(defun vc-version-update-comment (rev)
  "Update the comment for version REV of the current file."
  (interactive "sVersion to update comments of (default is workfile version): ")
  (vc-ensure-vc-buffer)
  (let* ((file buffer-file-name)
  (version (if (string-equal rev "")
        (vc-workfile-version file)
        rev)))
    (vc-start-entry
     file rev nil nil
     "Enter a change comment."
     (lambda (file rev comment)
       (message "Checking in %s..." file)
       ;; "This log message intentionally left almost blank".
       ;; RCS 5.7 gripes about white-space-only comments too.
       (or (and comment (string-match "[^\t\n ]" comment))
    (setq comment "*** empty log message ***"))
 ;; Change buffers to get local value of vc-checkin-switches.
 (with-current-buffer (or (get-file-buffer file) (current-buffer))
   (progn
     (vc-call version-update-comment file rev comment)
     )))
     nil)))

;;; This could go in vc-cvs.el
(defun vc-cvs-version-update-comment (file rev comment)
  "CVS-specific version of `vc-version-update-comment'."
  (let (switches
 status)
    (message "Setting comment for REV %s of File %s to:\n%s" rev file comment)
    (setq status (apply 'vc-do-command nil 1 "cvs" file
   "admin"
   (concat "-m" rev ":" comment)
   switches))
    (set-buffer "*vc*")
    (goto-char (point-min))
    (when (not (zerop status))
      ;; Check checkin problem.
      (cond
       ((re-search-forward "Up-to-date check failed" nil t)
        (vc-file-setprop file 'vc-state 'needs-merge)
        (error (substitute-command-keys
                (concat "Up-to-date check failed: "
                        "type \\[vc-next-action] to merge in changes"))))
       (t
        (pop-to-buffer (current-buffer))
        (goto-char (point-min))
        (shrink-window-if-larger-than-buffer)
        (error "Check-in failed"))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]