]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp.el (tramp-obsolete-methods): New defconst.
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 1 Mar 2013 08:13:53 +0000 (09:13 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 1 Mar 2013 08:13:53 +0000 (09:13 +0100)
(tramp-warned-obsolete-methods): New defvar.
(tramp-find-method): Check for obsolete methods.  Map them to a
replacement method if appropriate.

* net/tramp-sh.el (tramp-methods) [scp1, scp2, ssh1, ssh2, plink1]:
Remove methods.
(top): Remove completion functions for "scp1", "scp2", "ssh1",
"ssh2" and "plink1".

lisp/ChangeLog
lisp/net/tramp-sh.el
lisp/net/tramp.el

index 5ce0e6b597a3c43f86998476eb3d0a74c920e23d..2ffe23823ba7f3533b478efdcb2c62671aaa7c4d 100644 (file)
@@ -1,3 +1,15 @@
+2013-03-01  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-obsolete-methods): New defconst.
+       (tramp-warned-obsolete-methods): New defvar.
+       (tramp-find-method): Check for obsolete methods.  Map them to a
+       replacement method if appropriate.
+
+       * net/tramp-sh.el (tramp-methods) [scp1, scp2, ssh1, ssh2, plink1]:
+       Remove methods.
+       (top): Remove completion functions for "scp1", "scp2", "ssh1",
+       "ssh2" and "plink1".
+
 2013-02-28  Dale Sedivec  <dale@codefu.org>
 
        * textmodes/sgml-mode.el (sgml-syntax-propertize-function):
