Function: cvs-do-removal

cvs-do-removal is a byte-compiled function defined in pcvs.el.gz.

Signature

(cvs-do-removal FILTER &optional CMD ALL)

Documentation

Remove files.

Returns a list of FIS that should be cvs removed.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/pcvs.el.gz
(defun cvs-do-removal (filter &optional cmd all)
  "Remove files.
Returns a list of FIS that should be `cvs remove'd."
  (let* ((files (cvs-mode-marked filter cmd :file t :read-only t))
	 (fis (cdr (cvs-partition (lambda (fi)
				    (eq (cvs-fileinfo->type fi) 'UNKNOWN))
				  (cvs-mode-marked filter cmd))))
	 (silent (or (not cvs-confirm-removals)
		     (cl-every (lambda (fi)
				 (or (not (file-exists-p
					   (cvs-fileinfo->full-name fi)))
				     (cvs-applicable-p fi 'safe-rm)))
			       files)))
	 (tmpbuf (cvs-temp-buffer)))
    (when (and (not silent) (equal cvs-confirm-removals 'list))
      (with-current-buffer tmpbuf
	(let ((inhibit-read-only t))
	  (cvs-insert-strings (mapcar 'cvs-fileinfo->full-name fis))
	  (cvs-pop-to-buffer-same-frame (current-buffer))
	  (shrink-window-if-larger-than-buffer))))
    (if (not (or silent
		 (unwind-protect
		     (yes-or-no-p
		      (let ((nfiles (length files))
			    (verb (if (eq filter 'undo) "Undo" "Delete")))
			(if (= 1 nfiles)
			    (format "%s file: \"%s\" ? "
				    verb
				    (cvs-fileinfo->file (car files)))
			  (format "%s %d files? "
				  verb
				  nfiles))))
		   (cvs-bury-buffer tmpbuf cvs-buffer))))
	(progn (message "Aborting") nil)
      (dolist (fi files)
	(let* ((type (cvs-fileinfo->type fi))
	       (file (cvs-fileinfo->full-name fi)))
	  (when (or all (eq type 'UNKNOWN))
	    (when (file-exists-p file) (delete-file file))
	    (unless all (setf (cvs-fileinfo->type fi) 'DEAD) t))))
      fis)))