diff options
| -rw-r--r-- | lisp/vc.el | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index 60789073cc0..3e0f41f7005 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -49,7 +49,7 @@ | |||
| 49 | ;; | 49 | ;; |
| 50 | ;; The vc code maintains some internal state in order to reduce expensive | 50 | ;; The vc code maintains some internal state in order to reduce expensive |
| 51 | ;; version-control operations to a minimum. Some names are only computed | 51 | ;; version-control operations to a minimum. Some names are only computed |
| 52 | ;; once. If you perform version control operations with RCS/SCCS/CVS while | 52 | ;; once. If you perform version control operations with RCS/SCCS/CVS while |
| 53 | ;; vc's back is turned, or move/rename master files while vc is running, | 53 | ;; vc's back is turned, or move/rename master files while vc is running, |
| 54 | ;; vc may get seriously confused. Don't do these things! | 54 | ;; vc may get seriously confused. Don't do these things! |
| 55 | ;; | 55 | ;; |
| @@ -75,7 +75,7 @@ | |||
| 75 | "*Back-end actually used by this interface; may be SCCS or RCS. | 75 | "*Back-end actually used by this interface; may be SCCS or RCS. |
| 76 | The value is only computed when needed to avoid an expensive search.") | 76 | The value is only computed when needed to avoid an expensive search.") |
| 77 | (defvar vc-suppress-confirm nil | 77 | (defvar vc-suppress-confirm nil |
| 78 | "*If non-nil, reat user as expert; suppress yes-no prompts on some things.") | 78 | "*If non-nil, treat user as expert; suppress yes-no prompts on some things.") |
| 79 | (defvar vc-keep-workfiles t | 79 | (defvar vc-keep-workfiles t |
| 80 | "*If non-nil, don't delete working files after registering changes.") | 80 | "*If non-nil, don't delete working files after registering changes.") |
| 81 | (defvar vc-initial-comment nil | 81 | (defvar vc-initial-comment nil |
| @@ -96,19 +96,19 @@ The value is only computed when needed to avoid an expensive search.") | |||
| 96 | 96 | ||
| 97 | ;;;###autoload | 97 | ;;;###autoload |
| 98 | (defvar vc-checkin-hook nil | 98 | (defvar vc-checkin-hook nil |
| 99 | "*List of functions called after a vc-checkin is done. See `run-hooks'.") | 99 | "*List of functions called after a checkin is done. See `run-hooks'.") |
| 100 | 100 | ||
| 101 | ;; Header-insertion hair | 101 | ;; Header-insertion hair |
| 102 | 102 | ||
| 103 | (defvar vc-header-alist | 103 | (defvar vc-header-alist |
| 104 | '((SCCS "\%W\%") (RCS "\$Id\$")) | 104 | '((SCCS "\%W\%") (RCS "\$Id\$")) |
| 105 | "*Header keywords to be inserted when vc-insert-header is executed.") | 105 | "*Header keywords to be inserted when `vc-insert-header' is executed.") |
| 106 | (defconst vc-static-header-alist | 106 | (defconst vc-static-header-alist |
| 107 | '(("\\.c$" . | 107 | '(("\\.c$" . |
| 108 | "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n#endif /* lint */\n")) | 108 | "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n#endif /* lint */\n")) |
| 109 | "*Associate static header string templates with file types. A \%s in the | 109 | "*Associate static header string templates with file types. A \%s in the |
| 110 | template is replaced with the first string associated with the file's | 110 | template is replaced with the first string associated with the file's |
| 111 | verson-control type in vc-header-alist.") | 111 | version-control type in `vc-header-alist'.") |
| 112 | 112 | ||
| 113 | (defvar vc-comment-alist | 113 | (defvar vc-comment-alist |
| 114 | '((nroff-mode ".\\\"" "")) | 114 | '((nroff-mode ".\\\"" "")) |
| @@ -121,7 +121,7 @@ is sensitive to blank lines.") | |||
| 121 | (defvar vc-log-entry-mode nil) | 121 | (defvar vc-log-entry-mode nil) |
| 122 | (defvar vc-log-operation nil) | 122 | (defvar vc-log-operation nil) |
| 123 | (defvar vc-log-after-operation-hook nil) | 123 | (defvar vc-log-after-operation-hook nil) |
| 124 | (defvar vc-checkout-writeable-buffer-hook 'vc-checkout-writeable-buffer) | 124 | (defvar vc-checkout-writable-buffer-hook 'vc-checkout-writable-buffer) |
| 125 | (defvar vc-parent-buffer nil) | 125 | (defvar vc-parent-buffer nil) |
| 126 | (defvar vc-parent-buffer-name nil) | 126 | (defvar vc-parent-buffer-name nil) |
| 127 | 127 | ||
| @@ -154,7 +154,7 @@ is sensitive to blank lines.") | |||
| 154 | ;; Random helper functions | 154 | ;; Random helper functions |
| 155 | 155 | ||
| 156 | (defun vc-name (file) | 156 | (defun vc-name (file) |
| 157 | "Return the master name of a file, nil if it is not registered" | 157 | "Return the master name of a file, nil if it is not registered." |
| 158 | (or (vc-file-getprop file 'vc-name) | 158 | (or (vc-file-getprop file 'vc-name) |
| 159 | (vc-file-setprop file 'vc-name | 159 | (vc-file-setprop file 'vc-name |
| 160 | (let ((name-and-type (vc-registered file))) | 160 | (let ((name-and-type (vc-registered file))) |
| @@ -365,12 +365,12 @@ the master name of FILE; this is appended to an optional list of FLAGS." | |||
| 365 | (vc-register verbose comment) | 365 | (vc-register verbose comment) |
| 366 | (if vc-initial-comment | 366 | (if vc-initial-comment |
| 367 | (setq vc-log-after-operation-hook | 367 | (setq vc-log-after-operation-hook |
| 368 | 'vc-checkout-writeable-buffer-hook) | 368 | 'vc-checkout-writable-buffer-hook) |
| 369 | (vc-checkout-writeable-buffer file))) | 369 | (vc-checkout-writable-buffer file))) |
| 370 | 370 | ||
| 371 | ;; if there is no lock on the file, assert one and get it | 371 | ;; if there is no lock on the file, assert one and get it |
| 372 | ((not (setq owner (vc-locking-user file))) | 372 | ((not (setq owner (vc-locking-user file))) |
| 373 | (vc-checkout-writeable-buffer file)) | 373 | (vc-checkout-writable-buffer file)) |
| 374 | 374 | ||
| 375 | ;; a checked-out version exists, but the user may not own the lock | 375 | ;; a checked-out version exists, but the user may not own the lock |
| 376 | ((not (string-equal owner (user-login-name))) | 376 | ((not (string-equal owner (user-login-name))) |
| @@ -427,16 +427,16 @@ the master name of FILE; this is appended to an optional list of FLAGS." | |||
| 427 | (defun vc-next-action (verbose) | 427 | (defun vc-next-action (verbose) |
| 428 | "Do the next logical checkin or checkout operation on the current file. | 428 | "Do the next logical checkin or checkout operation on the current file. |
| 429 | If the file is not already registered, this registers it for version | 429 | If the file is not already registered, this registers it for version |
| 430 | control and then retrieves a writeable, locked copy for editing. | 430 | control and then retrieves a writable, locked copy for editing. |
| 431 | If the file is registered and not locked by anyone, this checks out | 431 | If the file is registered and not locked by anyone, this checks out |
| 432 | a writeable and locked file ready for editing. | 432 | a writable and locked file ready for editing. |
| 433 | If the file is checked out and locked by the calling user, this | 433 | If the file is checked out and locked by the calling user, this |
| 434 | first checks to see if the file has changed since checkout. If not, | 434 | first checks to see if the file has changed since checkout. If not, |
| 435 | it performs a revert. | 435 | it performs a revert. |
| 436 | If the file has been changed, this pops up a buffer for entry | 436 | If the file has been changed, this pops up a buffer for entry |
| 437 | of a log message; when the message has been entered, it checks in the | 437 | of a log message; when the message has been entered, it checks in the |
| 438 | resulting changes along with the log message as change commentary. If | 438 | resulting changes along with the log message as change commentary. If |
| 439 | the variable vc-keep-workfiles is non-nil (which is its default), a | 439 | the variable `vc-keep-workfiles' is non-nil (which is its default), a |
| 440 | read-only copy of the changed file is left in place afterwards. | 440 | read-only copy of the changed file is left in place afterwards. |
| 441 | If the file is registered and locked by someone else, you are given | 441 | If the file is registered and locked by someone else, you are given |
| 442 | the option to steal the lock. | 442 | the option to steal the lock. |
| @@ -465,8 +465,8 @@ lock steals will raise an error." | |||
| 465 | 465 | ||
| 466 | ;;; These functions help the vc-next-action entry point | 466 | ;;; These functions help the vc-next-action entry point |
| 467 | 467 | ||
| 468 | (defun vc-checkout-writeable-buffer (&optional file) | 468 | (defun vc-checkout-writable-buffer (&optional file) |
| 469 | "Retrieve a writeable copy of the latest version of the current buffer's file." | 469 | "Retrieve a writable copy of the latest version of the current buffer's file." |
| 470 | (vc-checkout (or file (buffer-file-name)) t) | 470 | (vc-checkout (or file (buffer-file-name)) t) |
| 471 | ) | 471 | ) |
| 472 | 472 | ||
| @@ -540,13 +540,13 @@ level to check it in under. COMMENT, if specified, is the checkin comment." | |||
| 540 | (or comment (not vc-initial-comment)) | 540 | (or comment (not vc-initial-comment)) |
| 541 | "Enter initial comment." 'vc-backend-admin)) | 541 | "Enter initial comment." 'vc-backend-admin)) |
| 542 | 542 | ||
| 543 | (defun vc-checkout (file &optional writeable) | 543 | (defun vc-checkout (file &optional writable) |
| 544 | "Retrieve a copy of the latest version of the given file." | 544 | "Retrieve a copy of the latest version of the given file." |
| 545 | ;; If ftp is on this system and the name matches the ange-ftp format | 545 | ;; If ftp is on this system and the name matches the ange-ftp format |
| 546 | ;; for a remote file, the user is trying something that won't work. | 546 | ;; for a remote file, the user is trying something that won't work. |
| 547 | (if (and (string-match "^/[^/:]+:" file) (vc-find-binary "ftp")) | 547 | (if (and (string-match "^/[^/:]+:" file) (vc-find-binary "ftp")) |
| 548 | (error "Sorry, you can't check out files over FTP")) | 548 | (error "Sorry, you can't check out files over FTP")) |
| 549 | (vc-backend-checkout file writeable) | 549 | (vc-backend-checkout file writable) |
| 550 | (if (string-equal file buffer-file-name) | 550 | (if (string-equal file buffer-file-name) |
| 551 | (vc-resynch-window file t t)) | 551 | (vc-resynch-window file t t)) |
| 552 | ) | 552 | ) |
| @@ -581,7 +581,7 @@ level to check it in under. COMMENT, if specified, is the checkin comment." | |||
| 581 | "Check in the file specified by FILE. | 581 | "Check in the file specified by FILE. |
| 582 | The optional argument REV may be a string specifying the new version level | 582 | The optional argument REV may be a string specifying the new version level |
| 583 | \(if nil increment the current level). The file is either retained with write | 583 | \(if nil increment the current level). The file is either retained with write |
| 584 | permissions zeroed, or deleted (according to the value of vc-keep-workfiles). | 584 | permissions zeroed, or deleted (according to the value of `vc-keep-workfiles'). |
| 585 | COMMENT is a comment string; if omitted, a buffer is | 585 | COMMENT is a comment string; if omitted, a buffer is |
| 586 | popped up to accept a comment." | 586 | popped up to accept a comment." |
| 587 | (setq vc-log-after-operation-hook 'vc-checkin-hook) | 587 | (setq vc-log-after-operation-hook 'vc-checkin-hook) |
| @@ -793,7 +793,7 @@ files in or below it." | |||
| 793 | (defun vc-insert-headers () | 793 | (defun vc-insert-headers () |
| 794 | "Insert headers in a file for use with your version-control system. | 794 | "Insert headers in a file for use with your version-control system. |
| 795 | Headers desired are inserted at the start of the buffer, and are pulled from | 795 | Headers desired are inserted at the start of the buffer, and are pulled from |
| 796 | the variable vc-header-alist" | 796 | the variable `vc-header-alist'." |
| 797 | (interactive) | 797 | (interactive) |
| 798 | (if vc-dired-mode | 798 | (if vc-dired-mode |
| 799 | (find-file-other-window (dired-get-filename))) | 799 | (find-file-other-window (dired-get-filename))) |
| @@ -844,8 +844,8 @@ on a buffer attached to the file named in the current Dired buffer line." | |||
| 844 | 844 | ||
| 845 | (defun vc-dired-reformat-line (x) | 845 | (defun vc-dired-reformat-line (x) |
| 846 | ;; Hack a directory-listing line, plugging in locking-user info in | 846 | ;; Hack a directory-listing line, plugging in locking-user info in |
| 847 | ;; place of the user and group info. Should have the beneficial | 847 | ;; place of the user and group info. Should have the beneficial |
| 848 | ;; side-effect of shortening the listing line. Each call starts with | 848 | ;; side-effect of shortening the listing line. Each call starts with |
| 849 | ;; point immediately following the dired mark area on the line to be | 849 | ;; point immediately following the dired mark area on the line to be |
| 850 | ;; hacked. | 850 | ;; hacked. |
| 851 | ;; | 851 | ;; |
| @@ -879,7 +879,7 @@ on a buffer attached to the file named in the current Dired buffer line." | |||
| 879 | (setq filelist (cons (substring f dl) filelist)) | 879 | (setq filelist (cons (substring f dl) filelist)) |
| 880 | (setq userlist (cons user userlist)))))))) | 880 | (setq userlist (cons user userlist)))))))) |
| 881 | (save-excursion | 881 | (save-excursion |
| 882 | ;; This uses a semi-documented featre of dired; giving a switch | 882 | ;; This uses a semi-documented feature of dired; giving a switch |
| 883 | ;; argument forces the buffer to refresh each time. | 883 | ;; argument forces the buffer to refresh each time. |
| 884 | (dired | 884 | (dired |
| 885 | (cons default-directory (nreverse filelist)) | 885 | (cons default-directory (nreverse filelist)) |
| @@ -1063,7 +1063,8 @@ to that version." | |||
| 1063 | 1063 | ||
| 1064 | ;;;###autoload | 1064 | ;;;###autoload |
| 1065 | (defun vc-cancel-version (norevert) | 1065 | (defun vc-cancel-version (norevert) |
| 1066 | "Get rid of the version most recently checked in by anyone." | 1066 | "Get rid of most recently checked in version of this file. |
| 1067 | A prefix argument means do not revert the buffer afterwards." | ||
| 1067 | (interactive "P") | 1068 | (interactive "P") |
| 1068 | (if vc-dired-mode | 1069 | (if vc-dired-mode |
| 1069 | (find-file-other-window (dired-get-filename))) | 1070 | (find-file-other-window (dired-get-filename))) |
| @@ -1077,14 +1078,15 @@ to that version." | |||
| 1077 | (if (null (yes-or-no-p (format prompt target))) | 1078 | (if (null (yes-or-no-p (format prompt target))) |
| 1078 | nil | 1079 | nil |
| 1079 | (vc-backend-uncheck (buffer-file-name) target) | 1080 | (vc-backend-uncheck (buffer-file-name) target) |
| 1080 | (if norevert | 1081 | (if (or norevert |
| 1082 | (not (yes-or-no-p "Revert buffer to most recent remaining version? "))) | ||
| 1081 | (vc-mode-line (buffer-file-name)) | 1083 | (vc-mode-line (buffer-file-name)) |
| 1082 | (vc-checkout (buffer-file-name) nil))) | 1084 | (vc-checkout (buffer-file-name) nil))) |
| 1083 | )) | 1085 | )) |
| 1084 | 1086 | ||
| 1085 | (defun vc-rename-file (old new) | 1087 | (defun vc-rename-file (old new) |
| 1086 | "Rename a file, taking its master files with it." | 1088 | "Rename file OLD to NEW, and rename its master file likewise." |
| 1087 | (interactive "fOld name: \nFNew name: ") | 1089 | (interactive "fVC rename file: \nFRename to: ") |
| 1088 | (let ((oldbuf (get-file-buffer old))) | 1090 | (let ((oldbuf (get-file-buffer old))) |
| 1089 | (if (buffer-modified-p oldbuf) | 1091 | (if (buffer-modified-p oldbuf) |
| 1090 | (error "Please save files before moving them.")) | 1092 | (error "Please save files before moving them.")) |
| @@ -1379,17 +1381,17 @@ Return nil if there is no such person." | |||
| 1379 | (message "Registering %s...done" file) | 1381 | (message "Registering %s...done" file) |
| 1380 | ) | 1382 | ) |
| 1381 | 1383 | ||
| 1382 | (defun vc-backend-checkout (file &optional writeable rev) | 1384 | (defun vc-backend-checkout (file &optional writable rev) |
| 1383 | ;; Retrieve a copy of a saved version into a workfile | 1385 | ;; Retrieve a copy of a saved version into a workfile |
| 1384 | (message "Checking out %s..." file) | 1386 | (message "Checking out %s..." file) |
| 1385 | (vc-backend-dispatch file | 1387 | (vc-backend-dispatch file |
| 1386 | (progn | 1388 | (progn |
| 1387 | (vc-do-command 0 "get" file ;; SCCS | 1389 | (vc-do-command 0 "get" file ;; SCCS |
| 1388 | (if writeable "-e") | 1390 | (if writable "-e") |
| 1389 | (and rev (concat "-r" (vc-lookup-triple file rev)))) | 1391 | (and rev (concat "-r" (vc-lookup-triple file rev)))) |
| 1390 | ) | 1392 | ) |
| 1391 | (vc-do-command 0 "co" file ;; RCS | 1393 | (vc-do-command 0 "co" file ;; RCS |
| 1392 | (if writeable "-l") | 1394 | (if writable "-l") |
| 1393 | (and rev (concat "-r" rev))) | 1395 | (and rev (concat "-r" rev))) |
| 1394 | ) | 1396 | ) |
| 1395 | (vc-file-setprop file 'vc-checkout-time (nth 5 (file-attributes file))) | 1397 | (vc-file-setprop file 'vc-checkout-time (nth 5 (file-attributes file))) |
| @@ -1605,15 +1607,15 @@ Global user options: | |||
| 1605 | ;;; These things should probably be generally available | 1607 | ;;; These things should probably be generally available |
| 1606 | 1608 | ||
| 1607 | (defun vc-shrink-to-fit () | 1609 | (defun vc-shrink-to-fit () |
| 1608 | "Shrink a window vertically until it's just large enough to contain its text" | 1610 | "Shrink window vertically until it's just large enough to contain its text." |
| 1609 | (let ((minsize (1+ (count-lines (point-min) (point-max))))) | 1611 | (let ((minsize (1+ (count-lines (point-min) (point-max))))) |
| 1610 | (if (< minsize (window-height)) | 1612 | (if (< minsize (window-height)) |
| 1611 | (let ((window-min-height 2)) | 1613 | (let ((window-min-height 2)) |
| 1612 | (shrink-window (- (window-height) minsize)))))) | 1614 | (shrink-window (- (window-height) minsize)))))) |
| 1613 | 1615 | ||
| 1614 | (defun vc-file-tree-walk (func &rest args) | 1616 | (defun vc-file-tree-walk (func &rest args) |
| 1615 | "Walk recursively through default directory, | 1617 | "Walk recursively through default directory. |
| 1616 | invoking FUNC f ARGS on all non-directory files f underneath it." | 1618 | Invoke FUNC f ARGS on each non-directory file f underneath it." |
| 1617 | (vc-file-tree-walk-internal default-directory func args) | 1619 | (vc-file-tree-walk-internal default-directory func args) |
| 1618 | (message "Traversing directory %s...done" default-directory)) | 1620 | (message "Traversing directory %s...done" default-directory)) |
| 1619 | 1621 | ||
| @@ -1742,7 +1744,7 @@ invoking FUNC f ARGS on all non-directory files f underneath it." | |||
| 1742 | ;;; | 1744 | ;;; |
| 1743 | ;;; Window W: | 1745 | ;;; Window W: |
| 1744 | ;;; Between vc-locking-user and the following steal-lock (apparent | 1746 | ;;; Between vc-locking-user and the following steal-lock (apparent |
| 1745 | ;;; state E). This window may never cloce if the user fails to complete | 1747 | ;;; state E). This window may never close if the user fails to complete |
| 1746 | ;;; the steal-lock message. Includes window X. | 1748 | ;;; the steal-lock message. Includes window X. |
| 1747 | ;;; | 1749 | ;;; |
| 1748 | ;;; Window X: | 1750 | ;;; Window X: |