index e2aaafb38dd7318b4d932e80ddf2e8361e10944b..9dd37fdf63a6156410c4e30dabb4ba596a23d355 100644 (file)
@@ -125,42 +125,6 @@ detected as prompt when being sent on echoing hosts, therefore.")
                                 ("-o" "StrictHostKeyChecking=no")))
     (tramp-default-port         22)))
 ;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("scp1"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-1") ("-e" "none") ("%h")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "scp")
-    (tramp-copy-args            (("-1") ("-P" "%p") ("-p" "%k")
-                                ("-q") ("-r") ("%c")))
-    (tramp-copy-keep-date       t)
-    (tramp-copy-recursive       t)
-    (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
-                                ("-o" "UserKnownHostsFile=/dev/null")
-                                ("-o" "StrictHostKeyChecking=no")))
-    (tramp-default-port         22)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("scp2"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-2") ("-e" "none") ("%h")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "scp")
-    (tramp-copy-args            (("-2") ("-P" "%p") ("-p" "%k")
-                                ("-q") ("-r") ("%c")))
-    (tramp-copy-keep-date       t)
-    (tramp-copy-recursive       t)
-    (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
-                                ("-o" "UserKnownHostsFile=/dev/null")
-                                ("-o" "StrictHostKeyChecking=no")))
-    (tramp-default-port         22)))
-;;;###tramp-autoload
 (add-to-list 'tramp-methods
   '("scpx"
     (tramp-login-program        "ssh")
@@ -232,32 +196,6 @@ detected as prompt when being sent on echoing hosts, therefore.")
                                 ("-o" "StrictHostKeyChecking=no")))
     (tramp-default-port         22)))
 ;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("ssh1"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-1") ("-e" "none") ("%h")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
-                                ("-o" "UserKnownHostsFile=/dev/null")
-                                ("-o" "StrictHostKeyChecking=no")))
-    (tramp-default-port         22)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("ssh2"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-2") ("-e" "none") ("%h")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
-                                ("-o" "UserKnownHostsFile=/dev/null")
-                                ("-o" "StrictHostKeyChecking=no")))
-    (tramp-default-port         22)))
-;;;###tramp-autoload
 (add-to-list 'tramp-methods
   '("sshx"
     (tramp-login-program        "ssh")
@@ -315,14 +253,6 @@ detected as prompt when being sent on echoing hosts, therefore.")
     (tramp-remote-shell-args    ("-c"))
     (tramp-default-port         22)))
 ;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("plink1"
-    (tramp-login-program        "plink")
-    (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-1" "-ssh") ("%h")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-default-port         22)))
-;;;###tramp-autoload
 (add-to-list 'tramp-methods
   `("plinkx"
     (tramp-login-program        "plink")
@@ -436,16 +366,12 @@ detected as prompt when being sent on echoing hosts, therefore.")
      (tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh)
      (tramp-set-completion-function "remcp" tramp-completion-function-alist-rsh)
      (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "scp1" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "scp2" tramp-completion-function-alist-ssh)
      (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh)
      (tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh)
      (tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh)
      (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh)
      (tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh)
      (tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "ssh1" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "ssh2" tramp-completion-function-alist-ssh)
      (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh)
      (tramp-set-completion-function
       "telnet" tramp-completion-function-alist-telnet)
@@ -455,8 +381,6 @@ detected as prompt when being sent on echoing hosts, therefore.")
      (tramp-set-completion-function
       "krlogin" tramp-completion-function-alist-rsh)
      (tramp-set-completion-function "plink" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function
-      "plink1" tramp-completion-function-alist-ssh)
      (tramp-set-completion-function
       "plinkx" tramp-completion-function-alist-putty)
      (tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh)
index e5e694921308b1adffdefe3744f7196383c92dc2..d959cfc854aee176f29a325d50eb0ccd7e9e8512 100644 (file)
@@ -1170,21 +1170,45 @@ If the `tramp-methods' entry does not exist, return nil."
     (and (stringp name)
         (string-match tramp-file-name-regexp name))))
 
+;; Obsoleted with Tramp 2.2.7.
+(defconst tramp-obsolete-methods
+  '("ssh1" "ssh2" "scp1" "scp2" "scpc" "rsyncc" "plink1")
+  "Obsolete methods.")
+
+(defvar tramp-warned-obsolete-methods nil
+  "Which methods the user has been warned to be obsolete.")
+
 (defun tramp-find-method (method user host)
   "Return the right method string to use.
 This is METHOD, if non-nil. Otherwise, do a lookup in
-`tramp-default-method-alist'."
-  (or method
-      (let ((choices tramp-default-method-alist)
-           lmethod item)
-       (while choices
-         (setq item (pop choices))
-         (when (and (string-match (or (nth 0 item) "") (or host ""))
-                    (string-match (or (nth 1 item) "") (or user "")))
-           (setq lmethod (nth 2 item))
-           (setq choices nil)))
-       lmethod)
-      tramp-default-method))
+`tramp-default-method-alist'.  It maps also obsolete methods to
+their replacement."
+  (let ((result
+        (or method
+            (let ((choices tramp-default-method-alist)
+                  lmethod item)
+              (while choices
+                (setq item (pop choices))
+                (when (and (string-match (or (nth 0 item) "") (or host ""))
+                           (string-match (or (nth 1 item) "") (or user "")))
+                  (setq lmethod (nth 2 item))
+                  (setq choices nil)))
+              lmethod)
+            tramp-default-method)))
+    ;; This is needed for a transition period only.
+    (when (member result tramp-obsolete-methods)
+      (unless (member result tramp-warned-obsolete-methods)
+       (if noninteractive
+           (warn "Method %s is obsolete, using %s"
+                 result (substring result 0 -1))
+         (unless (y-or-n-p (format "Method %s is obsolete, use %s? "
+                                   result (substring result 0 -1)))
+           (error 'file-error "Method \"%s\" not supported" result)))
+       (add-to-list 'tramp-warned-obsolete-methods result))
+      ;; This works with the current set of `tramp-obsolete-methods'.
+      ;; Must be improved, if their are more sophisticated replacements.
+      (setq result (substring result 0 -1)))
+    result))
 
 (defun tramp-find-user (method user host)
   "Return the right user string to use.