Patchwork D2036: sshpeer: remove support for connecting to <0.9.1 servers (BC)

login
register
mail settings
Submitter phabricator
Date Feb. 6, 2018, 1:24 p.m.
Message ID <9437e2857cbe8814b01dadbea1ec1079@localhost.localdomain>
Download mbox | patch
Permalink /patch/27378/
State Not Applicable
Headers show

Comments

phabricator - Feb. 6, 2018, 1:24 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG556218e08e25: sshpeer: remove support for connecting to &lt;0.9.1 servers (BC) (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2036?vs=5237&id=5253

REVISION DETAIL
  https://phab.mercurial-scm.org/D2036

AFFECTED FILES
  mercurial/sshpeer.py
  tests/test-ssh-proto.t

CHANGE DETAILS




To: indygreg, #hg-reviewers, lothiraldan, yuja
Cc: mercurial-devel

Patch

diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t
--- a/tests/test-ssh-proto.t
+++ b/tests/test-ssh-proto.t
@@ -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
 
diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -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):