;; Maintainer: (Stefan Monnier) monnier+lists/cvs/pcl@flint.cs.yale.edu
;; Keywords: CVS, version control, release management
;; Version: $Name: $
-;; Revision: $Id: pcvs.el,v 1.3 2000/05/10 22:28:36 monnier Exp $
+;; Revision: $Id: pcvs.el,v 1.4 2000/06/12 04:48:35 monnier Exp $
;; This file is part of GNU Emacs.
;;; Todo:
;; ******** FIX THE DOCUMENTATION *********
-;;
+;;
;; - proper `g' that passes safe args and uses either cvs-status or cvs-examine
;; - add toolbar entries
;; - marking
;;; Code:
-(eval-when-compile (require 'cl))
+(require 'cl)
(require 'ewoc) ;Ewoc was once cookie
(require 'pcvs-defs)
(require 'pcvs-util)
(defvar cvs-from-vc nil "Bound to t inside VC advice.")
-;;;;
+;;;;
;;;; flags variables
-;;;;
+;;;;
(defun cvs-defaults (&rest defs)
(let ((defs (cvs-first defs cvs-shared-start)))
"Mode-line control for displaying info on cvs process status.")
-;;;;
+;;;;
;;;; Query-Type-Descriptor for Tags
-;;;;
+;;;;
(autoload 'cvs-status-get-tags "cvs-status")
(defun cvs-tags-list ()
(defconst cvs-qtypedesc-tag
(cvs-qtypedesc-create 'identity 'identity 'cvs-tags-list 'cvs-tag-history))
-;;;;
+;;;;
(defun cvs-mode! (&optional -cvs-mode!-fun -cvs-mode!-noerror)
"Switch to the *cvs* buffer.
;; the selected window has not been changed by FUN
(select-window cvs-mode!-owin)))))))
-;;;;
+;;;;
;;;; Prefixes
-;;;;
+;;;;
(defvar cvs-branches (list cvs-vendor-branch "HEAD" "HEAD"))
(cvs-prefix-define cvs-branch-prefix
(cvs-prefix-get 'cvs-secondary-branch-prefix))))
(if branch (cons (concat (or arg "-r") branch) flags) flags)))
-;;;;
+;;;;
(define-minor-mode
cvs-minor-mode
(set (make-local-variable 'cvs-temp-buffer)
(cvs-get-buffer-create
(eval cvs-temp-buffer-name) 'noreuse))))))
-
+
;; handle the potential pre-existing process
(let ((proc (get-buffer-process buf)))
(when (and (not normal) (processp proc)
(let ((procbuf (current-buffer))
(cvsbuf cvs-buffer)
(single-dir (or single-dir (eq cvs-execute-single-dir t))))
-
+
(set-buffer procbuf)
(goto-char (point-max))
(unless (bolp) (let ((inhibit-read-only t)) (insert "\n")))
(dir (first dir+files+rest))
(files (second dir+files+rest))
(rest (third dir+files+rest)))
-
+
;; setup the (current) process buffer
(set (make-local-variable 'cvs-postprocess)
(if (null rest)
(set-process-filter process 'cvs-update-filter)
(set-marker (process-mark process) (point-max))
(ignore-errors (process-send-eof process)) ;close its stdin to avoid hangs
-
+
;; now finish setting up the cvs-buffer
(set-buffer cvsbuf)
(setq cvs-mode-line-process (symbol-name (process-status process)))
;; keep the rest
(t (not (run-hook-with-args-until-success
'cvs-cleanup-functions fi))))))
-
+
;; mark dirs for removal
(when (and keep rm-dirs
(eq (cvs-fileinfo->type last-fi) 'DIRCHANGE)
:noexist t))
\f
-;;;;
+;;;;
;;;; The code for running a "cvs update" and friends in various ways.
-;;;;
+;;;;
(defun-cvs-mode (cvs-mode-revert-buffer . SIMPLE)
(&optional ignore-auto noconfirm)
(cvs-create-fileinfo
'MESSAGE "" " "
(concat msg
- (substitute-command-keys
+ (substitute-command-keys
"\n\t(type \\[cvs-mode-delete-lock] to delete it)"))
:subtype 'TEMP))
(pop-to-buffer (current-buffer))
(interactive "p")
(ewoc-goto-next cvs-cookies (point) arg))
-;;;;
+;;;;
;;;; Mark handling
-;;;;
+;;;;
(defun-cvs-mode cvs-mode-mark (&optional arg)
"Mark the fileinfo on the current line.
(lambda (obj) (caar (member* obj cvs-ignore-marks-alternatives :key 'cdr)))
(lambda () cvs-ignore-marks-alternatives)
nil t))
-
+
(defun-cvs-mode cvs-mode-toggle-marks (arg)
"Toggle whether the next CVS command uses marks.
See `cvs-prefix-set' for further description of the behavior.
\\[universal-argument] 3 selects `toggle-marks'."
(interactive "P")
(cvs-prefix-set 'cvs-ignore-marks-modif arg))
-
+
(defun cvs-ignore-marks-p (cmd &optional read-only)
(let ((default (if (member cmd cvs-invert-ignore-marks)
(not cvs-default-ignore-marks)
(ewoc-collect cvs-cookies
'cvs-fileinfo->marked))
(list (ewoc-data (ewoc-locate cvs-cookies (point)))))))
-
+
(if (or ignore-contents (not (eq (cvs-fileinfo->type fi) 'DIRCHANGE)))
(push fi fis)
;; If a directory is selected, return members, if any.
(defun cvs-do-commit (flags)
"Do the actual commit, using the current buffer as the log message."
(interactive (list (cvs-flags-query 'cvs-commit-flags "cvs commit flags")))
- (let ((msg (buffer-string)))
+ (let ((msg (buffer-substring-no-properties (point-min) (point-max))))
(cvs-mode!)
;;(pop-to-buffer cvs-buffer)
(cvs-mode-do "commit" (list* "-m" msg flags) 'commit)))
-;;;;
+;;;;
;;;; CVS Mode commands
-;;;;
+;;;;
(defun-cvs-mode (cvs-mode-insert . NOARGS) (file)
"Insert an entry for a specific file."
;;
;; Ediff support
-;;
+;;
(defvar ediff-after-quit-destination-buffer)
(defvar cvs-transient-buffers)
(cvs-flags-query 'cvs-tag-flags "tag flags")))
(cvs-mode-do "tag" (append '("-d") flags (list tag))
(when cvs-force-dir-tag 'tag)))
-
+
;; Byte compile files.
(default-directory (cvs-expand-dir-name cur-dir))
(inhibit-read-only t)
(arg-list (funcall extractor fi)))
-
+
;; Execute the command unless extractor returned t.
(when (listp arg-list)
(let* ((args (append constant-args arg-list)))
-
+
(insert (format "=== cd %s\n=== %s %s\n\n"
cur-dir program (cvs-strings->string args)))
-
+
;; FIXME: return the exit status?
(apply 'call-process program nil t t args)
(goto-char (point-max))))))