Let's make this file slightly easier to read.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Let's make this file slightly easier to read.
Lint Skipped |
Unit Tests Skipped |
star = {} | star = {} | ||||
for key in knownargs.keys(): | for key in knownargs.keys(): | ||||
if key != 'cmd' and key not in keys: | if key != 'cmd' and key not in keys: | ||||
star[key] = knownargs[key][0] | star[key] = knownargs[key][0] | ||||
data['*'] = star | data['*'] = star | ||||
else: | else: | ||||
data[k] = knownargs[k][0] | data[k] = knownargs[k][0] | ||||
return [data[k] for k in keys] | return [data[k] for k in keys] | ||||
def _args(self): | def _args(self): | ||||
args = self.req.form.copy() | args = self.req.form.copy() | ||||
if pycompat.ispy3: | if pycompat.ispy3: | ||||
args = {k.encode('ascii'): [v.encode('ascii') for v in vs] | args = {k.encode('ascii'): [v.encode('ascii') for v in vs] | ||||
for k, vs in args.items()} | for k, vs in args.items()} | ||||
postlen = int(self.req.env.get(r'HTTP_X_HGARGS_POST', 0)) | postlen = int(self.req.env.get(r'HTTP_X_HGARGS_POST', 0)) | ||||
if postlen: | if postlen: | ||||
args.update(cgi.parse_qs( | args.update(cgi.parse_qs( | ||||
self.req.read(postlen), keep_blank_values=True)) | self.req.read(postlen), keep_blank_values=True)) | ||||
return args | return args | ||||
argvalue = decodevaluefromheaders(self.req, r'X-HgArg') | argvalue = decodevaluefromheaders(self.req, r'X-HgArg') | ||||
args.update(cgi.parse_qs(argvalue, keep_blank_values=True)) | args.update(cgi.parse_qs(argvalue, keep_blank_values=True)) | ||||
return args | return args | ||||
def getfile(self, fp): | def getfile(self, fp): | ||||
length = int(self.req.env[r'CONTENT_LENGTH']) | length = int(self.req.env[r'CONTENT_LENGTH']) | ||||
# If httppostargs is used, we need to read Content-Length | # If httppostargs is used, we need to read Content-Length | ||||
# minus the amount that was consumed by args. | # minus the amount that was consumed by args. | ||||
length -= int(self.req.env.get(r'HTTP_X_HGARGS_POST', 0)) | length -= int(self.req.env.get(r'HTTP_X_HGARGS_POST', 0)) | ||||
for s in util.filechunkiter(self.req, limit=length): | for s in util.filechunkiter(self.req, limit=length): | ||||
fp.write(s) | fp.write(s) | ||||
def redirect(self): | def redirect(self): | ||||
self.oldio = self.ui.fout, self.ui.ferr | self.oldio = self.ui.fout, self.ui.ferr | ||||
self.ui.ferr = self.ui.fout = stringio() | self.ui.ferr = self.ui.fout = stringio() | ||||
def restore(self): | def restore(self): | ||||
val = self.ui.fout.getvalue() | val = self.ui.fout.getvalue() | ||||
self.ui.ferr, self.ui.fout = self.oldio | self.ui.ferr, self.ui.fout = self.oldio | ||||
return val | return val | ||||
def _client(self): | def _client(self): | ||||
return 'remote:%s:%s:%s' % ( | return 'remote:%s:%s:%s' % ( | ||||
self.req.env.get('wsgi.url_scheme') or 'http', | self.req.env.get('wsgi.url_scheme') or 'http', |