aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2002-10-08 15:35:03 +0000
committerStefan Monnier2002-10-08 15:35:03 +0000
commit52876673e6c7255e2d467bd840290eec2966c27f (patch)
tree57e2656c063a4264dbdae899b7c2cd549f7ef818
parent88388365b03d74c786018d4edf03bfd1ddd65e0b (diff)
downloademacs-52876673e6c7255e2d467bd840290eec2966c27f.tar.gz
emacs-52876673e6c7255e2d467bd840290eec2966c27f.zip
(vc-sccs-find-version): New fun.
(vc-sccs-checkout): Remove `workfile' arg and simplify.
-rw-r--r--lisp/vc-sccs.el63
1 files changed, 22 insertions, 41 deletions
diff --git a/lisp/vc-sccs.el b/lisp/vc-sccs.el
index 3c4817a1f63..10426a46bae 100644
--- a/lisp/vc-sccs.el
+++ b/lisp/vc-sccs.el
@@ -5,7 +5,7 @@
5;; Author: FSF (see vc.el for full credits) 5;; Author: FSF (see vc.el for full credits)
6;; Maintainer: Andre Spiegel <spiegel@gnu.org> 6;; Maintainer: Andre Spiegel <spiegel@gnu.org>
7 7
8;; $Id: vc-sccs.el,v 1.14 2002/02/25 22:05:16 spiegel Exp $ 8;; $Id: vc-sccs.el,v 1.15 2002/03/18 17:20:43 spiegel Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -203,14 +203,23 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
203 (if vc-keep-workfiles 203 (if vc-keep-workfiles
204 (vc-do-command nil 0 "get" (vc-name file))))) 204 (vc-do-command nil 0 "get" (vc-name file)))))
205 205
206(defun vc-sccs-checkout (file &optional editable rev workfile) 206(defun vc-sccs-find-version (file rev buffer)
207 "Retrieve a copy of a saved version of SCCS controlled FILE into a WORKFILE. 207 (apply 'vc-do-command
208 buffer 0 "get" (vc-name file)
209 "-s" ;; suppress diagnostic output
210 "-p"
211 (and rev
212 (concat "-r"
213 (vc-sccs-lookup-triple file rev)))
214 vc-checkout-switches))
215
216(defun vc-sccs-checkout (file &optional editable rev)
217 "Retrieve a copy of a saved version of SCCS controlled FILE.
208EDITABLE non-nil means that the file should be writable and 218EDITABLE non-nil means that the file should be writable and
209locked. REV is the revision to check out into WORKFILE." 219locked. REV is the revision to check out."
210 (let ((filename (or workfile file)) 220 (let ((file-buffer (get-file-buffer file))
211 (file-buffer (get-file-buffer file))
212 switches) 221 switches)
213 (message "Checking out %s..." filename) 222 (message "Checking out %s..." file)
214 (save-excursion 223 (save-excursion
215 ;; Change buffers to get local value of vc-checkout-switches. 224 ;; Change buffers to get local value of vc-checkout-switches.
216 (if file-buffer (set-buffer file-buffer)) 225 (if file-buffer (set-buffer file-buffer))
@@ -224,42 +233,14 @@ locked. REV is the revision to check out into WORKFILE."
224 (save-excursion 233 (save-excursion
225 ;; Adjust the default-directory so that the check-out creates 234 ;; Adjust the default-directory so that the check-out creates
226 ;; the file in the right place. 235 ;; the file in the right place.
227 (setq default-directory (file-name-directory filename)) 236 (setq default-directory (file-name-directory file))
228 237
229 (and rev (string= rev "") (setq rev nil)) 238 (and rev (string= rev "") (setq rev nil))
230 (if workfile 239 (apply 'vc-do-command nil 0 "get" (vc-name file)
231 ;; Some SCCS implementations allow checking out directly to a 240 (if editable "-e")
232 ;; file using the -G option, but then some don't so use the 241 (and rev (concat "-r" (vc-sccs-lookup-triple file rev)))
233 ;; least common denominator approach and use the -p option 242 switches))))
234 ;; ala RCS. 243 (message "Checking out %s...done" file)))
235 (let ((vc-modes (logior (file-modes (vc-name file))
236 (if editable 128 0)))
237 (failed t))
238 (unwind-protect
239 (progn
240 (let ((coding-system-for-read 'no-conversion)
241 (coding-system-for-write 'no-conversion))
242 (with-temp-file filename
243 (apply 'vc-do-command
244 (current-buffer) 0 "get" (vc-name file)
245 "-s" ;; suppress diagnostic output
246 (if editable "-e")
247 "-p"
248 (and rev
249 (concat "-r"
250 (vc-sccs-lookup-triple file rev)))
251 switches)))
252 (set-file-modes filename
253 (logior (file-modes (vc-name file))
254 (if editable 128 0)))
255 (setq failed nil))
256 (and failed (file-exists-p filename)
257 (delete-file filename))))
258 (apply 'vc-do-command nil 0 "get" (vc-name file)
259 (if editable "-e")
260 (and rev (concat "-r" (vc-sccs-lookup-triple file rev)))
261 switches)))))
262 (message "Checking out %s...done" filename)))
263 244
264(defun vc-sccs-revert (file &optional contents-done) 245(defun vc-sccs-revert (file &optional contents-done)
265 "Revert FILE to the version it was based on." 246 "Revert FILE to the version it was based on."