diff options
| author | Eric S. Raymond | 2008-05-09 16:33:30 +0000 |
|---|---|---|
| committer | Eric S. Raymond | 2008-05-09 16:33:30 +0000 |
| commit | e7290559824406d111d306069b36dde8ced847f9 (patch) | |
| tree | 0ce9587aaee9ace4820935dbac88130ff2831b69 | |
| parent | 734abae3d8c646d1a75a0703b255ed207b570605 (diff) | |
| download | emacs-e7290559824406d111d306069b36dde8ced847f9.tar.gz emacs-e7290559824406d111d306069b36dde8ced847f9.zip | |
Make SCCS backend directory-aware.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/vc-sccs.el | 94 |
2 files changed, 60 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 82dcd049bc4..bc21788653b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2008-05-09 Eric S. Raymond <esr@snark.thyrsus.com> | ||
| 2 | |||
| 3 | * vc-scs.el (vc-sccs-checkin, vc-sccs-checkout, vc-sccs-rollback, | ||
| 4 | vc-sccs-revert, vc-sccs-steal-lock, vc-sccs-modify-change-comment, | ||
| 5 | vc-sccs-print-log, vc-sccs-diff): Teach SCCS back end to grok | ||
| 6 | directories. | ||
| 7 | |||
| 1 | 2008-05-09 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2008-05-09 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * vc.el (vc-deduce-fileset): Don't require the checkout-model and the | 10 | * vc.el (vc-deduce-fileset): Don't require the checkout-model and the |
| @@ -21,8 +28,8 @@ | |||
| 21 | 2008-05-09 Eric S. Raymond <esr@snark.thyrsus.com> | 28 | 2008-05-09 Eric S. Raymond <esr@snark.thyrsus.com> |
| 22 | 29 | ||
| 23 | * vc.el (vc-deduce-fileset, vc-next-action, vc-version-diff) | 30 | * vc.el (vc-deduce-fileset, vc-next-action, vc-version-diff) |
| 24 | (vc-diff, vc-revert, vc-rollback, vc-update): | 31 | (vc-diff, vc-revert, vc-rollback, vc-update), |
| 25 | * vc-dispatcher.el (vc-dispatcher-selection-set): | 32 | vc-dispatcher.el (vc-dispatcher-selection-set): |
| 26 | Get rid of 4 special cases in fileset selection. This involved | 33 | Get rid of 4 special cases in fileset selection. This involved |
| 27 | changing the return value of (vc-deduce-fileset) so that it passes | 34 | changing the return value of (vc-deduce-fileset) so that it passes |
| 28 | back a deduced state as well as a deduced back end, | 35 | back a deduced state as well as a deduced back end, |
diff --git a/lisp/vc-sccs.el b/lisp/vc-sccs.el index da7cc64545e..af3a226052a 100644 --- a/lisp/vc-sccs.el +++ b/lisp/vc-sccs.el | |||
| @@ -24,10 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; TODO: | ||
| 28 | ;; - remove call to vc-expand-dirs by implementing our own (which can just | ||
| 29 | ;; list the SCCS subdir instead). | ||
| 30 | |||
| 31 | ;;; Code: | 27 | ;;; Code: |
| 32 | 28 | ||
| 33 | (eval-when-compile | 29 | (eval-when-compile |
| @@ -156,7 +152,7 @@ For a description of possible values, see `vc-check-master-templates'." | |||
| 156 | (vc-sccs-state file))) | 152 | (vc-sccs-state file))) |
| 157 | 153 | ||
| 158 | (defun vc-sccs-dir-status (dir update-function) | 154 | (defun vc-sccs-dir-status (dir update-function) |
| 159 | ;; Doing loys of undividual VC-state calls is painful, but | 155 | ;; Doing lots of individual VC-state calls is painful, but |
| 160 | ;; there is no better option in SCCS-land. | 156 | ;; there is no better option in SCCS-land. |
| 161 | (let ((flist (vc-expand-dirs (list dir))) | 157 | (let ((flist (vc-expand-dirs (list dir))) |
| 162 | (result nil)) | 158 | (result nil)) |
| @@ -233,7 +229,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." | |||
| 233 | 229 | ||
| 234 | (defun vc-sccs-checkin (files rev comment) | 230 | (defun vc-sccs-checkin (files rev comment) |
| 235 | "SCCS-specific version of `vc-backend-checkin'." | 231 | "SCCS-specific version of `vc-backend-checkin'." |
| 236 | (dolist (file files) | 232 | (dolist (file (vc-expand-dirs files)) |
| 237 | (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file) | 233 | (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file) |
| 238 | (if rev (concat "-r" rev)) | 234 | (if rev (concat "-r" rev)) |
| 239 | (concat "-y" comment) | 235 | (concat "-y" comment) |
| @@ -253,35 +249,40 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." | |||
| 253 | 249 | ||
| 254 | (defun vc-sccs-checkout (file &optional editable rev) | 250 | (defun vc-sccs-checkout (file &optional editable rev) |
| 255 | "Retrieve a copy of a saved revision of SCCS controlled FILE. | 251 | "Retrieve a copy of a saved revision of SCCS controlled FILE. |
| 252 | If FILE is a directory, all version-controlled files beneath are checked out. | ||
| 256 | EDITABLE non-nil means that the file should be writable and | 253 | EDITABLE non-nil means that the file should be writable and |
| 257 | locked. REV is the revision to check out." | 254 | locked. REV is the revision to check out." |
| 258 | (let ((file-buffer (get-file-buffer file)) | 255 | (if (file-directory-p file) |
| 259 | switches) | 256 | (mapc 'vc-sccs-checkout (vc-expand-dirs (list file))) |
| 260 | (message "Checking out %s..." file) | 257 | (let ((file-buffer (get-file-buffer file)) |
| 261 | (save-excursion | 258 | switches) |
| 262 | ;; Change buffers to get local value of vc-checkout-switches. | 259 | (message "Checking out %s..." file) |
| 263 | (if file-buffer (set-buffer file-buffer)) | 260 | (save-excursion |
| 264 | (setq switches (vc-switches 'SCCS 'checkout)) | 261 | ;; Change buffers to get local value of vc-checkout-switches. |
| 265 | ;; Save this buffer's default-directory | 262 | (if file-buffer (set-buffer file-buffer)) |
| 266 | ;; and use save-excursion to make sure it is restored | 263 | (setq switches (vc-switches 'SCCS 'checkout)) |
| 267 | ;; in the same buffer it was saved in. | 264 | ;; Save this buffer's default-directory |
| 268 | (let ((default-directory default-directory)) | 265 | ;; and use save-excursion to make sure it is restored |
| 269 | (save-excursion | 266 | ;; in the same buffer it was saved in. |
| 270 | ;; Adjust the default-directory so that the check-out creates | 267 | (let ((default-directory default-directory)) |
| 271 | ;; the file in the right place. | 268 | (save-excursion |
| 272 | (setq default-directory (file-name-directory file)) | 269 | ;; Adjust the default-directory so that the check-out creates |
| 273 | 270 | ;; the file in the right place. | |
| 274 | (and rev (or (string= rev "") | 271 | (setq default-directory (file-name-directory file)) |
| 275 | (not (stringp rev))) | 272 | |
| 276 | (setq rev nil)) | 273 | (and rev (or (string= rev "") |
| 277 | (apply 'vc-sccs-do-command nil 0 "get" (vc-name file) | 274 | (not (stringp rev))) |
| 278 | (if editable "-e") | 275 | (setq rev nil)) |
| 279 | (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) | 276 | (apply 'vc-sccs-do-command nil 0 "get" (vc-name file) |
| 280 | switches)))) | 277 | (if editable "-e") |
| 281 | (message "Checking out %s...done" file))) | 278 | (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) |
| 279 | switches)))) | ||
| 280 | (message "Checking out %s...done" file)))) | ||
| 282 | 281 | ||
| 283 | (defun vc-sccs-rollback (files) | 282 | (defun vc-sccs-rollback (files) |
| 284 | "Roll back, undoing the most recent checkins of FILES." | 283 | "Roll back, undoing the most recent checkins of FILES. Directories |
| 284 | are expanded to all version-controlled subfiles." | ||
| 285 | (setq files (vc-expand-dirs files)) | ||
| 285 | (if (not files) | 286 | (if (not files) |
| 286 | (error "SCCS backend doesn't support directory-level rollback.")) | 287 | (error "SCCS backend doesn't support directory-level rollback.")) |
| 287 | (dolist (file files) | 288 | (dolist (file files) |
| @@ -295,24 +296,29 @@ locked. REV is the revision to check out." | |||
| 295 | (vc-sccs-do-command nil 0 "get" (vc-name file) nil)))) | 296 | (vc-sccs-do-command nil 0 "get" (vc-name file) nil)))) |
| 296 | 297 | ||
| 297 | (defun vc-sccs-revert (file &optional contents-done) | 298 | (defun vc-sccs-revert (file &optional contents-done) |
| 298 | "Revert FILE to the version it was based on." | 299 | "Revert FILE to the version it was based on. If FILE is a directory, |
| 299 | (vc-sccs-do-command nil 0 "unget" (vc-name file)) | 300 | revert all subfiles." |
| 300 | (vc-sccs-do-command nil 0 "get" (vc-name file)) | 301 | (if (file-directory-p file) |
| 301 | ;; Checking out explicit revisions is not supported under SCCS, yet. | 302 | (mapc 'vc-sccs-revert (vc-expand-dirs (list file))) |
| 302 | ;; We always "revert" to the latest revision; therefore | 303 | (vc-sccs-do-command nil 0 "unget" (vc-name file)) |
| 303 | ;; vc-working-revision is cleared here so that it gets recomputed. | 304 | (vc-sccs-do-command nil 0 "get" (vc-name file)) |
| 304 | (vc-file-setprop file 'vc-working-revision nil)) | 305 | ;; Checking out explicit revisions is not supported under SCCS, yet. |
| 306 | ;; We always "revert" to the latest revision; therefore | ||
| 307 | ;; vc-working-revision is cleared here so that it gets recomputed. | ||
| 308 | (vc-file-setprop file 'vc-working-revision nil))) | ||
| 305 | 309 | ||
| 306 | (defun vc-sccs-steal-lock (file &optional rev) | 310 | (defun vc-sccs-steal-lock (file &optional rev) |
| 307 | "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." |
| 308 | (vc-sccs-do-command nil 0 "unget" | 312 | (if (file-directory-p file) |
| 309 | (vc-name file) "-n" (if rev (concat "-r" rev))) | 313 | (mapc 'vc-sccs-steal-lock (vc-expand-dirs (list file))) |
| 310 | (vc-sccs-do-command nil 0 "get" | 314 | (vc-sccs-do-command nil 0 "unget" |
| 311 | (vc-name file) "-g" (if rev (concat "-r" rev)))) | 315 | (vc-name file) "-n" (if rev (concat "-r" rev))) |
| 316 | (vc-sccs-do-command nil 0 "get" | ||
| 317 | (vc-name file) "-g" (if rev (concat "-r" rev))))) | ||
| 312 | 318 | ||
| 313 | (defun vc-sccs-modify-change-comment (files rev comment) | 319 | (defun vc-sccs-modify-change-comment (files rev comment) |
| 314 | "Modify (actually, append to) the change comments for FILES on a specified REV." | 320 | "Modify (actually, append to) the change comments for FILES on a specified REV." |
| 315 | (dolist (file files) | 321 | (dolist (file (vc-expand-dirs files)) |
| 316 | (vc-sccs-do-command nil 0 "cdc" (vc-name file) | 322 | (vc-sccs-do-command nil 0 "cdc" (vc-name file) |
| 317 | (concat "-y" comment) (concat "-r" rev)))) | 323 | (concat "-y" comment) (concat "-r" rev)))) |
| 318 | 324 | ||
| @@ -323,6 +329,7 @@ locked. REV is the revision to check out." | |||
| 323 | 329 | ||
| 324 | (defun vc-sccs-print-log (files &optional buffer) | 330 | (defun vc-sccs-print-log (files &optional buffer) |
| 325 | "Get change log associated with FILES." | 331 | "Get change log associated with FILES." |
| 332 | (setq files (vc-expand-dirs files)) | ||
| 326 | (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-name files))) | 333 | (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-name files))) |
| 327 | 334 | ||
| 328 | (defun vc-sccs-wash-log () | 335 | (defun vc-sccs-wash-log () |
| @@ -332,6 +339,7 @@ locked. REV is the revision to check out." | |||
| 332 | 339 | ||
| 333 | (defun vc-sccs-diff (files &optional oldvers newvers buffer) | 340 | (defun vc-sccs-diff (files &optional oldvers newvers buffer) |
| 334 | "Get a difference report using SCCS between two filesets." | 341 | "Get a difference report using SCCS between two filesets." |
| 342 | (setq files (vc-expand-dirs files)) | ||
| 335 | (setq oldvers (vc-sccs-lookup-triple (car files) oldvers)) | 343 | (setq oldvers (vc-sccs-lookup-triple (car files) oldvers)) |
| 336 | (setq newvers (vc-sccs-lookup-triple (car files) newvers)) | 344 | (setq newvers (vc-sccs-lookup-triple (car files) newvers)) |
| 337 | (apply 'vc-do-command (or buffer "*vc-diff*") | 345 | (apply 'vc-do-command (or buffer "*vc-diff*") |