Function: cvs-vc-command-advice

cvs-vc-command-advice is a byte-compiled function defined in pcvs.el.gz.

Signature

(cvs-vc-command-advice COMMAND FILES FLAGS)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/pcvs.el.gz
(defun cvs-vc-command-advice (command files flags)
  (when (and (equal command "cvs")
	     (progn
	       (while (and (stringp (car flags))
			   (string-match "\\`-" (car flags)))
		 (pop flags))
	       ;; don't parse output we don't understand.
	       (member (car flags) cvs-parse-known-commands))
	     ;; Don't parse "update -p" output.
	     (not (and (member (car flags) '("update" "checkout"))
		       (let ((found-p nil))
			 (dolist (flag flags found-p)
			   (if (equal flag "-p") (setq found-p t)))))))
    (save-current-buffer
      (let ((buffer (current-buffer))
	    (dir default-directory)
	    (cvs-from-vc t))
	(dolist (cvs-buf (buffer-list))
	  (set-buffer cvs-buf)
	  ;; look for a corresponding pcl-cvs buffer
	  (when (and (eq major-mode 'cvs-mode)
		     (string-prefix-p default-directory dir))
	    (let ((subdir (substring dir (length default-directory))))
	      (set-buffer buffer)
              (setq-local cvs-buffer cvs-buf)
	      ;; `cvs -q add file' produces no useful output :-(
	      (when (and (equal (car flags) "add")
			 (goto-char (point-min))
			 (looking-at ".*to add this file permanently\n\\'"))
                (dolist (file (if (listp files) files (list files)))
                  (insert (format-message
			   "cvs add: scheduling file `%s' for addition\n"
			   (file-name-nondirectory file)))))
	      ;; VC never (?) does `cvs -n update' so dcd=nil
	      ;; should probably always be the right choice.
	      (cvs-parse-process nil subdir))))))))