diff options
| author | Stefan Monnier | 2006-10-20 07:58:11 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2006-10-20 07:58:11 +0000 |
| commit | 5ce51a98b797d3e4ec35529466166fff372e11c2 (patch) | |
| tree | 88cf2979d7b01bce1c805536915a740e583681b2 | |
| parent | bc8c1bb4484f8f33dba11be10bedbc66b9664f5f (diff) | |
| download | emacs-5ce51a98b797d3e4ec35529466166fff372e11c2.tar.gz emacs-5ce51a98b797d3e4ec35529466166fff372e11c2.zip | |
(vc-switch-backend): Try to be more careful with unwanted
side-effect due to mixing various backends's file properties.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/vc.el | 45 |
2 files changed, 29 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0999e794216..44439658b56 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2006-10-20 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2006-10-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * vc.el (vc-switch-backend): Try to be more careful with unwanted | ||
| 4 | side-effect due to mixing various backends's file properties. | ||
| 5 | |||
| 3 | * vc-svn.el (vc-svn-parse-status): Remove unused arg `localp'. | 6 | * vc-svn.el (vc-svn-parse-status): Remove unused arg `localp'. |
| 4 | Add arg `filename' instead. Don't set vc-backend if `filename' is set. | 7 | Add arg `filename' instead. Don't set vc-backend if `filename' is set. |
| 5 | Return `filename's status if applicable. Update callers. | 8 | Return `filename's status if applicable. Update callers. |
diff --git a/lisp/vc.el b/lisp/vc.el index d72ee4c7e4e..afeba8d2409 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -2682,25 +2682,32 @@ To get a prompt, use a prefix argument." | |||
| 2682 | (error "There is no version-controlled file in this buffer")) | 2682 | (error "There is no version-controlled file in this buffer")) |
| 2683 | (let ((backend (vc-backend buffer-file-name)) | 2683 | (let ((backend (vc-backend buffer-file-name)) |
| 2684 | (backends nil)) | 2684 | (backends nil)) |
| 2685 | (unless backend | 2685 | (unwind-protect |
| 2686 | (error "File %s is not under version control" buffer-file-name)) | 2686 | (progn |
| 2687 | ;; Find the registered backends. | 2687 | (unless backend |
| 2688 | (dolist (backend vc-handled-backends) | 2688 | (error "File %s is not under version control" buffer-file-name)) |
| 2689 | (when (vc-call-backend backend 'registered buffer-file-name) | 2689 | ;; Find the registered backends. |
| 2690 | (push backend backends))) | 2690 | (dolist (backend vc-handled-backends) |
| 2691 | ;; Find the next backend. | 2691 | (when (vc-call-backend backend 'registered buffer-file-name) |
| 2692 | (let ((def (car (delq backend (append (memq backend backends) backends)))) | 2692 | (push backend backends))) |
| 2693 | (others (delete backend backends))) | 2693 | ;; Find the next backend. |
| 2694 | (cond | 2694 | (let ((def (car (delq backend |
| 2695 | ((null others) (error "No other backend to switch to")) | 2695 | (append (memq backend backends) backends)))) |
| 2696 | (current-prefix-arg | 2696 | (others (delete backend backends))) |
| 2697 | (intern | 2697 | (cond |
| 2698 | (upcase | 2698 | ((null others) (error "No other backend to switch to")) |
| 2699 | (completing-read | 2699 | (current-prefix-arg |
| 2700 | (format "Switch to backend [%s]: " def) | 2700 | (intern |
| 2701 | (mapcar (lambda (b) (list (downcase (symbol-name b)))) backends) | 2701 | (upcase |
| 2702 | nil t nil nil (downcase (symbol-name def)))))) | 2702 | (completing-read |
| 2703 | (t def)))))) | 2703 | (format "Switch to backend [%s]: " def) |
| 2704 | (mapcar (lambda (b) (list (downcase (symbol-name b)))) backends) | ||
| 2705 | nil t nil nil (downcase (symbol-name def)))))) | ||
| 2706 | (t def)))) | ||
| 2707 | ;; Calling the `registered' method can mess up the file | ||
| 2708 | ;; properties, so we want to revert them to what they were. | ||
| 2709 | (if (and backend (delete backend backends)) | ||
| 2710 | (vc-call-backend backend 'registered buffer-file-name)))))) | ||
| 2704 | (unless (eq backend (vc-backend file)) | 2711 | (unless (eq backend (vc-backend file)) |
| 2705 | (vc-file-clearprops file) | 2712 | (vc-file-clearprops file) |
| 2706 | (vc-file-setprop file 'vc-backend backend) | 2713 | (vc-file-setprop file 'vc-backend backend) |