Mercurial > public > mercurial-scm > hg
comparison mercurial/httppeer.py @ 40426:588f1e9a4d16 stable
http: work around custom http client classes that refuse extra attrs
I have no idea what is going on with our custom http client code at Google,
but it chokes on these extra attributes we're tucking on http clients. Since
it feels more than a little wrong to just stuff extra data on a client, let's
degrade gracefully when the client class refuses the attributes.
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 29 Oct 2018 16:23:42 -0400 |
parents | dac438b7346e |
children | a9b609fbe39c |
comparison
equal
deleted
inserted
replaced
40422:7e4ffe2719e4 | 40426:588f1e9a4d16 |
---|---|
403 | 403 |
404 def canpush(self): | 404 def canpush(self): |
405 return True | 405 return True |
406 | 406 |
407 def close(self): | 407 def close(self): |
408 try: | |
409 reqs, sent, recv = (self._urlopener.requestscount, | |
410 self._urlopener.sentbytescount, | |
411 self._urlopener.receivedbytescount) | |
412 except AttributeError: | |
413 return | |
408 self.ui.note(_('(sent %d HTTP requests and %d bytes; ' | 414 self.ui.note(_('(sent %d HTTP requests and %d bytes; ' |
409 'received %d bytes in responses)\n') % | 415 'received %d bytes in responses)\n') % |
410 (self._urlopener.requestscount, | 416 (reqs, sent, recv)) |
411 self._urlopener.sentbytescount, | |
412 self._urlopener.receivedbytescount)) | |
413 | 417 |
414 # End of ipeerconnection interface. | 418 # End of ipeerconnection interface. |
415 | 419 |
416 # Begin of ipeercommands interface. | 420 # Begin of ipeercommands interface. |
417 | 421 |