Function: vc-sccs-diff
vc-sccs-diff is a byte-compiled function defined in vc-sccs.el.gz.
Signature
(vc-sccs-diff FILES &optional OLDVERS NEWVERS BUFFER ASYNC)
Documentation
Get a difference report using SCCS between two filesets.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-sccs.el.gz
;; FIXME use sccsdiff if present?
(defun vc-sccs-diff (files &optional oldvers newvers buffer _async)
"Get a difference report using SCCS between two filesets."
(setq files (vc-expand-dirs files 'SCCS))
(setq oldvers (vc-sccs-lookup-triple (car files) oldvers))
(setq newvers (vc-sccs-lookup-triple (car files) newvers))
(or buffer (setq buffer "*vc-diff*"))
;; We have to reimplement pieces of vc-do-command, because
;; we want to run multiple external commands, and only do the setup
;; and exit pieces once.
(save-current-buffer
(unless (or (eq buffer t)
(and (stringp buffer) (string= (buffer-name) buffer))
(eq buffer (current-buffer)))
(vc-setup-buffer buffer))
(let* ((fake-flags (append (vc-switches 'SCCS 'diff)
(if oldvers (list (concat " -r" oldvers)))
(if newvers (list (concat " -r" newvers)))))
(fake-command
(format "diff%s %s"
(if fake-flags
(concat " " (mapconcat #'identity fake-flags " "))
"")
(vc-delistify files)))
(status 0)
(oldproc (get-buffer-process (current-buffer))))
(when vc-command-messages
(message "Running %s in foreground..." fake-command))
(if oldproc (delete-process oldproc))
(dolist (file files)
(let ((oldfile (make-nearby-temp-file "vc-sccs"))
newfile)
(unwind-protect
(progn
(vc-sccs-write-revision file oldfile oldvers)
(if newvers
(vc-sccs-write-revision file (setq newfile
(make-temp-file "vc-sccs"))
newvers))
(let* ((inhibit-read-only t)
(buffer-undo-list t)
(process-environment
(cons "LC_MESSAGES=C" process-environment))
(w32-quote-process-args t)
(this-status
(apply #'process-file "diff" nil t nil
(append (vc-switches 'SCCS 'diff)
(list (file-local-name oldfile)
(or newfile
(file-relative-name file)))))))
(or (integerp this-status) (setq status 'error))
(and (integerp status)
(> this-status status)
(setq status this-status))))
(delete-file oldfile)
(if newfile (delete-file newfile)))))
(when (or (not (integerp status)) (> status 1))
(unless (eq ?\s (aref (buffer-name (current-buffer)) 0))
(pop-to-buffer (current-buffer))
(goto-char (point-min))
(shrink-window-if-larger-than-buffer))
(error "Running %s...FAILED (%s)" fake-command
(if (integerp status) (format "status %d" status) status)))
(when vc-command-messages
(message "Running %s...OK = %d" fake-command status))
;; Should we pretend we ran sccsdiff instead?
;; This might not actually be a valid diff command.
(run-hook-with-args 'vc-post-command-functions "diff" files fake-flags)
status)))