Mercurial > hg
changeset 28485:d3893900f6c8
httppeer: indent existing argument handling with if True
I'm about to add another case, so it makes sense to split this out to make the
semantic changes in the next change more obvious.
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 11 Mar 2016 11:33:43 -0500 |
parents | da6f713ab480 |
children | 50314dc3ae4e |
files | mercurial/httppeer.py |
diffstat | 1 files changed, 20 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/httppeer.py Fri Mar 11 11:26:12 2016 -0500 +++ b/mercurial/httppeer.py Fri Mar 11 11:33:43 2016 -0500 @@ -97,24 +97,26 @@ self.ui.debug("sending %s command\n" % cmd) q = [('cmd', cmd)] headersize = 0 - if len(args) > 0: - httpheader = self.capable('httpheader') - if httpheader: - headersize = int(httpheader.split(',', 1)[0]) - if headersize > 0: - # The headers can typically carry more data than the URL. - encargs = urllib.urlencode(sorted(args.items())) - headerfmt = 'X-HgArg-%s' - contentlen = headersize - len(headerfmt % '000' + ': \r\n') - headernum = 0 - for i in xrange(0, len(encargs), contentlen): - headernum += 1 - header = headerfmt % str(headernum) - headers[header] = encargs[i:i + contentlen] - varyheaders = [headerfmt % str(h) for h in range(1, headernum + 1)] - headers['Vary'] = ','.join(varyheaders) - else: - q += sorted(args.items()) + if True: + if len(args) > 0: + httpheader = self.capable('httpheader') + if httpheader: + headersize = int(httpheader.split(',', 1)[0]) + if headersize > 0: + # The headers can typically carry more data than the URL. + encargs = urllib.urlencode(sorted(args.items())) + headerfmt = 'X-HgArg-%s' + contentlen = headersize - len(headerfmt % '000' + ': \r\n') + headernum = 0 + for i in xrange(0, len(encargs), contentlen): + headernum += 1 + header = headerfmt % str(headernum) + headers[header] = encargs[i:i + contentlen] + varyheaders = [ + headerfmt % str(h) for h in range(1, headernum + 1)] + headers['Vary'] = ','.join(varyheaders) + else: + q += sorted(args.items()) qs = '?%s' % urllib.urlencode(q) cu = "%s%s" % (self._url, qs) size = 0