From 0aa52e94f37e34a8f59d3a91e4798ee082781e3d Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 14 Oct 2021 02:28:00 +0300 Subject: [PATCH] Mark vc-switch-backend as obsolete * etc/NEWS: Mention the change. * lisp/vc/vc.el (vc-switch-backend): Mark as obsolete (bug#50344). (vc-transfer-file): Wrap the calls in 'with-suppressed-warnings'. --- etc/NEWS | 4 ++++ lisp/vc/vc.el | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 791248f7dc4..b7c4346db97 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1937,6 +1937,10 @@ tags to be considered as well. *** New user option 'vc-git-log-switches'. String or list of strings specifying switches for Git log under VC. +*** Command 'vc-switch-backend' is now obsolete. +If you are still using it with any regularity, please file a bug +report with some details. + ** Gnus +++ diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 5b259fcdb33..67003c83926 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2864,6 +2864,7 @@ permanent, only for the current session. This function only changes VC's perspective on FILE, it does not register or unregister it. By default, this command cycles through the registered backends. To get a prompt, use a prefix argument." + (declare (obsolete nil "28.1")) (interactive (list (or buffer-file-name @@ -2918,7 +2919,8 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. (if registered (set-file-modes file (logior (file-modes file) 128)) ;; `registered' might have switched under us. - (vc-switch-backend file old-backend) + (with-suppressed-warnings ((obsolete vc-switch-backend)) + (vc-switch-backend file old-backend)) (let* ((rev (vc-working-revision file)) (modified-file (and edited (make-temp-file file))) (unmodified-file (and modified-file (vc-version-backup-file file)))) @@ -2937,16 +2939,19 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. (vc-revert-file file)))) (vc-call-backend new-backend 'receive-file file rev)) (when modified-file - (vc-switch-backend file new-backend) + (with-suppressed-warnings ((obsolete vc-switch-backend)) + (vc-switch-backend file new-backend)) (unless (eq (vc-checkout-model new-backend (list file)) 'implicit) (vc-checkout file)) (rename-file modified-file file 'ok-if-already-exists) (vc-file-setprop file 'vc-checkout-time nil))))) (when move - (vc-switch-backend file old-backend) + (with-suppressed-warnings ((obsolete vc-switch-backend)) + (vc-switch-backend file old-backend)) (setq comment (vc-call-backend old-backend 'comment-history file)) (vc-call-backend old-backend 'unregister file)) - (vc-switch-backend file new-backend) + (with-suppressed-warnings ((obsolete vc-switch-backend)) + (vc-switch-backend file new-backend)) (when (or move edited) (vc-file-setprop file 'vc-state 'edited) (vc-mode-line file new-backend) -- 2.39.2