Mercurial > emacs
comparison lisp/vc-sccs.el @ 94190:fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
(vc-sccs-register, vc-sccs-checkin, vc-sccs-find-revision)
(vc-sccs-checkout, vc-sccs-rollback, vc-sccs-revert)
(vc-sccs-steal-lock, vc-sccs-modify-change-comment)
(vc-sccs-print-log): Use it.
* lisp/vc-hooks.el (vc-path): Remove SCCS-specific hack.
* lib-src/vcdiff: Use "sccs get" rather than "get"; leave PATH alone.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 19 Apr 2008 21:53:55 +0000 |
parents | 2ecb2ea8d5b5 |
children | 2a61c5f918a5 |
comparison
equal
deleted
inserted
replaced
94189:c1b4e330f616 | 94190:fad57210c7d2 |
---|---|
36 (require 'vc)) | 36 (require 'vc)) |
37 | 37 |
38 ;;; | 38 ;;; |
39 ;;; Customization options | 39 ;;; Customization options |
40 ;;; | 40 ;;; |
41 | |
42 ;; ;; Maybe a better solution is to not use "get" but "sccs get". | |
43 ;; (defcustom vc-sccs-path | |
44 ;; (let ((path ())) | |
45 ;; (dolist (dir '("/usr/sccs" "/usr/lib/sccs" "/usr/libexec/sccs")) | |
46 ;; (if (file-directory-p dir) | |
47 ;; (push dir path))) | |
48 ;; path) | |
49 ;; "List of extra directories to search for SCCS commands." | |
50 ;; :type '(repeat directory) | |
51 ;; :group 'vc) | |
41 | 52 |
42 (defcustom vc-sccs-register-switches nil | 53 (defcustom vc-sccs-register-switches nil |
43 "*Extra switches for registering a file in SCCS. | 54 "*Extra switches for registering a file in SCCS. |
44 A string or list of strings passed to the checkin program by | 55 A string or list of strings passed to the checkin program by |
45 \\[vc-sccs-register]." | 56 \\[vc-sccs-register]." |
88 (defconst vc-sccs-name-assoc-file "VC-names") | 99 (defconst vc-sccs-name-assoc-file "VC-names") |
89 | 100 |
90 | 101 |
91 ;;; Properties of the backend | 102 ;;; Properties of the backend |
92 | 103 |
93 (defun vc-sccs-revision-granularity () | 104 (defun vc-sccs-revision-granularity () 'file) |
94 'file) | |
95 | 105 |
96 ;;; | 106 ;;; |
97 ;;; State-querying functions | 107 ;;; State-querying functions |
98 ;;; | 108 ;;; |
99 | 109 |
100 ;;; The autoload cookie below places vc-sccs-registered directly into | 110 ;; The autoload cookie below places vc-sccs-registered directly into |
101 ;;; loaddefs.el, so that vc-sccs.el does not need to be loaded for | 111 ;; loaddefs.el, so that vc-sccs.el does not need to be loaded for |
102 ;;; every file that is visited. The definition is repeated below | 112 ;; every file that is visited. The definition is repeated below |
103 ;;; so that Help and etags can find it. | 113 ;; so that Help and etags can find it. |
104 | 114 |
105 ;;;###autoload (defun vc-sccs-registered(f) (vc-default-registered 'SCCS f)) | 115 ;;;###autoload (defun vc-sccs-registered(f) (vc-default-registered 'SCCS f)) |
106 (defun vc-sccs-registered (f) (vc-default-registered 'SCCS f)) | 116 (defun vc-sccs-registered (f) (vc-default-registered 'SCCS f)) |
107 | 117 |
108 (defun vc-sccs-state (file) | 118 (defun vc-sccs-state (file) |
179 | 189 |
180 ;;; | 190 ;;; |
181 ;;; State-changing functions | 191 ;;; State-changing functions |
182 ;;; | 192 ;;; |
183 | 193 |
194 (defun vc-sccs-do-command (buffer okstatus command file-or-list &rest flags) | |
195 ;; (let ((load-path (append vc-sccs-path load-path))) | |
196 ;; (apply 'vc-do-command buffer okstatus command file-or-list flags)) | |
197 (apply 'vc-do-command buffer okstatus "sccs" file-or-list command flags)) | |
198 | |
184 (defun vc-sccs-create-repo () | 199 (defun vc-sccs-create-repo () |
185 "Create a new SCCS repository." | 200 "Create a new SCCS repository." |
186 ;; SCCS is totally file-oriented, so all we have to do is make the directory | 201 ;; SCCS is totally file-oriented, so all we have to do is make the directory |
187 (make-directory "SCCS")) | 202 (make-directory "SCCS")) |
188 | 203 |
201 (basename (file-name-nondirectory file)) | 216 (basename (file-name-nondirectory file)) |
202 (project-file (vc-sccs-search-project-dir dirname basename))) | 217 (project-file (vc-sccs-search-project-dir dirname basename))) |
203 (let ((vc-name | 218 (let ((vc-name |
204 (or project-file | 219 (or project-file |
205 (format (car vc-sccs-master-templates) dirname basename)))) | 220 (format (car vc-sccs-master-templates) dirname basename)))) |
206 (apply 'vc-do-command nil 0 "admin" vc-name | 221 (apply 'vc-sccs-do-command nil 0 "admin" vc-name |
207 (and rev (not (string= rev "")) (concat "-r" rev)) | 222 (and rev (not (string= rev "")) (concat "-r" rev)) |
208 "-fb" | 223 "-fb" |
209 (concat "-i" (file-relative-name file)) | 224 (concat "-i" (file-relative-name file)) |
210 (and comment (concat "-y" comment)) | 225 (and comment (concat "-y" comment)) |
211 (vc-switches 'SCCS 'register))) | 226 (vc-switches 'SCCS 'register))) |
212 (delete-file file) | 227 (delete-file file) |
213 (if vc-keep-workfiles | 228 (if vc-keep-workfiles |
214 (vc-do-command nil 0 "get" (vc-name file)))))) | 229 (vc-sccs-do-command nil 0 "get" (vc-name file)))))) |
215 | 230 |
216 (defun vc-sccs-responsible-p (file) | 231 (defun vc-sccs-responsible-p (file) |
217 "Return non-nil if SCCS thinks it would be responsible for registering FILE." | 232 "Return non-nil if SCCS thinks it would be responsible for registering FILE." |
218 ;; TODO: check for all the patterns in vc-sccs-master-templates | 233 ;; TODO: check for all the patterns in vc-sccs-master-templates |
219 (or (file-directory-p (expand-file-name "SCCS" (file-name-directory file))) | 234 (or (file-directory-p (expand-file-name "SCCS" (file-name-directory file))) |
221 (file-name-nondirectory file))))) | 236 (file-name-nondirectory file))))) |
222 | 237 |
223 (defun vc-sccs-checkin (files rev comment) | 238 (defun vc-sccs-checkin (files rev comment) |
224 "SCCS-specific version of `vc-backend-checkin'." | 239 "SCCS-specific version of `vc-backend-checkin'." |
225 (dolist (file files) | 240 (dolist (file files) |
226 (apply 'vc-do-command nil 0 "delta" (vc-name file) | 241 (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file) |
227 (if rev (concat "-r" rev)) | 242 (if rev (concat "-r" rev)) |
228 (concat "-y" comment) | 243 (concat "-y" comment) |
229 (vc-switches 'SCCS 'checkin)) | 244 (vc-switches 'SCCS 'checkin)) |
230 (if vc-keep-workfiles | 245 (if vc-keep-workfiles |
231 (vc-do-command nil 0 "get" (vc-name file))))) | 246 (vc-sccs-do-command nil 0 "get" (vc-name file))))) |
232 | 247 |
233 (defun vc-sccs-find-revision (file rev buffer) | 248 (defun vc-sccs-find-revision (file rev buffer) |
234 (apply 'vc-do-command | 249 (apply 'vc-sccs-do-command |
235 buffer 0 "get" (vc-name file) | 250 buffer 0 "get" (vc-name file) |
236 "-s" ;; suppress diagnostic output | 251 "-s" ;; suppress diagnostic output |
237 "-p" | 252 "-p" |
238 (and rev | 253 (and rev |
239 (concat "-r" | 254 (concat "-r" |
261 (setq default-directory (file-name-directory file)) | 276 (setq default-directory (file-name-directory file)) |
262 | 277 |
263 (and rev (or (string= rev "") | 278 (and rev (or (string= rev "") |
264 (not (stringp rev))) | 279 (not (stringp rev))) |
265 (setq rev nil)) | 280 (setq rev nil)) |
266 (apply 'vc-do-command nil 0 "get" (vc-name file) | 281 (apply 'vc-sccs-do-command nil 0 "get" (vc-name file) |
267 (if editable "-e") | 282 (if editable "-e") |
268 (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) | 283 (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) |
269 switches)))) | 284 switches)))) |
270 (message "Checking out %s...done" file))) | 285 (message "Checking out %s...done" file))) |
271 | 286 |
277 (let ((discard (vc-working-revision file))) | 292 (let ((discard (vc-working-revision file))) |
278 (if (null (yes-or-no-p (format "Remove version %s from %s history? " | 293 (if (null (yes-or-no-p (format "Remove version %s from %s history? " |
279 discard file))) | 294 discard file))) |
280 (error "Aborted")) | 295 (error "Aborted")) |
281 (message "Removing revision %s from %s..." discard file) | 296 (message "Removing revision %s from %s..." discard file) |
282 (vc-do-command nil 0 "rmdel" (vc-name file) (concat "-r" discard)) | 297 (vc-sccs-do-command nil 0 "rmdel" |
283 (vc-do-command nil 0 "get" (vc-name file) nil)))) | 298 (vc-name file) (concat "-r" discard)) |
299 (vc-sccs-do-command nil 0 "get" (vc-name file) nil)))) | |
284 | 300 |
285 (defun vc-sccs-revert (file &optional contents-done) | 301 (defun vc-sccs-revert (file &optional contents-done) |
286 "Revert FILE to the version it was based on." | 302 "Revert FILE to the version it was based on." |
287 (vc-do-command nil 0 "unget" (vc-name file)) | 303 (vc-sccs-do-command nil 0 "unget" (vc-name file)) |
288 (vc-do-command nil 0 "get" (vc-name file)) | 304 (vc-sccs-do-command nil 0 "get" (vc-name file)) |
289 ;; Checking out explicit revisions is not supported under SCCS, yet. | 305 ;; Checking out explicit revisions is not supported under SCCS, yet. |
290 ;; We always "revert" to the latest revision; therefore | 306 ;; We always "revert" to the latest revision; therefore |
291 ;; vc-working-revision is cleared here so that it gets recomputed. | 307 ;; vc-working-revision is cleared here so that it gets recomputed. |
292 (vc-file-setprop file 'vc-working-revision nil)) | 308 (vc-file-setprop file 'vc-working-revision nil)) |
293 | 309 |
294 (defun vc-sccs-steal-lock (file &optional rev) | 310 (defun vc-sccs-steal-lock (file &optional rev) |
295 "Steal the lock on the current workfile for FILE and revision REV." | 311 "Steal the lock on the current workfile for FILE and revision REV." |
296 (vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev))) | 312 (vc-sccs-do-command nil 0 "unget" |
297 (vc-do-command nil 0 "get" (vc-name file) "-g" (if rev (concat "-r" rev)))) | 313 (vc-name file) "-n" (if rev (concat "-r" rev))) |
314 (vc-sccs-do-command nil 0 "get" | |
315 (vc-name file) "-g" (if rev (concat "-r" rev)))) | |
298 | 316 |
299 (defun vc-sccs-modify-change-comment (files rev comment) | 317 (defun vc-sccs-modify-change-comment (files rev comment) |
300 "Modify (actually, append to) the change comments for FILES on a specified REV." | 318 "Modify (actually, append to) the change comments for FILES on a specified REV." |
301 (dolist (file files) | 319 (dolist (file files) |
302 (vc-do-command nil 0 "cdc" (vc-name file) | 320 (vc-sccs-do-command nil 0 "cdc" (vc-name file) |
303 (concat "-y" comment) (concat "-r" rev)))) | 321 (concat "-y" comment) (concat "-r" rev)))) |
304 | 322 |
305 | 323 |
306 ;;; | 324 ;;; |
307 ;;; History functions | 325 ;;; History functions |
308 ;;; | 326 ;;; |
309 | 327 |
310 (defun vc-sccs-print-log (files &optional buffer) | 328 (defun vc-sccs-print-log (files &optional buffer) |
311 "Get change log associated with FILES." | 329 "Get change log associated with FILES." |
312 (vc-do-command buffer 0 "prs" (mapcar 'vc-name files))) | 330 (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-name files))) |
313 | 331 |
314 (defun vc-sccs-wash-log () | 332 (defun vc-sccs-wash-log () |
315 "Remove all non-comment information from log output." | 333 "Remove all non-comment information from log output." |
316 ;; FIXME: not implemented for SCCS | 334 ;; FIXME: not implemented for SCCS |
317 nil) | 335 nil) |