diff options
| author | Stefan Monnier | 2008-04-29 15:32:56 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-29 15:32:56 +0000 |
| commit | e0607aaa2c6b33104fed475eb15452b2cdb6df03 (patch) | |
| tree | bb3f35077180a6aa3f3fcf7399c68d4b7e2a4fb4 | |
| parent | b95ced6beee4bf2afccfc5aa0670d110d6afdfa6 (diff) | |
| download | emacs-e0607aaa2c6b33104fed475eb15452b2cdb6df03.tar.gz emacs-e0607aaa2c6b33104fed475eb15452b2cdb6df03.zip | |
Make `checkout-model' apply to filesets.
* vc-hooks.el (vc-checkout-model): Rewrite.
(vc-before-save, vc-after-save): Adjust callers accordingly.
* vc.el (vc-editable-p, vc-next-action, vc-checkout, vc-update)
(vc-transfer-file): Adjust callers accordingly.
* vc-rcs.el (vc-rcs-checkout-model): Adjust arg.
(vc-rcs-state, vc-rcs-state-heuristic, vc-rcs-receive-file)
(vc-rcs-checkout, vc-rcs-fetch-master-state): Use vc-rcs-checkout-model
instead of vc-checkout-model.
* vc-mcvs.el (vc-mcvs-revert):
Use vc-mcvs-checkout-model i.s.o vc-checkout-model.
* vc-cvs.el (vc-cvs-checkout-model): Adjust arg.
(vc-cvs-revert): Use vc-cvs-checkout-model i.s.o vc-checkout-model.
* vc-svn.el (vc-svn-checkout-model):
* vc-hg.el (vc-hg-checkout-model):
* vc-git.el (vc-git-checkout-model):
* vc-bzr.el (vc-bzr-checkout-model): Adjust arg.
| -rw-r--r-- | lisp/ChangeLog | 18 | ||||
| -rw-r--r-- | lisp/vc-bzr.el | 3 | ||||
| -rw-r--r-- | lisp/vc-cvs.el | 32 | ||||
| -rw-r--r-- | lisp/vc-git.el | 3 | ||||
| -rw-r--r-- | lisp/vc-hg.el | 3 | ||||
| -rw-r--r-- | lisp/vc-hooks.el | 31 | ||||
| -rw-r--r-- | lisp/vc-mcvs.el | 2 | ||||
| -rw-r--r-- | lisp/vc-rcs.el | 28 | ||||
| -rw-r--r-- | lisp/vc-svn.el | 2 | ||||
| -rw-r--r-- | lisp/vc.el | 59 |
10 files changed, 101 insertions, 80 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1661bfa789c..4d83c8050f2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,23 @@ | |||
| 1 | 2008-04-29 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-04-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | Make `checkout-model' apply to filesets. | ||
| 4 | * vc-hooks.el (vc-checkout-model): Rewrite. | ||
| 5 | (vc-before-save, vc-after-save): Adjust callers accordingly. | ||
| 6 | * vc.el (vc-editable-p, vc-next-action, vc-checkout, vc-update) | ||
| 7 | (vc-transfer-file): Adjust callers accordingly. | ||
| 8 | * vc-rcs.el (vc-rcs-checkout-model): Adjust arg. | ||
| 9 | (vc-rcs-state, vc-rcs-state-heuristic, vc-rcs-receive-file) | ||
| 10 | (vc-rcs-checkout, vc-rcs-fetch-master-state): Use vc-rcs-checkout-model | ||
| 11 | instead of vc-checkout-model. | ||
| 12 | * vc-mcvs.el (vc-mcvs-revert): | ||
| 13 | Use vc-mcvs-checkout-model i.s.o vc-checkout-model. | ||
| 14 | * vc-cvs.el (vc-cvs-checkout-model): Adjust arg. | ||
| 15 | (vc-cvs-revert): Use vc-cvs-checkout-model i.s.o vc-checkout-model. | ||
| 16 | * vc-svn.el (vc-svn-checkout-model): | ||
| 17 | * vc-hg.el (vc-hg-checkout-model): | ||
| 18 | * vc-git.el (vc-git-checkout-model): | ||
| 19 | * vc-bzr.el (vc-bzr-checkout-model): Adjust arg. | ||
| 20 | |||
| 3 | * dired.el (dired-read-dir-and-switches): Replace last change with | 21 | * dired.el (dired-read-dir-and-switches): Replace last change with |
| 4 | a new approach that mixes read-file-name and read-directory-name. | 22 | a new approach that mixes read-file-name and read-directory-name. |
| 5 | 23 | ||
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index fcd1b9b1b5d..aca00409fac 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el | |||
| @@ -346,8 +346,7 @@ If any error occurred in running `bzr status', then return nil." | |||
| 346 | ((eq exitcode 0) (substring output 0 -1)) | 346 | ((eq exitcode 0) (substring output 0 -1)) |
| 347 | (t nil)))))) | 347 | (t nil)))))) |
| 348 | 348 | ||
| 349 | (defun vc-bzr-checkout-model (file) | 349 | (defun vc-bzr-checkout-model (files) 'implicit) |
| 350 | 'implicit) | ||
| 351 | 350 | ||
| 352 | (defun vc-bzr-create-repo () | 351 | (defun vc-bzr-create-repo () |
| 353 | "Create a new Bzr repository." | 352 | "Create a new Bzr repository." |
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 67830b48fd5..eec813859d2 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el | |||
| @@ -238,21 +238,25 @@ See also variable `vc-cvs-sticky-date-format-string'." | |||
| 238 | (vc-cvs-registered file) | 238 | (vc-cvs-registered file) |
| 239 | (vc-file-getprop file 'vc-working-revision)) | 239 | (vc-file-getprop file 'vc-working-revision)) |
| 240 | 240 | ||
| 241 | (defun vc-cvs-checkout-model (file) | 241 | (defun vc-cvs-checkout-model (files) |
| 242 | "CVS-specific version of `vc-checkout-model'." | 242 | "CVS-specific version of `vc-checkout-model'." |
| 243 | (if (getenv "CVSREAD") | 243 | (if (getenv "CVSREAD") |
| 244 | 'announce | 244 | 'announce |
| 245 | (let ((attrib (file-attributes file))) | 245 | (let* ((file (if (consp files) (car files) files)) |
| 246 | (if (and attrib ;; don't check further if FILE doesn't exist | 246 | (attrib (file-attributes file))) |
| 247 | ;; If the file is not writable (despite CVSREAD being | 247 | (or (vc-file-getprop file 'vc-checkout-model) |
| 248 | ;; undefined), this is probably because the file is being | 248 | (vc-file-setprop |
| 249 | ;; "watched" by other developers. | 249 | file 'vc-checkout-model |
| 250 | ;; (If vc-mistrust-permissions was t, we actually shouldn't | 250 | (if (and attrib ;; don't check further if FILE doesn't exist |
| 251 | ;; trust this, but there is no other way to learn this from CVS | 251 | ;; If the file is not writable (despite CVSREAD being |
| 252 | ;; at the moment (version 1.9).) | 252 | ;; undefined), this is probably because the file is being |
| 253 | (string-match "r-..-..-." (nth 8 attrib))) | 253 | ;; "watched" by other developers. |
| 254 | 'announce | 254 | ;; (If vc-mistrust-permissions was t, we actually shouldn't |
| 255 | 'implicit)))) | 255 | ;; trust this, but there is no other way to learn this from |
| 256 | ;; CVS at the moment (version 1.9).) | ||
| 257 | (string-match "r-..-..-." (nth 8 attrib))) | ||
| 258 | 'announce | ||
| 259 | 'implicit)))))) | ||
| 256 | 260 | ||
| 257 | (defun vc-cvs-mode-line-string (file) | 261 | (defun vc-cvs-mode-line-string (file) |
| 258 | "Return string for placement into the modeline for FILE. | 262 | "Return string for placement into the modeline for FILE. |
| @@ -356,7 +360,7 @@ its parents." | |||
| 356 | (vc-file-setprop | 360 | (vc-file-setprop |
| 357 | (car files) 'vc-working-revision | 361 | (car files) 'vc-working-revision |
| 358 | (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) | 362 | (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) |
| 359 | (mapc (lambda (file) (vc-file-clearprops file)) files)) | 363 | (mapc 'vc-file-clearprops files)) |
| 360 | ;; Anyway, forget the checkout model of the file, because we might have | 364 | ;; Anyway, forget the checkout model of the file, because we might have |
| 361 | ;; guessed wrong when we found the file. After commit, we can | 365 | ;; guessed wrong when we found the file. After commit, we can |
| 362 | ;; tell it from the permissions of the file (see | 366 | ;; tell it from the permissions of the file (see |
| @@ -418,7 +422,7 @@ REV is the revision to check out." | |||
| 418 | (defun vc-cvs-revert (file &optional contents-done) | 422 | (defun vc-cvs-revert (file &optional contents-done) |
| 419 | "Revert FILE to the working revision on which it was based." | 423 | "Revert FILE to the working revision on which it was based." |
| 420 | (vc-default-revert 'CVS file contents-done) | 424 | (vc-default-revert 'CVS file contents-done) |
| 421 | (unless (eq (vc-checkout-model file) 'implicit) | 425 | (unless (eq (vc-cvs-checkout-model file) 'implicit) |
| 422 | (if vc-cvs-use-edit | 426 | (if vc-cvs-use-edit |
| 423 | (vc-cvs-command nil 0 file "unedit") | 427 | (vc-cvs-command nil 0 file "unedit") |
| 424 | ;; Make the file read-only by switching off all w-bits | 428 | ;; Make the file read-only by switching off all w-bits |
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 19e5272618d..757263fa11e 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el | |||
| @@ -193,8 +193,7 @@ | |||
| 193 | (match-string 2 str) | 193 | (match-string 2 str) |
| 194 | str))) | 194 | str))) |
| 195 | 195 | ||
| 196 | (defun vc-git-checkout-model (file) | 196 | (defun vc-git-checkout-model (files) 'implicit) |
| 197 | 'implicit) | ||
| 198 | 197 | ||
| 199 | (defun vc-git-workfile-unchanged-p (file) | 198 | (defun vc-git-workfile-unchanged-p (file) |
| 200 | (eq 'up-to-date (vc-git-state file))) | 199 | (eq 'up-to-date (vc-git-state file))) |
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el index 7755e92dbc4..d6cd13d3bd0 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el | |||
| @@ -444,8 +444,7 @@ REV is the revision to check out into WORKFILE." | |||
| 444 | (vc-hg-command t 0 file "cat" "-r" rev) | 444 | (vc-hg-command t 0 file "cat" "-r" rev) |
| 445 | (vc-hg-command t 0 file "cat"))))) | 445 | (vc-hg-command t 0 file "cat"))))) |
| 446 | 446 | ||
| 447 | (defun vc-hg-checkout-model (file) | 447 | (defun vc-hg-checkout-model (files) 'implicit) |
| 448 | 'implicit) | ||
| 449 | 448 | ||
| 450 | ;; Modelled after the similar function in vc-bzr.el | 449 | ;; Modelled after the similar function in vc-bzr.el |
| 451 | (defun vc-hg-workfile-unchanged-p (file) | 450 | (defun vc-hg-workfile-unchanged-p (file) |
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index 7d2a4a946ac..e75f6ebce7b 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -440,26 +440,23 @@ If the file is not registered, or the master name is not known, return nil." | |||
| 440 | (vc-call-backend (vc-backend file) 'registered file)) | 440 | (vc-call-backend (vc-backend file) 'registered file)) |
| 441 | (vc-file-getprop file 'vc-name)))) | 441 | (vc-file-getprop file 'vc-name)))) |
| 442 | 442 | ||
| 443 | (defun vc-checkout-model (file) | 443 | (defun vc-checkout-model (backend files) |
| 444 | "Indicate how FILE is checked out. | 444 | "Indicate how FILES are checked out. |
| 445 | 445 | ||
| 446 | If FILE is not registered, this function always returns nil. | 446 | If FILES are not registered, this function always returns nil. |
| 447 | For registered files, the possible values are: | 447 | For registered files, the possible values are: |
| 448 | 448 | ||
| 449 | 'implicit FILE is always writeable, and checked out `implicitly' | 449 | 'implicit FILES are always writeable, and checked out `implicitly' |
| 450 | when the user saves the first changes to the file. | 450 | when the user saves the first changes to the file. |
| 451 | 451 | ||
| 452 | 'locking FILE is read-only if up-to-date; user must type | 452 | 'locking FILES are read-only if up-to-date; user must type |
| 453 | \\[vc-next-action] before editing. Strict locking | 453 | \\[vc-next-action] before editing. Strict locking |
| 454 | is assumed. | 454 | is assumed. |
| 455 | 455 | ||
| 456 | 'announce FILE is read-only if up-to-date; user must type | 456 | 'announce FILES are read-only if up-to-date; user must type |
| 457 | \\[vc-next-action] before editing. But other users | 457 | \\[vc-next-action] before editing. But other users |
| 458 | may be editing at the same time." | 458 | may be editing at the same time." |
| 459 | (or (vc-file-getprop file 'vc-checkout-model) | 459 | (vc-call-backend backend 'checkout-model files)) |
| 460 | (if (vc-backend file) | ||
| 461 | (vc-file-setprop file 'vc-checkout-model | ||
| 462 | (vc-call checkout-model file))))) | ||
| 463 | 460 | ||
| 464 | (defun vc-user-login-name (file) | 461 | (defun vc-user-login-name (file) |
| 465 | "Return the name under which the user accesses the given FILE." | 462 | "Return the name under which the user accesses the given FILE." |
| @@ -752,11 +749,12 @@ Before doing that, check if there are any old backups and get rid of them." | |||
| 752 | ;; If the file on disk is still in sync with the repository, | 749 | ;; If the file on disk is still in sync with the repository, |
| 753 | ;; and version backups should be made, copy the file to | 750 | ;; and version backups should be made, copy the file to |
| 754 | ;; another name. This enables local diffs and local reverting. | 751 | ;; another name. This enables local diffs and local reverting. |
| 755 | (let ((file buffer-file-name)) | 752 | (let ((file buffer-file-name) |
| 753 | backend) | ||
| 756 | (ignore-errors ;Be careful not to prevent saving the file. | 754 | (ignore-errors ;Be careful not to prevent saving the file. |
| 757 | (and (vc-backend file) | 755 | (and (setq backend (vc-backend file)) |
| 758 | (vc-up-to-date-p file) | 756 | (vc-up-to-date-p file) |
| 759 | (eq (vc-checkout-model file) 'implicit) | 757 | (eq (vc-checkout-model backend file) 'implicit) |
| 760 | (vc-call make-version-backups-p file) | 758 | (vc-call make-version-backups-p file) |
| 761 | (vc-make-version-backup file))))) | 759 | (vc-make-version-backup file))))) |
| 762 | 760 | ||
| @@ -767,8 +765,9 @@ Before doing that, check if there are any old backups and get rid of them." | |||
| 767 | ;; If the file in the current buffer is under version control, | 765 | ;; If the file in the current buffer is under version control, |
| 768 | ;; up-to-date, and locking is not used for the file, set | 766 | ;; up-to-date, and locking is not used for the file, set |
| 769 | ;; the state to 'edited and redisplay the mode line. | 767 | ;; the state to 'edited and redisplay the mode line. |
| 770 | (let ((file buffer-file-name)) | 768 | (let* ((file buffer-file-name) |
| 771 | (and (vc-backend file) | 769 | (backend (vc-backend file))) |
| 770 | (and backend | ||
| 772 | (or (and (equal (vc-file-getprop file 'vc-checkout-time) | 771 | (or (and (equal (vc-file-getprop file 'vc-checkout-time) |
| 773 | (nth 5 (file-attributes file))) | 772 | (nth 5 (file-attributes file))) |
| 774 | ;; File has been saved in the same second in which | 773 | ;; File has been saved in the same second in which |
| @@ -777,7 +776,7 @@ Before doing that, check if there are any old backups and get rid of them." | |||
| 777 | (vc-file-setprop file 'vc-checkout-time nil)) | 776 | (vc-file-setprop file 'vc-checkout-time nil)) |
| 778 | t) | 777 | t) |
| 779 | (vc-up-to-date-p file) | 778 | (vc-up-to-date-p file) |
| 780 | (eq (vc-checkout-model file) 'implicit) | 779 | (eq (vc-checkout-model backend file) 'implicit) |
| 781 | (vc-file-setprop file 'vc-state 'edited) | 780 | (vc-file-setprop file 'vc-state 'edited) |
| 782 | (vc-mode-line file) | 781 | (vc-mode-line file) |
| 783 | (when (featurep 'vc) | 782 | (when (featurep 'vc) |
diff --git a/lisp/vc-mcvs.el b/lisp/vc-mcvs.el index 6be69e47bd8..df8a4ebad0b 100644 --- a/lisp/vc-mcvs.el +++ b/lisp/vc-mcvs.el | |||
| @@ -367,7 +367,7 @@ This is only possible if Meta-CVS is responsible for FILE's directory.") | |||
| 367 | (defun vc-mcvs-revert (file &optional contents-done) | 367 | (defun vc-mcvs-revert (file &optional contents-done) |
| 368 | "Revert FILE to the working revision it was based on." | 368 | "Revert FILE to the working revision it was based on." |
| 369 | (vc-default-revert 'MCVS file contents-done) | 369 | (vc-default-revert 'MCVS file contents-done) |
| 370 | (unless (eq (vc-checkout-model file) 'implicit) | 370 | (unless (eq (vc-mcvs-checkout-model file) 'implicit) |
| 371 | (if vc-mcvs-use-edit | 371 | (if vc-mcvs-use-edit |
| 372 | (vc-mcvs-command nil 0 file "unedit") | 372 | (vc-mcvs-command nil 0 file "unedit") |
| 373 | ;; Make the file read-only by switching off all w-bits | 373 | ;; Make the file read-only by switching off all w-bits |
diff --git a/lisp/vc-rcs.el b/lisp/vc-rcs.el index ac882762b62..a1b10aaa541 100644 --- a/lisp/vc-rcs.el +++ b/lisp/vc-rcs.el | |||
| @@ -109,13 +109,12 @@ For a description of possible values, see `vc-check-master-templates'." | |||
| 109 | ;;; State-querying functions | 109 | ;;; State-querying functions |
| 110 | ;;; | 110 | ;;; |
| 111 | 111 | ||
| 112 | ;;; The autoload cookie below places vc-rcs-registered directly into | 112 | ;; The autoload cookie below places vc-rcs-registered directly into |
| 113 | ;;; loaddefs.el, so that vc-rcs.el does not need to be loaded for | 113 | ;; loaddefs.el, so that vc-rcs.el does not need to be loaded for |
| 114 | ;;; every file that is visited. The definition is repeated below | 114 | ;; every file that is visited. |
| 115 | ;;; so that Help and etags can find it. | 115 | ;;;###autoload |
| 116 | 116 | (progn | |
| 117 | ;;;###autoload (defun vc-rcs-registered (f) (vc-default-registered 'RCS f)) | 117 | (defun vc-rcs-registered (f) (vc-default-registered 'RCS f))) |
| 118 | (defun vc-rcs-registered (f) (vc-default-registered 'RCS f)) | ||
| 119 | 118 | ||
| 120 | (defun vc-rcs-state (file) | 119 | (defun vc-rcs-state (file) |
| 121 | "Implementation of `vc-state' for RCS." | 120 | "Implementation of `vc-state' for RCS." |
| @@ -133,7 +132,7 @@ For a description of possible values, see `vc-check-master-templates'." | |||
| 133 | state | 132 | state |
| 134 | (if (vc-workfile-unchanged-p file) | 133 | (if (vc-workfile-unchanged-p file) |
| 135 | 'up-to-date | 134 | 'up-to-date |
| 136 | (if (eq (vc-checkout-model file) 'locking) | 135 | (if (eq (vc-rcs-checkout-model file) 'locking) |
| 137 | 'unlocked-changes | 136 | 'unlocked-changes |
| 138 | 'edited))))) | 137 | 'edited))))) |
| 139 | 138 | ||
| @@ -168,7 +167,7 @@ For a description of possible values, see `vc-check-master-templates'." | |||
| 168 | (vc-file-setprop file 'vc-checkout-model 'locking) | 167 | (vc-file-setprop file 'vc-checkout-model 'locking) |
| 169 | 'up-to-date) | 168 | 'up-to-date) |
| 170 | ((string-match ".rw..-..-." permissions) | 169 | ((string-match ".rw..-..-." permissions) |
| 171 | (if (eq (vc-checkout-model file) 'locking) | 170 | (if (eq (vc-rcs-checkout-model file) 'locking) |
| 172 | (if (file-ownership-preserved-p file) | 171 | (if (file-ownership-preserved-p file) |
| 173 | 'edited | 172 | 'edited |
| 174 | owner-name) | 173 | owner-name) |
| @@ -218,9 +217,10 @@ When VERSION is given, perform check for that version." | |||
| 218 | (vc-insert-file (vc-name file) "^desc") | 217 | (vc-insert-file (vc-name file) "^desc") |
| 219 | (vc-rcs-find-most-recent-rev (vc-branch-part version)))))) | 218 | (vc-rcs-find-most-recent-rev (vc-branch-part version)))))) |
| 220 | 219 | ||
| 221 | (defun vc-rcs-checkout-model (file) | 220 | (defun vc-rcs-checkout-model (files) |
| 222 | "RCS-specific version of `vc-checkout-model'." | 221 | "RCS-specific version of `vc-checkout-model'." |
| 223 | (let (result) | 222 | (let ((file (if (consp files) (car files) files)) |
| 223 | result) | ||
| 224 | (when vc-consult-headers | 224 | (when vc-consult-headers |
| 225 | (vc-file-setprop file 'vc-checkout-model nil) | 225 | (vc-file-setprop file 'vc-checkout-model nil) |
| 226 | (vc-rcs-consult-headers file) | 226 | (vc-rcs-consult-headers file) |
| @@ -319,7 +319,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." | |||
| 319 | 319 | ||
| 320 | (defun vc-rcs-receive-file (file rev) | 320 | (defun vc-rcs-receive-file (file rev) |
| 321 | "Implementation of receive-file for RCS." | 321 | "Implementation of receive-file for RCS." |
| 322 | (let ((checkout-model (vc-checkout-model file))) | 322 | (let ((checkout-model (vc-rcs-checkout-model file))) |
| 323 | (vc-rcs-register file rev "") | 323 | (vc-rcs-register file rev "") |
| 324 | (when (eq checkout-model 'implicit) | 324 | (when (eq checkout-model 'implicit) |
| 325 | (vc-rcs-set-non-strict-locking file)) | 325 | (vc-rcs-set-non-strict-locking file)) |
| @@ -430,7 +430,7 @@ whether to remove it." | |||
| 430 | nil 0 "co" (vc-name file) | 430 | nil 0 "co" (vc-name file) |
| 431 | ;; If locking is not strict, force to overwrite | 431 | ;; If locking is not strict, force to overwrite |
| 432 | ;; the writable workfile. | 432 | ;; the writable workfile. |
| 433 | (if (eq (vc-checkout-model file) 'implicit) "-f") | 433 | (if (eq (vc-rcs-checkout-model file) 'implicit) "-f") |
| 434 | (if editable "-l") | 434 | (if editable "-l") |
| 435 | (if (stringp rev) | 435 | (if (stringp rev) |
| 436 | ;; a literal revision was specified | 436 | ;; a literal revision was specified |
| @@ -893,7 +893,7 @@ file." | |||
| 893 | ;; locked by the calling user | 893 | ;; locked by the calling user |
| 894 | ((and (stringp locking-user) | 894 | ((and (stringp locking-user) |
| 895 | (string= locking-user (vc-user-login-name file))) | 895 | (string= locking-user (vc-user-login-name file))) |
| 896 | (if (or (eq (vc-checkout-model file) 'locking) | 896 | (if (or (eq (vc-rcs-checkout-model file) 'locking) |
| 897 | workfile-is-latest | 897 | workfile-is-latest |
| 898 | (vc-rcs-latest-on-branch-p file working-revision)) | 898 | (vc-rcs-latest-on-branch-p file working-revision)) |
| 899 | 'edited | 899 | 'edited |
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index 5aa1cf7f143..51b49b84589 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el | |||
| @@ -193,7 +193,7 @@ RESULT is a list of conses (FILE . STATE) for directory DIR." | |||
| 193 | (vc-svn-registered file) | 193 | (vc-svn-registered file) |
| 194 | (vc-file-getprop file 'vc-working-revision)) | 194 | (vc-file-getprop file 'vc-working-revision)) |
| 195 | 195 | ||
| 196 | (defun vc-svn-checkout-model (file) | 196 | (defun vc-svn-checkout-model (files) |
| 197 | "SVN-specific version of `vc-checkout-model'." | 197 | "SVN-specific version of `vc-checkout-model'." |
| 198 | ;; It looks like Subversion has no equivalent of CVSREAD. | 198 | ;; It looks like Subversion has no equivalent of CVSREAD. |
| 199 | 'implicit) | 199 | 'implicit) |
diff --git a/lisp/vc.el b/lisp/vc.el index 81762b69093..4d71b614665 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -228,9 +228,9 @@ | |||
| 228 | ;; The default implementation always returns t, which means that | 228 | ;; The default implementation always returns t, which means that |
| 229 | ;; working with non-current revisions is not supported by default. | 229 | ;; working with non-current revisions is not supported by default. |
| 230 | ;; | 230 | ;; |
| 231 | ;; * checkout-model (file) | 231 | ;; * checkout-model (files) |
| 232 | ;; | 232 | ;; |
| 233 | ;; Indicate whether FILE needs to be "checked out" before it can be | 233 | ;; Indicate whether FILES need to be "checked out" before they can be |
| 234 | ;; edited. See `vc-checkout-model' for a list of possible values. | 234 | ;; edited. See `vc-checkout-model' for a list of possible values. |
| 235 | ;; | 235 | ;; |
| 236 | ;; - workfile-unchanged-p (file) | 236 | ;; - workfile-unchanged-p (file) |
| @@ -1506,13 +1506,16 @@ Otherwise, throw an error." | |||
| 1506 | (unless (vc-backend buffer-file-name) | 1506 | (unless (vc-backend buffer-file-name) |
| 1507 | (error "File %s is not under version control" buffer-file-name)))))) | 1507 | (error "File %s is not under version control" buffer-file-name)))))) |
| 1508 | 1508 | ||
| 1509 | ;;; Support for the C-x v v command. This is where all the single-file-oriented | 1509 | ;;; Support for the C-x v v command. |
| 1510 | ;;; code from before the fileset rewrite lives. | 1510 | ;; This is where all the single-file-oriented code from before the fileset |
| 1511 | ;; rewrite lives. | ||
| 1511 | 1512 | ||
| 1512 | (defsubst vc-editable-p (file) | 1513 | (defsubst vc-editable-p (file) |
| 1513 | "Return non-nil if FILE can be edited." | 1514 | "Return non-nil if FILE can be edited." |
| 1514 | (or (eq (vc-checkout-model file) 'implicit) | 1515 | (let ((backend (vc-backend file))) |
| 1515 | (memq (vc-state file) '(edited needs-merge conflict)))) | 1516 | (and backend |
| 1517 | (or (eq (vc-checkout-model backend file) 'implicit) | ||
| 1518 | (memq (vc-state file) '(edited needs-merge conflict)))))) | ||
| 1516 | 1519 | ||
| 1517 | (defun vc-revert-buffer-internal (&optional arg no-confirm) | 1520 | (defun vc-revert-buffer-internal (&optional arg no-confirm) |
| 1518 | "Revert buffer, keeping point and mark where user expects them. | 1521 | "Revert buffer, keeping point and mark where user expects them. |
| @@ -1585,9 +1588,10 @@ with the logmessage as change commentary. A writable file is retained. | |||
| 1585 | merge in the changes into your working copy." | 1588 | merge in the changes into your working copy." |
| 1586 | (interactive "P") | 1589 | (interactive "P") |
| 1587 | (let* ((vc-fileset (vc-deduce-fileset nil t)) | 1590 | (let* ((vc-fileset (vc-deduce-fileset nil t)) |
| 1591 | (backend (car vc-fileset)) | ||
| 1588 | (files (cdr vc-fileset)) | 1592 | (files (cdr vc-fileset)) |
| 1589 | state | 1593 | state |
| 1590 | model | 1594 | (model (vc-checkout-model backend files)) |
| 1591 | revision) | 1595 | revision) |
| 1592 | ;; Check if there's at least one file present, and get `state' and | 1596 | ;; Check if there's at least one file present, and get `state' and |
| 1593 | ;; `model' from it. | 1597 | ;; `model' from it. |
| @@ -1595,7 +1599,6 @@ merge in the changes into your working copy." | |||
| 1595 | ;; present, or `files' is nil. | 1599 | ;; present, or `files' is nil. |
| 1596 | (dolist (file files) | 1600 | (dolist (file files) |
| 1597 | (unless (file-directory-p file) | 1601 | (unless (file-directory-p file) |
| 1598 | (setq model (vc-checkout-model (car files))) | ||
| 1599 | (setq state (vc-state file)) | 1602 | (setq state (vc-state file)) |
| 1600 | (return))) | 1603 | (return))) |
| 1601 | 1604 | ||
| @@ -1605,7 +1608,7 @@ merge in the changes into your working copy." | |||
| 1605 | (unless (file-directory-p file) | 1608 | (unless (file-directory-p file) |
| 1606 | (unless (vc-compatible-state (vc-state file) state) | 1609 | (unless (vc-compatible-state (vc-state file) state) |
| 1607 | (error "Fileset is in a mixed-up state")) | 1610 | (error "Fileset is in a mixed-up state")) |
| 1608 | (unless (eq (vc-checkout-model file) model) | 1611 | (unless (eq (vc-checkout-model backend file) model) |
| 1609 | (error "Fileset has mixed checkout models")))) | 1612 | (error "Fileset has mixed checkout models")))) |
| 1610 | ;; Check for buffers in the fileset not matching the on-disk contents. | 1613 | ;; Check for buffers in the fileset not matching the on-disk contents. |
| 1611 | (dolist (file files) | 1614 | (dolist (file files) |
| @@ -1932,23 +1935,23 @@ After check-out, runs the normal hook `vc-checkout-hook'." | |||
| 1932 | (vc-call make-version-backups-p file) | 1935 | (vc-call make-version-backups-p file) |
| 1933 | (vc-up-to-date-p file) | 1936 | (vc-up-to-date-p file) |
| 1934 | (vc-make-version-backup file)) | 1937 | (vc-make-version-backup file)) |
| 1935 | (with-vc-properties | 1938 | (let ((backend (vc-backend file))) |
| 1936 | (list file) | 1939 | (with-vc-properties (list file) |
| 1937 | (condition-case err | 1940 | (condition-case err |
| 1938 | (vc-call checkout file writable rev) | 1941 | (vc-call-backend 'checkout file writable rev) |
| 1939 | (file-error | 1942 | (file-error |
| 1940 | ;; Maybe the backend is not installed ;-( | 1943 | ;; Maybe the backend is not installed ;-( |
| 1941 | (when writable | 1944 | (when writable |
| 1942 | (let ((buf (get-file-buffer file))) | 1945 | (let ((buf (get-file-buffer file))) |
| 1943 | (when buf (with-current-buffer buf (toggle-read-only -1))))) | 1946 | (when buf (with-current-buffer buf (toggle-read-only -1))))) |
| 1944 | (signal (car err) (cdr err)))) | 1947 | (signal (car err) (cdr err)))) |
| 1945 | `((vc-state . ,(if (or (eq (vc-checkout-model file) 'implicit) | 1948 | `((vc-state . ,(if (or (eq (vc-checkout-model backend file) 'implicit) |
| 1946 | (not writable)) | 1949 | (not writable)) |
| 1947 | (if (vc-call latest-on-branch-p file) | 1950 | (if (vc-call latest-on-branch-p file) |
| 1948 | 'up-to-date | 1951 | 'up-to-date |
| 1949 | 'needs-patch) | 1952 | 'needs-patch) |
| 1950 | 'edited)) | 1953 | 'edited)) |
| 1951 | (vc-checkout-time . ,(nth 5 (file-attributes file))))) | 1954 | (vc-checkout-time . ,(nth 5 (file-attributes file)))))) |
| 1952 | (vc-resynch-buffer file t t) | 1955 | (vc-resynch-buffer file t t) |
| 1953 | (run-hooks 'vc-checkout-hook)) | 1956 | (run-hooks 'vc-checkout-hook)) |
| 1954 | 1957 | ||
| @@ -3769,7 +3772,7 @@ changes from the current branch are merged into the working file." | |||
| 3769 | (error "Please kill or save all modified buffers before updating.")) | 3772 | (error "Please kill or save all modified buffers before updating.")) |
| 3770 | (if (vc-up-to-date-p file) | 3773 | (if (vc-up-to-date-p file) |
| 3771 | (vc-checkout file nil t) | 3774 | (vc-checkout file nil t) |
| 3772 | (if (eq (vc-checkout-model file) 'locking) | 3775 | (if (eq (vc-checkout-model backend file) 'locking) |
| 3773 | (if (eq (vc-state file) 'edited) | 3776 | (if (eq (vc-state file) 'edited) |
| 3774 | (error "%s" | 3777 | (error "%s" |
| 3775 | (substitute-command-keys | 3778 | (substitute-command-keys |
| @@ -3896,7 +3899,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. | |||
| 3896 | (vc-call-backend new-backend 'receive-file file rev)) | 3899 | (vc-call-backend new-backend 'receive-file file rev)) |
| 3897 | (when modified-file | 3900 | (when modified-file |
| 3898 | (vc-switch-backend file new-backend) | 3901 | (vc-switch-backend file new-backend) |
| 3899 | (unless (eq (vc-checkout-model file) 'implicit) | 3902 | (unless (eq (vc-checkout-model new-backend file) 'implicit) |
| 3900 | (vc-checkout file t nil)) | 3903 | (vc-checkout file t nil)) |
| 3901 | (rename-file modified-file file 'ok-if-already-exists) | 3904 | (rename-file modified-file file 'ok-if-already-exists) |
| 3902 | (vc-file-setprop file 'vc-checkout-time nil))))) | 3905 | (vc-file-setprop file 'vc-checkout-time nil))))) |