# HG changeset patch # User Gregory Szorc # Date 2018-03-15 18:19:16 # Node ID 586891c561dcff4ec87690f8dfdbd599881a2f0f # Parent 66651ec259eaa7492dcef822ce6a46d073bbd07f 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 diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -138,7 +138,9 @@ class httppeer(wireproto.wirepeer): 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 @@ class httppeer(wireproto.wirepeer): 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)