aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-01-24 06:33:41 +0000
committerRichard M. Stallman1995-01-24 06:33:41 +0000
commit632e95254c51d77773b3ffb9d2ba1c43b9b32268 (patch)
tree75b05b6140ccd699b5d30e01c48dba9719693cd2
parent667da7f557cf242e3d86cd415ceae37fbd7ab045 (diff)
downloademacs-632e95254c51d77773b3ffb9d2ba1c43b9b32268.tar.gz
emacs-632e95254c51d77773b3ffb9d2ba1c43b9b32268.zip
(vc-do-command): Arrange for the default-directory variable
in *vc* to be re-set each time this function uses it. Discard current dir from front of FILE later on, and only if last = `WORKFILE'. Undo Dec 10 change: (vc-directory, vc-dired-reformat-line): Changed back. (vc-directory-18): Old function restored. (vc-dir-all-files): Function deleted. (vc-next-action-on-file): If file is not registered, check file out after registering it. (vc-next-action-dired): Restore the window configuration after doing vc-next-action on each file in a VC-dired buffer. (file-regular-p-18): New function. (file-regular-p): Define, if not already defined.
-rw-r--r--lisp/vc.el237
1 files changed, 147 insertions, 90 deletions
diff --git a/lisp/vc.el b/lisp/vc.el
index bef1b7de505..8972849cb9a 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1,10 +1,10 @@
1;;; vc.el --- drive a version-control system from within Emacs 1;;; vc.el --- drive a version-control system from within Emacs
2 2
3;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. 3;; Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
4 4
5;; Author: Eric S. Raymond <esr@snark.thyrsus.com> 5;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
6;; Maintainer: ttn@netcom.com 6;; Maintainer: ttn@netcom.com
7;; Version: 5.5 + CVS hacks by ceder@lysator.liu.se made in Jan-Feb 1994. 7;; Version: 5.6
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
@@ -29,10 +29,15 @@
29;; This was designed and implemented by Eric Raymond <esr@snark.thyrsus.com>. 29;; This was designed and implemented by Eric Raymond <esr@snark.thyrsus.com>.
30;; Paul Eggert <eggert@twinsun.com>, Sebastian Kremer <sk@thp.uni-koeln.de>, 30;; Paul Eggert <eggert@twinsun.com>, Sebastian Kremer <sk@thp.uni-koeln.de>,
31;; and Richard Stallman contributed valuable criticism, support, and testing. 31;; and Richard Stallman contributed valuable criticism, support, and testing.
32;; CVS support was added by Per Cederqvist <ceder@lysator.liu.se>
33;; in Jan-Feb 1994.
32;; 34;;
33;; Supported version-control systems presently include SCCS and RCS; 35;; Supported version-control systems presently include SCCS, RCS, and CVS.
34;; the RCS lock-stealing code doesn't work right unless you use RCS 5.6.2 36;; The RCS lock-stealing code doesn't work right unless you use RCS 5.6.2
35;; or newer. Currently (January 1994) that is only a beta test release. 37;; or newer. Currently (January 1994) that is only a beta test release.
38;; Even initial checkins will fail if your RCS version is so old that ci
39;; doesn't understand -t-; this has been known to happen to people running
40;; NExTSTEP 3.0.
36;; 41;;
37;; The RCS code assumes strict locking. You can support the RCS -x option 42;; The RCS code assumes strict locking. You can support the RCS -x option
38;; by adding pairs to the vc-master-templates list. 43;; by adding pairs to the vc-master-templates list.
@@ -93,6 +98,8 @@ value of this flag.")
93 (if (file-exists-p "/usr/sccs") 98 (if (file-exists-p "/usr/sccs")
94 '("/usr/sccs") nil) 99 '("/usr/sccs") nil)
95 "*List of extra directories to search for version control commands.") 100 "*List of extra directories to search for version control commands.")
101(defvar vc-directory-exclusion-list '("SCCS" "RCS")
102 "*Directory names ignored by functions that recursively walk file trees.")
96 103
97(defconst vc-maximum-comment-ring-size 32 104(defconst vc-maximum-comment-ring-size 32
98 "Maximum number of saved comments in the comment ring.") 105 "Maximum number of saved comments in the comment ring.")
@@ -159,6 +166,27 @@ and that its contents match what the master file says.")
159(defvar vc-comment-ring-index nil) 166(defvar vc-comment-ring-index nil)
160(defvar vc-last-comment-match nil) 167(defvar vc-last-comment-match nil)
161 168
169;; Back-portability to Emacs 18
170
171(defun file-executable-p-18 (f)
172 (let ((modes (file-modes f)))
173 (and modes (not (zerop (logand 292))))))
174
175(defun file-regular-p-18 (f)
176 (let ((attributes (file-attributes f)))
177 (and attributes (not (car attributes)))))
178
179; Conditionally rebind some things for Emacs 18 compatibility
180(if (not (boundp 'minor-mode-map-alist))
181 (progn
182 (setq compilation-old-error-list nil)
183 (fset 'file-executable-p 'file-executable-p-18)
184 (fset 'shrink-window-if-larger-than-buffer 'beginning-of-buffer)
185 ))
186
187(if (not (boundp 'file-regular-p))
188 (fset 'file-regular-p 'file-regular-p-18))
189
162;; File property caching 190;; File property caching
163 191
164(defun vc-file-clearprops (file) 192(defun vc-file-clearprops (file)
@@ -203,35 +231,37 @@ and that its contents match what the master file says.")
203 "Execute a version-control command, notifying user and checking for errors. 231 "Execute a version-control command, notifying user and checking for errors.
204The command is successful if its exit status does not exceed OKSTATUS. 232The command is successful if its exit status does not exceed OKSTATUS.
205Output from COMMAND goes to buffer *vc*. The last argument of the command is 233Output from COMMAND goes to buffer *vc*. The last argument of the command is
206the master name of FILE if LAST is 'MASTER, or the basename of FILE if LAST is 234the master name of FILE if LAST is 'MASTER, or the workfile of FILE if LAST is
207'BASE; this is appended to an optional list of FLAGS." 235'WORKFILE; this is appended to an optional list of FLAGS."
208 (setq file (expand-file-name file)) 236 (setq file (expand-file-name file))
209 (if vc-command-messages 237 (if vc-command-messages
210 (message "Running %s on %s..." command file)) 238 (message "Running %s on %s..." command file))
211 (let ((obuf (current-buffer)) (camefrom (current-buffer)) 239 (let ((obuf (current-buffer)) (camefrom (current-buffer))
212 (squeezed nil) 240 (squeezed nil)
213 (vc-file (and file (vc-name file))) 241 (vc-file (and file (vc-name file)))
242 (olddir default-directory)
214 status) 243 status)
215 (set-buffer (get-buffer-create "*vc*")) 244 (set-buffer (get-buffer-create "*vc*"))
216 (set (make-local-variable 'vc-parent-buffer) camefrom) 245 (set (make-local-variable 'vc-parent-buffer) camefrom)
217 (set (make-local-variable 'vc-parent-buffer-name) 246 (set (make-local-variable 'vc-parent-buffer-name)
218 (concat " from " (buffer-name camefrom))) 247 (concat " from " (buffer-name camefrom)))
248 (setq default-directory olddir)
219 249
220 (erase-buffer) 250 (erase-buffer)
221 251
222 ;; This is so that command arguments typed in the *vc* buffer will
223 ;; have reasonable defaults.
224 (setq default-directory (file-name-directory file))
225
226 (mapcar 252 (mapcar
227 (function (lambda (s) (and s (setq squeezed (append squeezed (list s)))))) 253 (function (lambda (s) (and s (setq squeezed (append squeezed (list s))))))
228 flags) 254 flags)
229 (if (and vc-file (eq last 'MASTER)) 255 (if (and vc-file (eq last 'MASTER))
230 (setq squeezed (append squeezed (list vc-file)))) 256 (setq squeezed (append squeezed (list vc-file))))
231 (if (eq last 'BASE) 257 (if (eq last 'WORKFILE)
232 (setq squeezed (append squeezed (list (file-name-nondirectory file))))) 258 (progn
233 (let ((default-directory (file-name-directory (or file "./"))) 259 (let* ((pwd (expand-file-name default-directory))
234 (exec-path (if vc-path (append exec-path vc-path) exec-path)) 260 (preflen (length pwd)))
261 (if (string= (substring file 0 preflen) pwd)
262 (setq file (substring file preflen))))
263 (setq squeezed (append squeezed (list file)))))
264 (let ((exec-path (if vc-path (append exec-path vc-path) exec-path))
235 ;; Add vc-path to PATH for the execution of this command. 265 ;; Add vc-path to PATH for the execution of this command.
236 (process-environment 266 (process-environment
237 (cons (concat "PATH=" (getenv "PATH") 267 (cons (concat "PATH=" (getenv "PATH")
@@ -239,6 +269,7 @@ the master name of FILE if LAST is 'MASTER, or the basename of FILE if LAST is
239 process-environment))) 269 process-environment)))
240 (setq status (apply 'call-process command nil t nil squeezed))) 270 (setq status (apply 'call-process command nil t nil squeezed)))
241 (goto-char (point-max)) 271 (goto-char (point-max))
272 (set-buffer-modified-p nil)
242 (forward-line -1) 273 (forward-line -1)
243 (if (or (not (integerp status)) (< okstatus status)) 274 (if (or (not (integerp status)) (< okstatus status))
244 (progn 275 (progn
@@ -324,8 +355,16 @@ the master name of FILE if LAST is 'MASTER, or the basename of FILE if LAST is
324 (if buffer-error-marked-p buffer)))) 355 (if buffer-error-marked-p buffer))))
325 (buffer-list))))))) 356 (buffer-list)))))))
326 357
327 ;; the actual revisit 358 (let ((in-font-lock-mode (and (boundp 'font-lock-fontified)
328 (revert-buffer arg no-confirm) 359 font-lock-fontified)))
360 (if in-font-lock-mode
361 (font-lock-mode 0))
362
363 ;; the actual revisit
364 (revert-buffer arg no-confirm)
365
366 (if in-font-lock-mode
367 (font-lock-mode 1)))
329 368
330 ;; Reparse affected compilation buffers. 369 ;; Reparse affected compilation buffers.
331 (while reparse 370 (while reparse
@@ -387,7 +426,11 @@ the master name of FILE if LAST is 'MASTER, or the basename of FILE if LAST is
387 426
388 ;; if there is no master file corresponding, create one 427 ;; if there is no master file corresponding, create one
389 ((not vc-file) 428 ((not vc-file)
390 (vc-register verbose comment)) 429 (vc-register verbose comment)
430 (if vc-initial-comment
431 (setq vc-log-after-operation-hook
432 'vc-checkout-writable-buffer-hook)
433 (vc-checkout-writable-buffer file)))
391 434
392 ;; if there is no lock on the file, assert one and get it 435 ;; if there is no lock on the file, assert one and get it
393 ((and (not (eq vc-type 'CVS)) ;There are no locks in CVS. 436 ((and (not (eq vc-type 'CVS)) ;There are no locks in CVS.
@@ -491,13 +534,15 @@ the master name of FILE if LAST is 'MASTER, or the basename of FILE if LAST is
491 ;; We've accepted a log comment, now do a vc-next-action using it on all 534 ;; We've accepted a log comment, now do a vc-next-action using it on all
492 ;; marked files. 535 ;; marked files.
493 (set-buffer vc-parent-buffer) 536 (set-buffer vc-parent-buffer)
494 (dired-map-over-marks 537 (let ((configuration (current-window-configuration)))
495 (save-window-excursion 538 (dired-map-over-marks
496 (let ((file (dired-get-filename))) 539 (save-window-excursion
497 (message "Processing %s..." file) 540 (let ((file (dired-get-filename)))
498 (vc-next-action-on-file file nil comment) 541 (message "Processing %s..." file)
499 (message "Processing %s...done" file))) 542 (vc-next-action-on-file file nil comment)
500 nil t) 543 (message "Processing %s...done" file)))
544 nil t)
545 (set-window-configuration configuration))
501 ) 546 )
502 547
503;; Here's the major entry point. 548;; Here's the major entry point.
@@ -893,7 +938,7 @@ and two version designators specifying which versions to compare."
893 ;; visited. This plays hell with numerous assumptions in 938 ;; visited. This plays hell with numerous assumptions in
894 ;; the diff.el and compile.el machinery. 939 ;; the diff.el and compile.el machinery.
895 (pop-to-buffer "*vc*") 940 (pop-to-buffer "*vc*")
896 (pop-to-buffer "*vc*") 941 (setq default-directory (file-name-directory file))
897 (if (= 0 (buffer-size)) 942 (if (= 0 (buffer-size))
898 (progn 943 (progn
899 (setq unchanged t) 944 (setq unchanged t)
@@ -1034,51 +1079,45 @@ on a buffer attached to the file named in the current Dired buffer line."
1034 (cond 1079 (cond
1035 ((re-search-forward "\\([0-9]+ \\)\\([^ ]+\\)\\( .*\\)" nil 0) 1080 ((re-search-forward "\\([0-9]+ \\)\\([^ ]+\\)\\( .*\\)" nil 0)
1036 (save-excursion 1081 (save-excursion
1037 (goto-char (match-beginning 2)) 1082 (goto-char (match-beginning 2))
1038 (insert "(") 1083 (insert "(")
1039 (goto-char (1+ (match-end 2))) 1084 (goto-char (1+ (match-end 2)))
1040 (insert ")") 1085 (insert ")")
1041 (delete-char (- 17 (- (match-end 2) (match-beginning 2)))) 1086 (delete-char (- 17 (- (match-end 2) (match-beginning 2))))
1042 (insert (substring " " 0 1087 (insert (substring " " 0
1043 (- 7 (- (match-end 2) (match-beginning 2))))))))) 1088 (- 7 (- (match-end 2) (match-beginning 2)))))))))
1044 (t 1089 (t
1045 (if x (setq x (concat "(" x ")"))) 1090 (if x (setq x (concat "(" x ")")))
1046 (if (re-search-forward "\\([0-9]+ \\).................\\( .*\\)" nil 0) 1091 (if (re-search-forward "\\([0-9]+ \\).................\\( .*\\)" nil 0)
1047 (let ((rep (substring (concat x " ") 0 9))) 1092 (let ((rep (substring (concat x " ") 0 9)))
1048 (replace-match (concat "\\1" rep "\\2") t))) 1093 (replace-match (concat "\\1" rep "\\2") t)))
1049 ))) 1094 )))
1050 1095
1096;;; Note in Emacs 18 the following defun gets overridden
1097;;; with the symbol 'vc-directory-18. See below.
1051;;;###autoload 1098;;;###autoload
1052(defun vc-directory (dir verbose &optional nested) 1099(defun vc-directory (verbose)
1053 "Show version-control status of all files in the directory DIR. 1100 "Show version-control status of the current directory and subdirectories.
1054If the second argument VERBOSE is non-nil, show all files; 1101Normally it creates a Dired buffer that lists only the locked files
1055otherwise show only files that current locked in the version control system. 1102in all these directories. With a prefix argument, it lists all files."
1056Interactively, supply a prefix arg to make VERBOSE non-nil. 1103 (interactive "P")
1057 1104 (let (nonempty
1058If the optional third argument NESTED is non-nil, 1105 (dl (length default-directory))
1059scan the entire tree of subdirectories of the current directory." 1106 (filelist nil) (userlist nil)
1060 (interactive "DVC status of directory: \nP") 1107 dired-buf
1061 (let* (nonempty 1108 dired-buf-mod-count)
1062 (dl (length dir)) 1109 (vc-file-tree-walk
1063 (filelist nil) (userlist nil) 1110 (function (lambda (f)
1064 dired-buf 1111 (if (vc-registered f)
1065 dired-buf-mod-count 1112 (let ((user (vc-locking-user f)))
1066 (subfunction 1113 (and (or verbose user)
1067 (function (lambda (f) 1114 (setq filelist (cons (substring f dl) filelist))
1068 (if (vc-registered f) 1115 (setq userlist (cons user userlist))))))))
1069 (let ((user (vc-locking-user f)))
1070 (and (or verbose user)
1071 (setq filelist (cons (substring f dl) filelist))
1072 (setq userlist (cons user userlist)))))))))
1073 (let ((default-directory dir))
1074 (if nested
1075 (vc-file-tree-walk subfunction)
1076 (vc-dir-all-files subfunction)))
1077 (save-excursion 1116 (save-excursion
1078 ;; This uses a semi-documented feature of dired; giving a switch 1117 ;; This uses a semi-documented feature of dired; giving a switch
1079 ;; argument forces the buffer to refresh each time. 1118 ;; argument forces the buffer to refresh each time.
1080 (dired 1119 (dired
1081 (cons dir (nreverse filelist)) 1120 (cons default-directory (nreverse filelist))
1082 dired-listing-switches) 1121 dired-listing-switches)
1083 (setq dired-buf (current-buffer)) 1122 (setq dired-buf (current-buffer))
1084 (setq nonempty (not (zerop (buffer-size))))) 1123 (setq nonempty (not (zerop (buffer-size)))))
@@ -1103,9 +1142,35 @@ scan the entire tree of subdirectories of the current directory."
1103 (if verbose "registered" "locked") default-directory)) 1142 (if verbose "registered" "locked") default-directory))
1104 )) 1143 ))
1105 1144
1106; Emacs 18 also lacks these. 1145;; Emacs 18 version
1107(or (boundp 'compilation-old-error-list) 1146(defun vc-directory-18 (verbose)
1108 (setq compilation-old-error-list nil)) 1147 "Show version-control status of all files under the current directory."
1148 (interactive "P")
1149 (let (nonempty (dir default-directory))
1150 (save-excursion
1151 (set-buffer (get-buffer-create "*vc-status*"))
1152 (erase-buffer)
1153 (cd dir)
1154 (vc-file-tree-walk
1155 (function (lambda (f)
1156 (if (vc-registered f)
1157 (let ((user (vc-locking-user f)))
1158 (if (or user verbose)
1159 (insert (format
1160 "%s %s\n"
1161 (concat user) f))))))))
1162 (setq nonempty (not (zerop (buffer-size)))))
1163 (if nonempty
1164 (progn
1165 (pop-to-buffer "*vc-status*" t)
1166 (goto-char (point-min))
1167 (shrink-window-if-larger-than-buffer)))
1168 (message "No files are currently %s under %s"
1169 (if verbose "registered" "locked") default-directory))
1170 )
1171
1172(or (boundp 'minor-mode-map-alist)
1173 (fset 'vc-directory 'vc-directory-18))
1109 1174
1110;; Named-configuration support for SCCS 1175;; Named-configuration support for SCCS
1111 1176
@@ -1198,9 +1263,10 @@ levels in the snapshot."
1198 (while vc-parent-buffer 1263 (while vc-parent-buffer
1199 (pop-to-buffer vc-parent-buffer)) 1264 (pop-to-buffer vc-parent-buffer))
1200 (if (and buffer-file-name (vc-name buffer-file-name)) 1265 (if (and buffer-file-name (vc-name buffer-file-name))
1201 (progn 1266 (let ((file buffer-file-name))
1202 (vc-backend-print-log buffer-file-name) 1267 (vc-backend-print-log file)
1203 (pop-to-buffer (get-buffer-create "*vc*")) 1268 (pop-to-buffer (get-buffer-create "*vc*"))
1269 (setq default-directory (file-name-directory file))
1204 (while (looking-at "=*\n") 1270 (while (looking-at "=*\n")
1205 (delete-char (- (match-end 0) (match-beginning 0))) 1271 (delete-char (- (match-end 0) (match-beginning 0)))
1206 (forward-line -1)) 1272 (forward-line -1))
@@ -1424,7 +1490,7 @@ From a program, any arguments are passed to the `rcs2log' script."
1424 (setq buf (create-file-buffer file)) 1490 (setq buf (create-file-buffer file))
1425 (set-buffer buf)) 1491 (set-buffer buf))
1426 (erase-buffer) 1492 (erase-buffer)
1427 (insert-file-contents file nil) 1493 (insert-file-contents file)
1428 (set-buffer-modified-p nil) 1494 (set-buffer-modified-p nil)
1429 (auto-save-mode nil) 1495 (auto-save-mode nil)
1430 (prog1 1496 (prog1
@@ -1602,7 +1668,7 @@ with RCS)."
1602 ;; should always be nil anyhow. Don't fetch vc-your-latest-version, since 1668 ;; should always be nil anyhow. Don't fetch vc-your-latest-version, since
1603 ;; that is done in vc-find-cvs-master. 1669 ;; that is done in vc-find-cvs-master.
1604 (vc-log-info 1670 (vc-log-info
1605 "cvs" file 'BASE '("status") 1671 "cvs" file 'WORKFILE '("status")
1606 ;; CVS 1.3 says "RCS Version:", other releases "RCS Revision:", 1672 ;; CVS 1.3 says "RCS Version:", other releases "RCS Revision:",
1607 ;; and CVS 1.4a1 says "Repository revision:". The regexp below 1673 ;; and CVS 1.4a1 says "Repository revision:". The regexp below
1608 ;; matches much more, but because of the way vc-log-info is 1674 ;; matches much more, but because of the way vc-log-info is
@@ -1654,7 +1720,7 @@ with RCS)."
1654 (and comment (concat "-t-" comment)) 1720 (and comment (concat "-t-" comment))
1655 file)) 1721 file))
1656 ((eq backend 'CVS) 1722 ((eq backend 'CVS)
1657 (vc-do-command 0 "cvs" file 'BASE ;; CVS 1723 (vc-do-command 0 "cvs" file 'WORKFILE ;; CVS
1658 "add" 1724 "add"
1659 (and comment (not (string= comment "")) 1725 (and comment (not (string= comment ""))
1660 (concat "-m" comment))) 1726 (concat "-m" comment)))
@@ -1737,7 +1803,7 @@ with RCS)."
1737 (unwind-protect 1803 (unwind-protect
1738 (progn 1804 (progn
1739 (apply 'vc-do-command 1805 (apply 'vc-do-command
1740 0 "/bin/sh" file 'BASE "-c" 1806 0 "/bin/sh" file 'WORKFILE "-c"
1741 "exec >\"$1\" || exit; shift; exec cvs update \"$@\"" 1807 "exec >\"$1\" || exit; shift; exec cvs update \"$@\""
1742 "" ; dummy argument for shell's $0 1808 "" ; dummy argument for shell's $0
1743 workfile 1809 workfile
@@ -1746,7 +1812,7 @@ with RCS)."
1746 vc-checkout-switches) 1812 vc-checkout-switches)
1747 (setq failed nil)) 1813 (setq failed nil))
1748 (and failed (file-exists-p filename) (delete-file filename)))) 1814 (and failed (file-exists-p filename) (delete-file filename))))
1749 (apply 'vc-do-command 0 "cvs" file 'BASE 1815 (apply 'vc-do-command 0 "cvs" file 'WORKFILE
1750 (and rev (concat "-r" rev)) 1816 (and rev (concat "-r" rev))
1751 file 1817 file
1752 vc-checkout-switches)) 1818 vc-checkout-switches))
@@ -1791,7 +1857,7 @@ with RCS)."
1791 (concat "-m" comment) 1857 (concat "-m" comment)
1792 vc-checkin-switches) 1858 vc-checkin-switches)
1793 (progn 1859 (progn
1794 (apply 'vc-do-command 0 "cvs" file 'BASE 1860 (apply 'vc-do-command 0 "cvs" file 'WORKFILE
1795 "ci" "-m" comment 1861 "ci" "-m" comment
1796 vc-checkin-switches) 1862 vc-checkin-switches)
1797 (vc-file-setprop file 'vc-checkout-time 1863 (vc-file-setprop file 'vc-checkout-time
@@ -1813,7 +1879,7 @@ with RCS)."
1813 "-f" "-u") 1879 "-f" "-u")
1814 (progn ;; CVS 1880 (progn ;; CVS
1815 (delete-file file) 1881 (delete-file file)
1816 (vc-do-command 0 "cvs" file 'BASE "update")) 1882 (vc-do-command 0 "cvs" file 'WORKFILE "update"))
1817 ) 1883 )
1818 (vc-file-setprop file 'vc-locking-user nil) 1884 (vc-file-setprop file 'vc-locking-user nil)
1819 (message "Reverting %s...done" file) 1885 (message "Reverting %s...done" file)
@@ -1853,14 +1919,14 @@ with RCS)."
1853 file 1919 file
1854 (vc-do-command 0 "prs" file 'MASTER) 1920 (vc-do-command 0 "prs" file 'MASTER)
1855 (vc-do-command 0 "rlog" file 'MASTER) 1921 (vc-do-command 0 "rlog" file 'MASTER)
1856 (vc-do-command 0 "cvs" file 'BASE "rlog"))) 1922 (vc-do-command 0 "cvs" file 'WORKFILE "rlog")))
1857 1923
1858(defun vc-backend-assign-name (file name) 1924(defun vc-backend-assign-name (file name)
1859 ;; Assign to a FILE's latest version a given NAME. 1925 ;; Assign to a FILE's latest version a given NAME.
1860 (vc-backend-dispatch file 1926 (vc-backend-dispatch file
1861 (vc-add-triple name file (vc-latest-version file)) ;; SCCS 1927 (vc-add-triple name file (vc-latest-version file)) ;; SCCS
1862 (vc-do-command 0 "rcs" file 'MASTER (concat "-n" name ":")) ;; RCS 1928 (vc-do-command 0 "rcs" file 'MASTER (concat "-n" name ":")) ;; RCS
1863 (vc-do-command 0 "cvs" file 'BASE "tag" name) ;; CVS 1929 (vc-do-command 0 "cvs" file 'WORKFILE "tag" name) ;; CVS
1864 ) 1930 )
1865 ) 1931 )
1866 1932
@@ -1878,6 +1944,7 @@ with RCS)."
1878 (let* ((command (if (eq backend 'SCCS) 1944 (let* ((command (if (eq backend 'SCCS)
1879 "vcdiff" 1945 "vcdiff"
1880 "rcsdiff")) 1946 "rcsdiff"))
1947 (mode (if (eq backend 'RCS) 'WORKFILE 'MASTER))
1881 (options (append (list (and cmp "--brief") 1948 (options (append (list (and cmp "--brief")
1882 "-q" 1949 "-q"
1883 (and oldvers (concat "-r" oldvers)) 1950 (and oldvers (concat "-r" oldvers))
@@ -1886,10 +1953,10 @@ with RCS)."
1886 (if (listp diff-switches) 1953 (if (listp diff-switches)
1887 diff-switches 1954 diff-switches
1888 (list diff-switches))))) 1955 (list diff-switches)))))
1889 (status (apply 'vc-do-command 2 command file options))) 1956 (status (apply 'vc-do-command 2 command file mode options)))
1890 ;; Some RCS versions don't understand "--brief"; work around this. 1957 ;; Some RCS versions don't understand "--brief"; work around this.
1891 (if (eq status 2) 1958 (if (eq status 2)
1892 (apply 'vc-do-command 1 command file 'MASTER 1959 (apply 'vc-do-command 1 command file 'WORKFILE
1893 (if cmp (cdr options) options)) 1960 (if cmp (cdr options) options))
1894 status))) 1961 status)))
1895 ;; CVS is different. 1962 ;; CVS is different.
@@ -1901,12 +1968,12 @@ with RCS)."
1901 (if (or oldvers newvers) 1968 (if (or oldvers newvers)
1902 (error "No revisions of %s exists" file) 1969 (error "No revisions of %s exists" file)
1903 (apply 'vc-do-command 1970 (apply 'vc-do-command
1904 1 "diff" file 'BASE "/dev/null" 1971 1 "diff" file 'WORKFILE "/dev/null"
1905 (if (listp diff-switches) 1972 (if (listp diff-switches)
1906 diff-switches 1973 diff-switches
1907 (list diff-switches)))) 1974 (list diff-switches))))
1908 (apply 'vc-do-command 1975 (apply 'vc-do-command
1909 1 "cvs" file 'BASE "diff" 1976 1 "cvs" file 'WORKFILE "diff"
1910 (and oldvers (concat "-r" oldvers)) 1977 (and oldvers (concat "-r" oldvers))
1911 (and newvers (concat "-r" newvers)) 1978 (and newvers (concat "-r" newvers))
1912 (if (listp diff-switches) 1979 (if (listp diff-switches)
@@ -1921,7 +1988,7 @@ with RCS)."
1921 file 1988 file
1922 (error "vc-backend-merge-news not meaningful for SCCS files") ;SCCS 1989 (error "vc-backend-merge-news not meaningful for SCCS files") ;SCCS
1923 (error "vc-backend-merge-news not meaningful for RCS files") ;RCS 1990 (error "vc-backend-merge-news not meaningful for RCS files") ;RCS
1924 (vc-do-command 1 "cvs" file 'BASE "update") ;CVS 1991 (vc-do-command 1 "cvs" file 'WORKFILE "update") ;CVS
1925 )) 1992 ))
1926 1993
1927(defun vc-check-headers () 1994(defun vc-check-headers ()
@@ -2041,23 +2108,13 @@ Invoke FUNC f ARGS on each non-directory file f underneath it."
2041 (lambda (f) (or 2108 (lambda (f) (or
2042 (string-equal f ".") 2109 (string-equal f ".")
2043 (string-equal f "..") 2110 (string-equal f "..")
2111 (member f vc-directory-exclusion-list)
2044 (let ((dirf (concat dir f))) 2112 (let ((dirf (concat dir f)))
2045 (or 2113 (or
2046 (file-symlink-p dirf) ;; Avoid possible loops 2114 (file-symlink-p dirf) ;; Avoid possible loops
2047 (vc-file-tree-walk-internal dirf func args)))))) 2115 (vc-file-tree-walk-internal dirf func args))))))
2048 (directory-files dir))))) 2116 (directory-files dir)))))
2049 2117
2050(defun vc-dir-all-files (func &rest args)
2051 "Invoke FUNC f ARGS on each regular file f in default directory."
2052 (let ((dir default-directory))
2053 (message "Scanning directory %s..." dir)
2054 (mapcar (function (lambda (f)
2055 (let ((dirf (expand-file-name f dir)))
2056 (if (file-regular-p dirf)
2057 (apply func dirf args)))))
2058 (directory-files dir))
2059 (message "Scanning directory %s...done" dir)))
2060
2061(provide 'vc) 2118(provide 'vc)
2062 2119
2063;;; DEVELOPER'S NOTES ON CONCURRENCY PROBLEMS IN THIS CODE 2120;;; DEVELOPER'S NOTES ON CONCURRENCY PROBLEMS IN THIS CODE