Mercurial > emacs
comparison lisp/vc.el @ 94563:a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Fri, 02 May 2008 17:47:25 +0000 |
parents | 8d02ae7cb729 |
children | c6ccf57e7e6e |
comparison
equal
deleted
inserted
replaced
94562:46f178f2b009 | 94563:a0bb8ca25a33 |
---|---|
1535 | 1535 |
1536 (defsubst vc-editable-p (file) | 1536 (defsubst vc-editable-p (file) |
1537 "Return non-nil if FILE can be edited." | 1537 "Return non-nil if FILE can be edited." |
1538 (let ((backend (vc-backend file))) | 1538 (let ((backend (vc-backend file))) |
1539 (and backend | 1539 (and backend |
1540 (or (eq (vc-checkout-model backend file) 'implicit) | 1540 (or (eq (vc-checkout-model backend (list file)) 'implicit) |
1541 (memq (vc-state file) '(edited needs-merge conflict)))))) | 1541 (memq (vc-state file) '(edited needs-merge conflict)))))) |
1542 | 1542 |
1543 (defun vc-revert-buffer-internal (&optional arg no-confirm) | 1543 (defun vc-revert-buffer-internal (&optional arg no-confirm) |
1544 "Revert buffer, keeping point and mark where user expects them. | 1544 "Revert buffer, keeping point and mark where user expects them. |
1545 Try to be clever in the face of changes due to expanded version-control | 1545 Try to be clever in the face of changes due to expanded version-control |
1624 ;; Ignore directories, they are compatible with anything. | 1624 ;; Ignore directories, they are compatible with anything. |
1625 (unless (file-directory-p file) | 1625 (unless (file-directory-p file) |
1626 (unless (vc-compatible-state (vc-state file) state) | 1626 (unless (vc-compatible-state (vc-state file) state) |
1627 (error "%s:%s clashes with %s:%s" | 1627 (error "%s:%s clashes with %s:%s" |
1628 file (vc-state file) (car files) state)) | 1628 file (vc-state file) (car files) state)) |
1629 (unless (eq (vc-checkout-model backend file) model) | 1629 (unless (eq (vc-checkout-model backend (list file)) model) |
1630 (error "Fileset has mixed checkout models")))) | 1630 (error "Fileset has mixed checkout models")))) |
1631 ;; Check for buffers in the fileset not matching the on-disk contents. | 1631 ;; Check for buffers in the fileset not matching the on-disk contents. |
1632 (dolist (file files) | 1632 (dolist (file files) |
1633 (let ((visited (get-file-buffer file))) | 1633 (let ((visited (get-file-buffer file))) |
1634 (when visited | 1634 (when visited |
1965 ;; Maybe the backend is not installed ;-( | 1965 ;; Maybe the backend is not installed ;-( |
1966 (when writable | 1966 (when writable |
1967 (let ((buf (get-file-buffer file))) | 1967 (let ((buf (get-file-buffer file))) |
1968 (when buf (with-current-buffer buf (toggle-read-only -1))))) | 1968 (when buf (with-current-buffer buf (toggle-read-only -1))))) |
1969 (signal (car err) (cdr err)))) | 1969 (signal (car err) (cdr err)))) |
1970 `((vc-state . ,(if (or (eq (vc-checkout-model backend file) 'implicit) | 1970 `((vc-state . ,(if (or (eq (vc-checkout-model backend (list file)) 'implicit) |
1971 (not writable)) | 1971 (not writable)) |
1972 (if (vc-call latest-on-branch-p file) | 1972 (if (vc-call latest-on-branch-p file) |
1973 'up-to-date | 1973 'up-to-date |
1974 'needs-update) | 1974 'needs-update) |
1975 'edited)) | 1975 'edited)) |
3855 (when (let ((buf (get-file-buffer file))) | 3855 (when (let ((buf (get-file-buffer file))) |
3856 (and buf (buffer-modified-p buf))) | 3856 (and buf (buffer-modified-p buf))) |
3857 (error "Please kill or save all modified buffers before updating.")) | 3857 (error "Please kill or save all modified buffers before updating.")) |
3858 (if (vc-up-to-date-p file) | 3858 (if (vc-up-to-date-p file) |
3859 (vc-checkout file nil t) | 3859 (vc-checkout file nil t) |
3860 (if (eq (vc-checkout-model backend file) 'locking) | 3860 (if (eq (vc-checkout-model backend (list file)) 'locking) |
3861 (if (eq (vc-state file) 'edited) | 3861 (if (eq (vc-state file) 'edited) |
3862 (error "%s" | 3862 (error "%s" |
3863 (substitute-command-keys | 3863 (substitute-command-keys |
3864 "File is locked--type \\[vc-revert] to discard changes")) | 3864 "File is locked--type \\[vc-revert] to discard changes")) |
3865 (error "Unexpected file state (%s) -- type %s" | 3865 (error "Unexpected file state (%s) -- type %s" |
3982 (when (y-or-n-p "Get base revision from master? ") | 3982 (when (y-or-n-p "Get base revision from master? ") |
3983 (vc-revert-file file)))) | 3983 (vc-revert-file file)))) |
3984 (vc-call-backend new-backend 'receive-file file rev)) | 3984 (vc-call-backend new-backend 'receive-file file rev)) |
3985 (when modified-file | 3985 (when modified-file |
3986 (vc-switch-backend file new-backend) | 3986 (vc-switch-backend file new-backend) |
3987 (unless (eq (vc-checkout-model new-backend file) 'implicit) | 3987 (unless (eq (vc-checkout-model new-backend (list file)) 'implicit) |
3988 (vc-checkout file t nil)) | 3988 (vc-checkout file t nil)) |
3989 (rename-file modified-file file 'ok-if-already-exists) | 3989 (rename-file modified-file file 'ok-if-already-exists) |
3990 (vc-file-setprop file 'vc-checkout-time nil))))) | 3990 (vc-file-setprop file 'vc-checkout-time nil))))) |
3991 (when move | 3991 (when move |
3992 (vc-switch-backend file old-backend) | 3992 (vc-switch-backend file old-backend) |