Function: vc-cvs-diff

vc-cvs-diff is a byte-compiled function defined in vc-cvs.el.gz.

Signature

(vc-cvs-diff FILES &optional OLDVERS NEWVERS BUFFER ASYNC)

Documentation

Get a difference report using CVS between two revisions of FILE.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-cvs.el.gz
(defun vc-cvs-diff (files &optional oldvers newvers buffer async)
  "Get a difference report using CVS between two revisions of FILE."
  (let* (process-file-side-effects
	 (async (and async (vc-cvs-stay-local-p files)))
	 (invoke-cvs-diff-list nil)
	 status)
    ;; Look through the file list and see if any files have backups
    ;; that can be used to do a plain "diff" instead of "cvs diff".
    (dolist (file files)
      (let ((ov oldvers)
	    (nv newvers))
	(when (or (not ov) (string-equal ov ""))
	  (setq ov (vc-working-revision file)))
	(when (string-equal nv "")
	  (setq nv nil))
	(let ((file-oldvers (vc-version-backup-file file ov))
	      (file-newvers (if (not nv)
				file
			      (vc-version-backup-file file nv)))
	      (coding-system-for-read (vc-coding-system-for-diff file)))
	  (if (and file-oldvers file-newvers)
	      (progn
		;; This used to append diff-switches and vc-diff-switches,
		;; which was consistent with the vc-diff-switches doc at that
		;; time, but not with the actual behavior of any other VC diff.
		(apply #'vc-do-command (or buffer "*vc-diff*") 1 "diff" nil
		       ;; Not a CVS diff, does not use vc-cvs-diff-switches.
		       (append (vc-switches nil 'diff)
			       (list (file-relative-name file-oldvers)
				     (file-relative-name file-newvers))))
		(setq status 0))
	    (push file invoke-cvs-diff-list)))))
    (when invoke-cvs-diff-list
      (setq status (apply #'vc-cvs-command (or buffer "*vc-diff*")
			  (if async 'async 1)
			  invoke-cvs-diff-list "diff"
			  (and oldvers (concat "-r" oldvers))
			  (and newvers (concat "-r" newvers))
			  (vc-switches 'CVS 'diff))))
    (if async 1 status))) ; async diff, pessimistic assumption