diff mercurial/httppeer.py @ 36961:586891c561dc

httppeer: consolidate _requestbuilder assignments and document I collapsed multiple assignments because they don't appear to be necessary. We don't invoke the requestbuilder in anything called during __init__. So there's no reason to not define it earlier AFAICT. This seemingly useless attribute is actually an extension point. Document it as such. (A previous version of this patch removed the attribute because it appeared to just be an alias.) Differential Revision: https://phab.mercurial-scm.org/D2723
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 15 Mar 2018 11:19:16 -0700
parents 43815d87c6aa
children 8e89c2bec1f7
line wrap: on
line diff
--- a/mercurial/httppeer.py	Mon Mar 05 00:18:07 2018 -0500
+++ b/mercurial/httppeer.py	Thu Mar 15 11:19:16 2018 -0700
@@ -138,7 +138,9 @@
         self._path = path
         self._caps = None
         self._urlopener = None
-        self._requestbuilder = None
+        # This is an its own attribute to facilitate extensions overriding
+        # the default type.
+        self._requestbuilder = urlreq.request
         u = util.url(path)
         if u.query or u.fragment:
             raise error.Abort(_('unsupported URL component: "%s"') %
@@ -151,7 +153,6 @@
         ui.debug('using %s\n' % self._url)
 
         self._urlopener = urlmod.opener(ui, authinfo)
-        self._requestbuilder = urlreq.request
 
     def __del__(self):
         urlopener = getattr(self, '_urlopener', None)