comparison mercurial/debugcommands.py @ 37547:835ccc2a5ef1

httppeer: move requestbuilder defaults into makepeer() argument Upcoming commits will move the initial ?cmd=capabilities handshake request out of httppeer so the handshake can be performed before a peer instance is constructed. In order to do this, we'll need to refactor code for making HTTP requests. The type used to construct HTTP requests is configurable. If we'll be making HTTP requests outside of httppeer, we should be able to use a custom request builder. So move the definition of that type into makepeer(). Extensions can monkeypatch the function and override the argument value. Differential Revision: https://phab.mercurial-scm.org/D3232
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 10 Apr 2018 10:22:26 -0700
parents 61e405fb6372
children 8b8a845c85fc
comparison
equal deleted inserted replaced
37546:3a2367e6c6f2 37547:835ccc2a5ef1
2913 peer = None 2913 peer = None
2914 elif opts['peer']: 2914 elif opts['peer']:
2915 raise error.Abort(_('--peer %s not supported with HTTP peers') % 2915 raise error.Abort(_('--peer %s not supported with HTTP peers') %
2916 opts['peer']) 2916 opts['peer'])
2917 else: 2917 else:
2918 peer = httppeer.httppeer(ui, path, url, opener) 2918 peer = httppeer.httppeer(ui, path, url, opener,
2919 requestbuilder=httppeer.urlreq.request)
2919 peer._fetchcaps() 2920 peer._fetchcaps()
2920 2921
2921 # We /could/ populate stdin/stdout with sock.makefile()... 2922 # We /could/ populate stdin/stdout with sock.makefile()...
2922 else: 2923 else:
2923 raise error.Abort(_('unsupported connection configuration')) 2924 raise error.Abort(_('unsupported connection configuration'))