changeset 9044:5ddb0e0adb08

(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 <file>" instead of just the file name in the Subject of the notification message.
author Richard M. Stallman <rms@gnu.org>
date Sat, 24 Sep 1994 00:58:07 +0000
parents 2939606b8ef5
children 989c8e13c115
files lisp/vc.el
diffstat 1 files changed, 34 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc.el	Sat Sep 24 00:37:07 1994 +0000
+++ b/lisp/vc.el	Sat Sep 24 00:58:07 1994 +0000
@@ -584,24 +584,28 @@
 
 (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 @@
 	(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 @@
 	       (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 @@
 	       (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