diff mercurial/debugcommands.py @ 37552:8b8a845c85fc

httppeer: perform capabilities request in makepeer() Previously, we constructed an httppeer then always ran _fetchcaps() to issue the capabilities command. We want to issue the capabilities command before constructing a peer instance so we can construct an appropriate peer instance depending on the capabilities result. With the code for making and sending requests moved out of httppeer, it is now possible to send command requests without an httppeer. This commit creates a new function for making the capabilities request and calls it as part of makepeer(). This code should be functionality equivalent to what existed before. Differential Revision: https://phab.mercurial-scm.org/D3237
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 10 Apr 2018 13:11:40 -0700
parents 835ccc2a5ef1
children 6b08cf6b900f
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Tue Apr 10 12:52:29 2018 -0700
+++ b/mercurial/debugcommands.py	Tue Apr 10 13:11:40 2018 -0700
@@ -2915,9 +2915,12 @@
             raise error.Abort(_('--peer %s not supported with HTTP peers') %
                               opts['peer'])
         else:
+            url, caps = httppeer.performhandshake(ui, url, opener,
+                                                  httppeer.urlreq.request)
+
             peer = httppeer.httppeer(ui, path, url, opener,
-                                     requestbuilder=httppeer.urlreq.request)
-            peer._fetchcaps()
+                                     httppeer.urlreq.request,
+                                     caps)
 
         # We /could/ populate stdin/stdout with sock.makefile()...
     else: