aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-01-19 07:18:47 +0000
committerRichard M. Stallman1995-01-19 07:18:47 +0000
commite70bdc9855516a3743521bbf810a388bd30ca522 (patch)
treeacff26d342556328cfae04039559726cefb93f50
parent3de15b7ad1643223f6a34d0d17b3ef31a4a50026 (diff)
downloademacs-e70bdc9855516a3743521bbf810a388bd30ca522.tar.gz
emacs-e70bdc9855516a3743521bbf810a388bd30ca522.zip
Revert Jan 15 and Jan 5 changes.
-rw-r--r--lisp/vc.el102
1 files changed, 37 insertions, 65 deletions
diff --git a/lisp/vc.el b/lisp/vc.el
index 4b9567461b5..bef1b7de505 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, 1995 Free Software Foundation, Inc. 3;; Copyright (C) 1992, 1993, 1994 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.6 7;; Version: 5.5 + CVS hacks by ceder@lysator.liu.se made in Jan-Feb 1994.
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
@@ -29,15 +29,10 @@
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.
34;; 32;;
35;; Supported version-control systems presently include SCCS, RCS, and CVS. 33;; Supported version-control systems presently include SCCS and RCS;
36;; The RCS lock-stealing code doesn't work right unless you use RCS 5.6.2 34;; the RCS lock-stealing code doesn't work right unless you use RCS 5.6.2
37;; or newer. Currently (January 1994) that is only a beta test release. 35;; 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.
41;; 36;;
42;; The RCS code assumes strict locking. You can support the RCS -x option 37;; The RCS code assumes strict locking. You can support the RCS -x option
43;; by adding pairs to the vc-master-templates list. 38;; by adding pairs to the vc-master-templates list.
@@ -98,8 +93,6 @@ value of this flag.")
98 (if (file-exists-p "/usr/sccs") 93 (if (file-exists-p "/usr/sccs")
99 '("/usr/sccs") nil) 94 '("/usr/sccs") nil)
100 "*List of extra directories to search for version control commands.") 95 "*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.")
103 96
104(defconst vc-maximum-comment-ring-size 32 97(defconst vc-maximum-comment-ring-size 32
105 "Maximum number of saved comments in the comment ring.") 98 "Maximum number of saved comments in the comment ring.")
@@ -166,20 +159,6 @@ and that its contents match what the master file says.")
166(defvar vc-comment-ring-index nil) 159(defvar vc-comment-ring-index nil)
167(defvar vc-last-comment-match nil) 160(defvar vc-last-comment-match nil)
168 161
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; Conditionally rebind some things for Emacs 18 compatibility
176(if (not (boundp 'minor-mode-map-alist))
177 (progn
178 (setq compilation-old-error-list nil)
179 (fset 'file-executable-p 'file-executable-p-18)
180 (fset 'shrink-window-if-larger-than-buffer 'beginning-of-buffer)
181 ))
182
183;; File property caching 162;; File property caching
184 163
185(defun vc-file-clearprops (file) 164(defun vc-file-clearprops (file)
@@ -224,13 +203,9 @@ and that its contents match what the master file says.")
224 "Execute a version-control command, notifying user and checking for errors. 203 "Execute a version-control command, notifying user and checking for errors.
225The command is successful if its exit status does not exceed OKSTATUS. 204The command is successful if its exit status does not exceed OKSTATUS.
226Output from COMMAND goes to buffer *vc*. The last argument of the command is 205Output from COMMAND goes to buffer *vc*. The last argument of the command is
227the master name of FILE if LAST is 'MASTER, or the workfile of FILE if LAST is 206the master name of FILE if LAST is 'MASTER, or the basename of FILE if LAST is
228'WORKFILE; this is appended to an optional list of FLAGS." 207'BASE; this is appended to an optional list of FLAGS."
229 (setq file (expand-file-name file)) 208 (setq file (expand-file-name file))
230 (let* ((pwd (expand-file-name default-directory))
231 (preflen (length pwd)))
232 (if (string= (substring file 0 preflen) pwd)
233 (setq file (substring file preflen))))
234 (if vc-command-messages 209 (if vc-command-messages
235 (message "Running %s on %s..." command file)) 210 (message "Running %s on %s..." command file))
236 (let ((obuf (current-buffer)) (camefrom (current-buffer)) 211 (let ((obuf (current-buffer)) (camefrom (current-buffer))
@@ -244,14 +219,19 @@ the master name of FILE if LAST is 'MASTER, or the workfile of FILE if LAST is
244 219
245 (erase-buffer) 220 (erase-buffer)
246 221
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
247 (mapcar 226 (mapcar
248 (function (lambda (s) (and s (setq squeezed (append squeezed (list s)))))) 227 (function (lambda (s) (and s (setq squeezed (append squeezed (list s))))))
249 flags) 228 flags)
250 (if (and vc-file (eq last 'MASTER)) 229 (if (and vc-file (eq last 'MASTER))
251 (setq squeezed (append squeezed (list vc-file)))) 230 (setq squeezed (append squeezed (list vc-file))))
252 (if (eq last 'WORKFILE) 231 (if (eq last 'BASE)
253 (setq squeezed (append squeezed (list file)))) 232 (setq squeezed (append squeezed (list (file-name-nondirectory file)))))
254 (let ((exec-path (if vc-path (append exec-path vc-path) exec-path)) 233 (let ((default-directory (file-name-directory (or file "./")))
234 (exec-path (if vc-path (append exec-path vc-path) exec-path))
255 ;; Add vc-path to PATH for the execution of this command. 235 ;; Add vc-path to PATH for the execution of this command.
256 (process-environment 236 (process-environment
257 (cons (concat "PATH=" (getenv "PATH") 237 (cons (concat "PATH=" (getenv "PATH")
@@ -259,7 +239,6 @@ the master name of FILE if LAST is 'MASTER, or the workfile of FILE if LAST is
259 process-environment))) 239 process-environment)))
260 (setq status (apply 'call-process command nil t nil squeezed))) 240 (setq status (apply 'call-process command nil t nil squeezed)))
261 (goto-char (point-max)) 241 (goto-char (point-max))
262 (set-buffer-modified-p nil)
263 (forward-line -1) 242 (forward-line -1)
264 (if (or (not (integerp status)) (< okstatus status)) 243 (if (or (not (integerp status)) (< okstatus status))
265 (progn 244 (progn
@@ -345,16 +324,8 @@ the master name of FILE if LAST is 'MASTER, or the workfile of FILE if LAST is
345 (if buffer-error-marked-p buffer)))) 324 (if buffer-error-marked-p buffer))))
346 (buffer-list))))))) 325 (buffer-list)))))))
347 326
348 (let ((in-font-lock-mode (and (boundp 'font-lock-fontified) 327 ;; the actual revisit
349 font-lock-fontified))) 328 (revert-buffer arg no-confirm)
350 (if in-font-lock-mode
351 (font-lock-mode 0))
352
353 ;; the actual revisit
354 (revert-buffer arg no-confirm)
355
356 (if in-font-lock-mode
357 (font-lock-mode 1)))
358 329
359 ;; Reparse affected compilation buffers. 330 ;; Reparse affected compilation buffers.
360 (while reparse 331 (while reparse
@@ -922,7 +893,7 @@ and two version designators specifying which versions to compare."
922 ;; visited. This plays hell with numerous assumptions in 893 ;; visited. This plays hell with numerous assumptions in
923 ;; the diff.el and compile.el machinery. 894 ;; the diff.el and compile.el machinery.
924 (pop-to-buffer "*vc*") 895 (pop-to-buffer "*vc*")
925 (setq default-directory (file-name-directory file)) 896 (pop-to-buffer "*vc*")
926 (if (= 0 (buffer-size)) 897 (if (= 0 (buffer-size))
927 (progn 898 (progn
928 (setq unchanged t) 899 (setq unchanged t)
@@ -1132,6 +1103,10 @@ scan the entire tree of subdirectories of the current directory."
1132 (if verbose "registered" "locked") default-directory)) 1103 (if verbose "registered" "locked") default-directory))
1133 )) 1104 ))
1134 1105
1106; Emacs 18 also lacks these.
1107(or (boundp 'compilation-old-error-list)
1108 (setq compilation-old-error-list nil))
1109
1135;; Named-configuration support for SCCS 1110;; Named-configuration support for SCCS
1136 1111
1137(defun vc-add-triple (name file rev) 1112(defun vc-add-triple (name file rev)
@@ -1223,10 +1198,9 @@ levels in the snapshot."
1223 (while vc-parent-buffer 1198 (while vc-parent-buffer
1224 (pop-to-buffer vc-parent-buffer)) 1199 (pop-to-buffer vc-parent-buffer))
1225 (if (and buffer-file-name (vc-name buffer-file-name)) 1200 (if (and buffer-file-name (vc-name buffer-file-name))
1226 (let ((file buffer-file-name)) 1201 (progn
1227 (vc-backend-print-log file) 1202 (vc-backend-print-log buffer-file-name)
1228 (pop-to-buffer (get-buffer-create "*vc*")) 1203 (pop-to-buffer (get-buffer-create "*vc*"))
1229 (setq default-directory (file-name-directory file))
1230 (while (looking-at "=*\n") 1204 (while (looking-at "=*\n")
1231 (delete-char (- (match-end 0) (match-beginning 0))) 1205 (delete-char (- (match-end 0) (match-beginning 0)))
1232 (forward-line -1)) 1206 (forward-line -1))
@@ -1450,7 +1424,7 @@ From a program, any arguments are passed to the `rcs2log' script."
1450 (setq buf (create-file-buffer file)) 1424 (setq buf (create-file-buffer file))
1451 (set-buffer buf)) 1425 (set-buffer buf))
1452 (erase-buffer) 1426 (erase-buffer)
1453 (insert-file-contents file) 1427 (insert-file-contents file nil)
1454 (set-buffer-modified-p nil) 1428 (set-buffer-modified-p nil)
1455 (auto-save-mode nil) 1429 (auto-save-mode nil)
1456 (prog1 1430 (prog1
@@ -1628,7 +1602,7 @@ with RCS)."
1628 ;; should always be nil anyhow. Don't fetch vc-your-latest-version, since 1602 ;; should always be nil anyhow. Don't fetch vc-your-latest-version, since
1629 ;; that is done in vc-find-cvs-master. 1603 ;; that is done in vc-find-cvs-master.
1630 (vc-log-info 1604 (vc-log-info
1631 "cvs" file 'WORKFILE '("status") 1605 "cvs" file 'BASE '("status")
1632 ;; CVS 1.3 says "RCS Version:", other releases "RCS Revision:", 1606 ;; CVS 1.3 says "RCS Version:", other releases "RCS Revision:",
1633 ;; and CVS 1.4a1 says "Repository revision:". The regexp below 1607 ;; and CVS 1.4a1 says "Repository revision:". The regexp below
1634 ;; matches much more, but because of the way vc-log-info is 1608 ;; matches much more, but because of the way vc-log-info is
@@ -1680,7 +1654,7 @@ with RCS)."
1680 (and comment (concat "-t-" comment)) 1654 (and comment (concat "-t-" comment))
1681 file)) 1655 file))
1682 ((eq backend 'CVS) 1656 ((eq backend 'CVS)
1683 (vc-do-command 0 "cvs" file 'WORKFILE ;; CVS 1657 (vc-do-command 0 "cvs" file 'BASE ;; CVS
1684 "add" 1658 "add"
1685 (and comment (not (string= comment "")) 1659 (and comment (not (string= comment ""))
1686 (concat "-m" comment))) 1660 (concat "-m" comment)))
@@ -1763,7 +1737,7 @@ with RCS)."
1763 (unwind-protect 1737 (unwind-protect
1764 (progn 1738 (progn
1765 (apply 'vc-do-command 1739 (apply 'vc-do-command
1766 0 "/bin/sh" file 'WORKFILE "-c" 1740 0 "/bin/sh" file 'BASE "-c"
1767 "exec >\"$1\" || exit; shift; exec cvs update \"$@\"" 1741 "exec >\"$1\" || exit; shift; exec cvs update \"$@\""
1768 "" ; dummy argument for shell's $0 1742 "" ; dummy argument for shell's $0
1769 workfile 1743 workfile
@@ -1772,7 +1746,7 @@ with RCS)."
1772 vc-checkout-switches) 1746 vc-checkout-switches)
1773 (setq failed nil)) 1747 (setq failed nil))
1774 (and failed (file-exists-p filename) (delete-file filename)))) 1748 (and failed (file-exists-p filename) (delete-file filename))))
1775 (apply 'vc-do-command 0 "cvs" file 'WORKFILE 1749 (apply 'vc-do-command 0 "cvs" file 'BASE
1776 (and rev (concat "-r" rev)) 1750 (and rev (concat "-r" rev))
1777 file 1751 file
1778 vc-checkout-switches)) 1752 vc-checkout-switches))
@@ -1817,7 +1791,7 @@ with RCS)."
1817 (concat "-m" comment) 1791 (concat "-m" comment)
1818 vc-checkin-switches) 1792 vc-checkin-switches)
1819 (progn 1793 (progn
1820 (apply 'vc-do-command 0 "cvs" file 'WORKFILE 1794 (apply 'vc-do-command 0 "cvs" file 'BASE
1821 "ci" "-m" comment 1795 "ci" "-m" comment
1822 vc-checkin-switches) 1796 vc-checkin-switches)
1823 (vc-file-setprop file 'vc-checkout-time 1797 (vc-file-setprop file 'vc-checkout-time
@@ -1839,7 +1813,7 @@ with RCS)."
1839 "-f" "-u") 1813 "-f" "-u")
1840 (progn ;; CVS 1814 (progn ;; CVS
1841 (delete-file file) 1815 (delete-file file)
1842 (vc-do-command 0 "cvs" file 'WORKFILE "update")) 1816 (vc-do-command 0 "cvs" file 'BASE "update"))
1843 ) 1817 )
1844 (vc-file-setprop file 'vc-locking-user nil) 1818 (vc-file-setprop file 'vc-locking-user nil)
1845 (message "Reverting %s...done" file) 1819 (message "Reverting %s...done" file)
@@ -1879,14 +1853,14 @@ with RCS)."
1879 file 1853 file
1880 (vc-do-command 0 "prs" file 'MASTER) 1854 (vc-do-command 0 "prs" file 'MASTER)
1881 (vc-do-command 0 "rlog" file 'MASTER) 1855 (vc-do-command 0 "rlog" file 'MASTER)
1882 (vc-do-command 0 "cvs" file 'WORKFILE "rlog"))) 1856 (vc-do-command 0 "cvs" file 'BASE "rlog")))
1883 1857
1884(defun vc-backend-assign-name (file name) 1858(defun vc-backend-assign-name (file name)
1885 ;; Assign to a FILE's latest version a given NAME. 1859 ;; Assign to a FILE's latest version a given NAME.
1886 (vc-backend-dispatch file 1860 (vc-backend-dispatch file
1887 (vc-add-triple name file (vc-latest-version file)) ;; SCCS 1861 (vc-add-triple name file (vc-latest-version file)) ;; SCCS
1888 (vc-do-command 0 "rcs" file 'MASTER (concat "-n" name ":")) ;; RCS 1862 (vc-do-command 0 "rcs" file 'MASTER (concat "-n" name ":")) ;; RCS
1889 (vc-do-command 0 "cvs" file 'WORKFILE "tag" name) ;; CVS 1863 (vc-do-command 0 "cvs" file 'BASE "tag" name) ;; CVS
1890 ) 1864 )
1891 ) 1865 )
1892 1866
@@ -1904,7 +1878,6 @@ with RCS)."
1904 (let* ((command (if (eq backend 'SCCS) 1878 (let* ((command (if (eq backend 'SCCS)
1905 "vcdiff" 1879 "vcdiff"
1906 "rcsdiff")) 1880 "rcsdiff"))
1907 (mode (if (eq backend 'RCS) 'WORKFILE 'MASTER))
1908 (options (append (list (and cmp "--brief") 1881 (options (append (list (and cmp "--brief")
1909 "-q" 1882 "-q"
1910 (and oldvers (concat "-r" oldvers)) 1883 (and oldvers (concat "-r" oldvers))
@@ -1913,10 +1886,10 @@ with RCS)."
1913 (if (listp diff-switches) 1886 (if (listp diff-switches)
1914 diff-switches 1887 diff-switches
1915 (list diff-switches))))) 1888 (list diff-switches)))))
1916 (status (apply 'vc-do-command 2 command file mode options))) 1889 (status (apply 'vc-do-command 2 command file options)))
1917 ;; Some RCS versions don't understand "--brief"; work around this. 1890 ;; Some RCS versions don't understand "--brief"; work around this.
1918 (if (eq status 2) 1891 (if (eq status 2)
1919 (apply 'vc-do-command 1 command file 'WORKFILE 1892 (apply 'vc-do-command 1 command file 'MASTER
1920 (if cmp (cdr options) options)) 1893 (if cmp (cdr options) options))
1921 status))) 1894 status)))
1922 ;; CVS is different. 1895 ;; CVS is different.
@@ -1928,12 +1901,12 @@ with RCS)."
1928 (if (or oldvers newvers) 1901 (if (or oldvers newvers)
1929 (error "No revisions of %s exists" file) 1902 (error "No revisions of %s exists" file)
1930 (apply 'vc-do-command 1903 (apply 'vc-do-command
1931 1 "diff" file 'WORKFILE "/dev/null" 1904 1 "diff" file 'BASE "/dev/null"
1932 (if (listp diff-switches) 1905 (if (listp diff-switches)
1933 diff-switches 1906 diff-switches
1934 (list diff-switches)))) 1907 (list diff-switches))))
1935 (apply 'vc-do-command 1908 (apply 'vc-do-command
1936 1 "cvs" file 'WORKFILE "diff" 1909 1 "cvs" file 'BASE "diff"
1937 (and oldvers (concat "-r" oldvers)) 1910 (and oldvers (concat "-r" oldvers))
1938 (and newvers (concat "-r" newvers)) 1911 (and newvers (concat "-r" newvers))
1939 (if (listp diff-switches) 1912 (if (listp diff-switches)
@@ -1948,7 +1921,7 @@ with RCS)."
1948 file 1921 file
1949 (error "vc-backend-merge-news not meaningful for SCCS files") ;SCCS 1922 (error "vc-backend-merge-news not meaningful for SCCS files") ;SCCS
1950 (error "vc-backend-merge-news not meaningful for RCS files") ;RCS 1923 (error "vc-backend-merge-news not meaningful for RCS files") ;RCS
1951 (vc-do-command 1 "cvs" file 'WORKFILE "update") ;CVS 1924 (vc-do-command 1 "cvs" file 'BASE "update") ;CVS
1952 )) 1925 ))
1953 1926
1954(defun vc-check-headers () 1927(defun vc-check-headers ()
@@ -2068,7 +2041,6 @@ Invoke FUNC f ARGS on each non-directory file f underneath it."
2068 (lambda (f) (or 2041 (lambda (f) (or
2069 (string-equal f ".") 2042 (string-equal f ".")
2070 (string-equal f "..") 2043 (string-equal f "..")
2071 (member f vc-directory-exclusion-list)
2072 (let ((dirf (concat dir f))) 2044 (let ((dirf (concat dir f)))
2073 (or 2045 (or
2074 (file-symlink-p dirf) ;; Avoid possible loops 2046 (file-symlink-p dirf) ;; Avoid possible loops