Function: vc-rcs-steal-lock

vc-rcs-steal-lock is a byte-compiled function defined in vc-rcs.el.gz.

Signature

(vc-rcs-steal-lock FILE &optional REV)

Documentation

Steal the lock on the current workfile for FILE and revision REV.

If FILE is a directory, steal the lock on all registered files beneath it. Needs RCS 5.6.2 or later for -M.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-rcs.el.gz
(defun vc-rcs-steal-lock (file &optional rev)
  "Steal the lock on the current workfile for FILE and revision REV.
If FILE is a directory, steal the lock on all registered files beneath it.
Needs RCS 5.6.2 or later for -M."
  (if (file-directory-p file)
      (mapc #'vc-rcs-steal-lock (vc-expand-dirs (list file) 'RCS))
    (vc-do-command "*vc*" 0 "rcs" (vc-master-name file) "-M" (concat "-u" rev))
    ;; Do a real checkout after stealing the lock, so that we see
    ;; expanded headers.
    (vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f" (concat "-l" rev))
    ;; Must clear any headers here because they wouldn't
    ;; show that the file is locked now.
    (let* ((filename (or file buffer-file-name))
	   (visited (find-buffer-visiting filename)))
      (if visited
	  (let ((context (vc-buffer-context)))
	    ;; save-excursion may be able to relocate point and mark
	    ;; properly.  If it fails, vc-restore-buffer-context
	    ;; will give it a second try.
	    (save-excursion
	      (vc-rcs-clear-headers))
	    (vc-restore-buffer-context context))
	(set-buffer (find-file-noselect filename))
	(vc-rcs-clear-headers)
	(kill-buffer filename)))))