From 29fc1ce99358a577c8c0fde7eaebc0f2958166b6 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 24 Sep 1994 00:58:07 +0000 Subject: [PATCH] (vc-backend-checkout): Add if-statements to the shell cmds to discard the extra arg some shells make. (vc-rename-file): Add autoload cookie. (vc-steal-lock): (1) Function should be non-interactive, because it doesn't work when called directly by the user. (2) Don't display revision "nil" when stealing lock if revision is unknown. (3) Put "Stolen lock on " instead of just the file name in the Subject of the notification message. --- lisp/vc.el | 54 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/lisp/vc.el b/lisp/vc.el index 11602b8d502..77101d1615d 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -584,24 +584,28 @@ level to check it in under. COMMENT, if specified, is the checkin comment." (defun vc-steal-lock (file rev &optional owner) "Steal the lock on the current workfile." - (interactive) - (if (not owner) - (setq owner (vc-locking-user file))) - (if (not (y-or-n-p (format "Take the lock on %s:%s from %s? " file rev owner))) - (error "Steal cancelled")) - (pop-to-buffer (get-buffer-create "*VC-mail*")) - (setq default-directory (expand-file-name "~/")) - (auto-save-mode auto-save-default) - (mail-mode) - (erase-buffer) - (mail-setup owner (format "%s:%s" file rev) nil nil nil - (list (list 'vc-finish-steal file rev))) - (goto-char (point-max)) - (insert - (format "I stole the lock on %s:%s, " file rev) - (current-time-string) - ".\n") - (message "Please explain why you stole the lock. Type C-c C-c when done.")) + (let (file-description) + (if (not owner) + (setq owner (vc-locking-user file))) + (if rev + (setq file-description (format "%s:%s" file rev)) + (setq file-description file)) + (if (not (y-or-n-p (format "Take the lock on %s from %s? " + file-description owner))) + (error "Steal cancelled")) + (pop-to-buffer (get-buffer-create "*VC-mail*")) + (setq default-directory (expand-file-name "~/")) + (auto-save-mode auto-save-default) + (mail-mode) + (erase-buffer) + (mail-setup owner (format "Stolen lock on %s" file-description) nil nil nil + (list (list 'vc-finish-steal file rev configuration))) + (goto-char (point-max)) + (insert + (format "I stole the lock on %s, " file-description) + (current-time-string) + ".\n") + (message "Please explain why you stole the lock. Type C-c C-c when done."))) ;; This is called when the notification has been sent. (defun vc-finish-steal (file version) @@ -1183,6 +1187,7 @@ A prefix argument means do not revert the buffer afterwards." (vc-checkout (buffer-file-name) nil))) )) +;;;###autoload (defun vc-rename-file (old new) "Rename file OLD to NEW, and rename its master file likewise." (interactive "fVC rename file: \nFRename to: ") @@ -1541,7 +1546,13 @@ Return nil if there is no such person." (progn (vc-do-command 0 "/bin/sh" file "-c" - (format "umask %o; exec >\"$1\" || exit; shift; umask %o; exec get \"$@\"" + ;; Some shells make the "" dummy argument into $0 + ;; while others use the shell's name as $0 and + ;; use the "" as $1. The if-statement + ;; converts the latter case to the former. + (format "if [ x\"$1\" = x ]; then shift; fi; \ + umask %o; exec >\"$1\" || exit; \ + shift; umask %o; exec get \"$@\"" (logand 511 (lognot vc-modes)) (logand 511 (lognot (default-file-modes)))) "" ; dummy argument for shell's $0 @@ -1563,7 +1574,10 @@ Return nil if there is no such person." (progn (vc-do-command 0 "/bin/sh" file "-c" - (format "umask %o; exec >\"$1\" || exit; shift; umask %o; exec co \"$@\"" + ;; See the SCCS case, above, regarding the if-statement. + (format "if [ x\"$1\" = x ]; then shift; fi; \ + umask %o; exec >\"$1\" || exit; \ + shift; umask %o; exec co \"$@\"" (logand 511 (lognot vc-modes)) (logand 511 (lognot (default-file-modes)))) "" ; dummy argument for shell's $0 -- 2.39.5