1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

(vc-switch-backend): Try to be more careful with unwanted

side-effect due to mixing various backends's file properties.
This commit is contained in:
Stefan Monnier 2006-10-20 07:58:11 +00:00
parent bc8c1bb448
commit 5ce51a98b7
2 changed files with 29 additions and 19 deletions

View File

@ -1,5 +1,8 @@
2006-10-20 Stefan Monnier <monnier@iro.umontreal.ca>
* vc.el (vc-switch-backend): Try to be more careful with unwanted
side-effect due to mixing various backends's file properties.
* vc-svn.el (vc-svn-parse-status): Remove unused arg `localp'.
Add arg `filename' instead. Don't set vc-backend if `filename' is set.
Return `filename's status if applicable. Update callers.

View File

@ -2682,6 +2682,8 @@ To get a prompt, use a prefix argument."
(error "There is no version-controlled file in this buffer"))
(let ((backend (vc-backend buffer-file-name))
(backends nil))
(unwind-protect
(progn
(unless backend
(error "File %s is not under version control" buffer-file-name))
;; Find the registered backends.
@ -2689,7 +2691,8 @@ To get a prompt, use a prefix argument."
(when (vc-call-backend backend 'registered buffer-file-name)
(push backend backends)))
;; Find the next backend.
(let ((def (car (delq backend (append (memq backend backends) backends))))
(let ((def (car (delq backend
(append (memq backend backends) backends))))
(others (delete backend backends)))
(cond
((null others) (error "No other backend to switch to"))
@ -2700,7 +2703,11 @@ To get a prompt, use a prefix argument."
(format "Switch to backend [%s]: " def)
(mapcar (lambda (b) (list (downcase (symbol-name b)))) backends)
nil t nil nil (downcase (symbol-name def))))))
(t def))))))
(t def))))
;; Calling the `registered' method can mess up the file
;; properties, so we want to revert them to what they were.
(if (and backend (delete backend backends))
(vc-call-backend backend 'registered buffer-file-name))))))
(unless (eq backend (vc-backend file))
(vc-file-clearprops file)
(vc-file-setprop file 'vc-backend backend)