sshpeer: remove support for connecting to <0.9.1 servers (BC)
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 04 Feb 2018 14:58:32 -0800
changeset 35980 556218e08e25
parent 35979 a622a927fe03
child 35981 3028a3215a2e
sshpeer: remove support for connecting to <0.9.1 servers (BC) 197d10e157ce made this change for the HTTP peer. Let's do the same for the SSH peer. Test output changes as expected. A redundant test has been dropped. .. bc:: Support for connecting to Mercurial servers older than 0.9.1 has been removed. Differential Revision: https://phab.mercurial-scm.org/D2036
mercurial/sshpeer.py
tests/test-ssh-proto.t
--- a/mercurial/sshpeer.py	Sun Feb 04 14:44:04 2018 -0800
+++ b/mercurial/sshpeer.py	Sun Feb 04 14:58:32 2018 -0800
@@ -242,6 +242,16 @@
             caps.update(l[:-1].split(':')[1].split())
             break
 
+    # Error if we couldn't find a response to ``hello``. This could
+    # mean:
+    #
+    # 1. Remote isn't a Mercurial server
+    # 2. Remote is a <0.9.1 Mercurial server
+    # 3. Remote is a future Mercurial server that dropped ``hello``
+    #    support.
+    if not caps:
+        badresponse()
+
     return caps
 
 class sshpeer(wireproto.wirepeer):
--- a/tests/test-ssh-proto.t	Sun Feb 04 14:44:04 2018 -0800
+++ b/tests/test-ssh-proto.t	Sun Feb 04 14:58:32 2018 -0800
@@ -109,7 +109,9 @@
   1
   
 
-Connecting to a <0.9.1 server that doesn't support the hello command
+Connecting to a <0.9.1 server that doesn't support the hello command.
+The client should refuse, as we dropped support for connecting to such
+servers.
 
   $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server
   running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob)
@@ -120,14 +122,8 @@
   sending between command
   remote: 0
   remote: 1
-  url: ssh://user@dummy/server
-  local: no
-  pushable: yes
-
-The client should interpret this as no capabilities
-
-  $ SSHSERVERMODE=no-hello hg debugcapabilities ssh://user@dummy/server
-  Main capabilities:
+  abort: no suitable response from remote hg!
+  [255]
 
 Sending an unknown command to the server results in an empty response to that command