Show More
@@ -332,7 +332,7 b' class hgweb(object):' | |||||
332 | # translate user-visible url structure to internal structure |
|
332 | # translate user-visible url structure to internal structure | |
333 |
|
333 | |||
334 | args = query.split('/', 2) |
|
334 | args = query.split('/', 2) | |
335 |
if 'cmd' not in |
|
335 | if 'cmd' not in req.qsparams and args and args[0]: | |
336 | cmd = args.pop(0) |
|
336 | cmd = args.pop(0) | |
337 | style = cmd.rfind('-') |
|
337 | style = cmd.rfind('-') | |
338 | if style != -1: |
|
338 | if style != -1: | |
@@ -364,16 +364,16 b' class hgweb(object):' | |||||
364 | req.qsparams['style'] = 'raw' |
|
364 | req.qsparams['style'] = 'raw' | |
365 |
|
365 | |||
366 | if cmd == 'archive': |
|
366 | if cmd == 'archive': | |
367 |
fn = |
|
367 | fn = req.qsparams['node'] | |
368 | for type_, spec in rctx.archivespecs.iteritems(): |
|
368 | for type_, spec in rctx.archivespecs.iteritems(): | |
369 | ext = spec[2] |
|
369 | ext = spec[2] | |
370 | if fn.endswith(ext): |
|
370 | if fn.endswith(ext): | |
371 | wsgireq.form['node'] = [fn[:-len(ext)]] |
|
371 | wsgireq.form['node'] = [fn[:-len(ext)]] | |
372 |
req.qsparams['node'] = fn[:-len( |
|
372 | req.qsparams['node'] = fn[:-len(ext)] | |
373 | wsgireq.form['type'] = [type_] |
|
373 | wsgireq.form['type'] = [type_] | |
374 | req.qsparams['type'] = type_ |
|
374 | req.qsparams['type'] = type_ | |
375 | else: |
|
375 | else: | |
376 |
cmd = |
|
376 | cmd = req.qsparams.get('cmd', '') | |
377 |
|
377 | |||
378 | # process the web interface request |
|
378 | # process the web interface request | |
379 |
|
379 | |||
@@ -389,7 +389,7 b' class hgweb(object):' | |||||
389 | if cmd == '': |
|
389 | if cmd == '': | |
390 | wsgireq.form['cmd'] = [tmpl.cache['default']] |
|
390 | wsgireq.form['cmd'] = [tmpl.cache['default']] | |
391 | req.qsparams['cmd'] = tmpl.cache['default'] |
|
391 | req.qsparams['cmd'] = tmpl.cache['default'] | |
392 |
cmd = |
|
392 | cmd = req.qsparams['cmd'] | |
393 |
|
393 | |||
394 | # Don't enable caching if using a CSP nonce because then it wouldn't |
|
394 | # Don't enable caching if using a CSP nonce because then it wouldn't | |
395 | # be a nonce. |
|
395 | # be a nonce. |
@@ -229,6 +229,8 b' class hgwebdir(object):' | |||||
229 | yield r |
|
229 | yield r | |
230 |
|
230 | |||
231 | def _runwsgi(self, wsgireq): |
|
231 | def _runwsgi(self, wsgireq): | |
|
232 | req = wsgireq.req | |||
|
233 | ||||
232 | try: |
|
234 | try: | |
233 | self.refresh() |
|
235 | self.refresh() | |
234 |
|
236 | |||
@@ -242,11 +244,11 b' class hgwebdir(object):' | |||||
242 | ctype = templater.stringify(ctype) |
|
244 | ctype = templater.stringify(ctype) | |
243 |
|
245 | |||
244 | # a static file |
|
246 | # a static file | |
245 |
if virtual.startswith('static/') or 'static' in |
|
247 | if virtual.startswith('static/') or 'static' in req.qsparams: | |
246 | if virtual.startswith('static/'): |
|
248 | if virtual.startswith('static/'): | |
247 | fname = virtual[7:] |
|
249 | fname = virtual[7:] | |
248 | else: |
|
250 | else: | |
249 |
fname = |
|
251 | fname = req.qsparams['static'] | |
250 | static = self.ui.config("web", "static", None, |
|
252 | static = self.ui.config("web", "static", None, | |
251 | untrusted=False) |
|
253 | untrusted=False) | |
252 | if not static: |
|
254 | if not static: | |
@@ -471,8 +473,8 b' class hgwebdir(object):' | |||||
471 | self.refresh() |
|
473 | self.refresh() | |
472 | sortable = ["name", "description", "contact", "lastchange"] |
|
474 | sortable = ["name", "description", "contact", "lastchange"] | |
473 | sortcolumn, descending = sortdefault |
|
475 | sortcolumn, descending = sortdefault | |
474 |
if 'sort' in wsgireq. |
|
476 | if 'sort' in wsgireq.req.qsparams: | |
475 |
sortcolum |
|
477 | sortcolum = wsgireq.req.qsparams['sort'] | |
476 | descending = sortcolumn.startswith('-') |
|
478 | descending = sortcolumn.startswith('-') | |
477 | if descending: |
|
479 | if descending: | |
478 | sortcolumn = sortcolumn[1:] |
|
480 | sortcolumn = sortcolumn[1:] |
@@ -85,7 +85,7 b' def log(web, req, tmpl):' | |||||
85 | file will be shown. This form is equivalent to the ``filelog`` handler. |
|
85 | file will be shown. This form is equivalent to the ``filelog`` handler. | |
86 | """ |
|
86 | """ | |
87 |
|
87 | |||
88 | if 'file' in req.form and req.form['file'][0]: |
|
88 | if req.req.qsparams.get('file'): | |
89 | return filelog(web, req, tmpl) |
|
89 | return filelog(web, req, tmpl) | |
90 | else: |
|
90 | else: | |
91 | return changelog(web, req, tmpl) |
|
91 | return changelog(web, req, tmpl) | |
@@ -94,7 +94,7 b' def log(web, req, tmpl):' | |||||
94 | def rawfile(web, req, tmpl): |
|
94 | def rawfile(web, req, tmpl): | |
95 | guessmime = web.configbool('web', 'guessmime') |
|
95 | guessmime = web.configbool('web', 'guessmime') | |
96 |
|
96 | |||
97 |
path = webutil.cleanpath(web.repo, req. |
|
97 | path = webutil.cleanpath(web.repo, req.req.qsparams.get('file', '')) | |
98 | if not path: |
|
98 | if not path: | |
99 | content = manifest(web, req, tmpl) |
|
99 | content = manifest(web, req, tmpl) | |
100 | req.respond(HTTP_OK, web.ctype) |
|
100 | req.respond(HTTP_OK, web.ctype) | |
@@ -173,7 +173,7 b' def file(web, req, tmpl):' | |||||
173 | If ``path`` is not defined, information about the root directory will |
|
173 | If ``path`` is not defined, information about the root directory will | |
174 | be rendered. |
|
174 | be rendered. | |
175 | """ |
|
175 | """ | |
176 |
path = webutil.cleanpath(web.repo, req. |
|
176 | path = webutil.cleanpath(web.repo, req.req.qsparams.get('file', '')) | |
177 | if not path: |
|
177 | if not path: | |
178 | return manifest(web, req, tmpl) |
|
178 | return manifest(web, req, tmpl) | |
179 | try: |
|
179 | try: | |
@@ -289,11 +289,11 b' def _search(web, req, tmpl):' | |||||
289 | if count >= revcount: |
|
289 | if count >= revcount: | |
290 | break |
|
290 | break | |
291 |
|
291 | |||
292 |
query = req. |
|
292 | query = req.req.qsparams['rev'] | |
293 | revcount = web.maxchanges |
|
293 | revcount = web.maxchanges | |
294 |
if 'revcount' in req. |
|
294 | if 'revcount' in req.req.qsparams: | |
295 | try: |
|
295 | try: | |
296 |
revcount = int(req. |
|
296 | revcount = int(req.req.qsparams.get('revcount', revcount)) | |
297 | revcount = max(revcount, 1) |
|
297 | revcount = max(revcount, 1) | |
298 | tmpl.defaults['sessionvars']['revcount'] = revcount |
|
298 | tmpl.defaults['sessionvars']['revcount'] = revcount | |
299 | except ValueError: |
|
299 | except ValueError: | |
@@ -308,7 +308,7 b' def _search(web, req, tmpl):' | |||||
308 |
|
308 | |||
309 | mode, funcarg = getsearchmode(query) |
|
309 | mode, funcarg = getsearchmode(query) | |
310 |
|
310 | |||
311 |
if 'forcekw' in req. |
|
311 | if 'forcekw' in req.req.qsparams: | |
312 | showforcekw = '' |
|
312 | showforcekw = '' | |
313 | showunforcekw = searchfuncs[mode][1] |
|
313 | showunforcekw = searchfuncs[mode][1] | |
314 | mode = MODE_KEYWORD |
|
314 | mode = MODE_KEYWORD | |
@@ -358,10 +358,10 b' def changelog(web, req, tmpl, shortlog=F' | |||||
358 | """ |
|
358 | """ | |
359 |
|
359 | |||
360 | query = '' |
|
360 | query = '' | |
361 |
if 'node' in req. |
|
361 | if 'node' in req.req.qsparams: | |
362 | ctx = webutil.changectx(web.repo, req) |
|
362 | ctx = webutil.changectx(web.repo, req) | |
363 | symrev = webutil.symrevorshortnode(req, ctx) |
|
363 | symrev = webutil.symrevorshortnode(req, ctx) | |
364 |
elif 'rev' in req. |
|
364 | elif 'rev' in req.req.qsparams: | |
365 | return _search(web, req, tmpl) |
|
365 | return _search(web, req, tmpl) | |
366 | else: |
|
366 | else: | |
367 | ctx = web.repo['tip'] |
|
367 | ctx = web.repo['tip'] | |
@@ -386,9 +386,9 b' def changelog(web, req, tmpl, shortlog=F' | |||||
386 | else: |
|
386 | else: | |
387 | revcount = web.maxchanges |
|
387 | revcount = web.maxchanges | |
388 |
|
388 | |||
389 |
if 'revcount' in req. |
|
389 | if 'revcount' in req.req.qsparams: | |
390 | try: |
|
390 | try: | |
391 |
revcount = int(req. |
|
391 | revcount = int(req.req.qsparams.get('revcount', revcount)) | |
392 | revcount = max(revcount, 1) |
|
392 | revcount = max(revcount, 1) | |
393 | tmpl.defaults['sessionvars']['revcount'] = revcount |
|
393 | tmpl.defaults['sessionvars']['revcount'] = revcount | |
394 | except ValueError: |
|
394 | except ValueError: | |
@@ -481,13 +481,13 b' def manifest(web, req, tmpl):' | |||||
481 |
|
481 | |||
482 | The ``manifest`` template will be rendered for this handler. |
|
482 | The ``manifest`` template will be rendered for this handler. | |
483 | """ |
|
483 | """ | |
484 |
if 'node' in req. |
|
484 | if 'node' in req.req.qsparams: | |
485 | ctx = webutil.changectx(web.repo, req) |
|
485 | ctx = webutil.changectx(web.repo, req) | |
486 | symrev = webutil.symrevorshortnode(req, ctx) |
|
486 | symrev = webutil.symrevorshortnode(req, ctx) | |
487 | else: |
|
487 | else: | |
488 | ctx = web.repo['tip'] |
|
488 | ctx = web.repo['tip'] | |
489 | symrev = 'tip' |
|
489 | symrev = 'tip' | |
490 |
path = webutil.cleanpath(web.repo, req. |
|
490 | path = webutil.cleanpath(web.repo, req.req.qsparams.get('file', '')) | |
491 | mf = ctx.manifest() |
|
491 | mf = ctx.manifest() | |
492 | node = ctx.node() |
|
492 | node = ctx.node() | |
493 |
|
493 | |||
@@ -752,7 +752,7 b' def filediff(web, req, tmpl):' | |||||
752 | fctx = webutil.filectx(web.repo, req) |
|
752 | fctx = webutil.filectx(web.repo, req) | |
753 | except LookupError: |
|
753 | except LookupError: | |
754 | ctx = webutil.changectx(web.repo, req) |
|
754 | ctx = webutil.changectx(web.repo, req) | |
755 |
path = webutil.cleanpath(web.repo, req. |
|
755 | path = webutil.cleanpath(web.repo, req.req.qsparams['file']) | |
756 | if path not in ctx.files(): |
|
756 | if path not in ctx.files(): | |
757 | raise |
|
757 | raise | |
758 |
|
758 | |||
@@ -799,13 +799,13 b' def comparison(web, req, tmpl):' | |||||
799 | The ``filecomparison`` template is rendered. |
|
799 | The ``filecomparison`` template is rendered. | |
800 | """ |
|
800 | """ | |
801 | ctx = webutil.changectx(web.repo, req) |
|
801 | ctx = webutil.changectx(web.repo, req) | |
802 |
if 'file' not in req. |
|
802 | if 'file' not in req.req.qsparams: | |
803 | raise ErrorResponse(HTTP_NOT_FOUND, 'file not given') |
|
803 | raise ErrorResponse(HTTP_NOT_FOUND, 'file not given') | |
804 |
path = webutil.cleanpath(web.repo, req. |
|
804 | path = webutil.cleanpath(web.repo, req.req.qsparams['file']) | |
805 |
|
805 | |||
806 | parsecontext = lambda v: v == 'full' and -1 or int(v) |
|
806 | parsecontext = lambda v: v == 'full' and -1 or int(v) | |
807 |
if 'context' in req. |
|
807 | if 'context' in req.req.qsparams: | |
808 |
context = parsecontext(req. |
|
808 | context = parsecontext(req.req.qsparams['context']) | |
809 | else: |
|
809 | else: | |
810 | context = parsecontext(web.config('web', 'comparisoncontext', '5')) |
|
810 | context = parsecontext(web.config('web', 'comparisoncontext', '5')) | |
811 |
|
811 | |||
@@ -964,7 +964,7 b' def filelog(web, req, tmpl):' | |||||
964 | f = fctx.path() |
|
964 | f = fctx.path() | |
965 | fl = fctx.filelog() |
|
965 | fl = fctx.filelog() | |
966 | except error.LookupError: |
|
966 | except error.LookupError: | |
967 |
f = webutil.cleanpath(web.repo, req. |
|
967 | f = webutil.cleanpath(web.repo, req.req.qsparams['file']) | |
968 | fl = web.repo.file(f) |
|
968 | fl = web.repo.file(f) | |
969 | numrevs = len(fl) |
|
969 | numrevs = len(fl) | |
970 | if not numrevs: # file doesn't exist at all |
|
970 | if not numrevs: # file doesn't exist at all | |
@@ -979,9 +979,9 b' def filelog(web, req, tmpl):' | |||||
979 | fctx = web.repo.filectx(f, fl.linkrev(frev)) |
|
979 | fctx = web.repo.filectx(f, fl.linkrev(frev)) | |
980 |
|
980 | |||
981 | revcount = web.maxshortchanges |
|
981 | revcount = web.maxshortchanges | |
982 |
if 'revcount' in req. |
|
982 | if 'revcount' in req.req.qsparams: | |
983 | try: |
|
983 | try: | |
984 |
revcount = int(req. |
|
984 | revcount = int(req.req.qsparams.get('revcount', revcount)) | |
985 | revcount = max(revcount, 1) |
|
985 | revcount = max(revcount, 1) | |
986 | tmpl.defaults['sessionvars']['revcount'] = revcount |
|
986 | tmpl.defaults['sessionvars']['revcount'] = revcount | |
987 | except ValueError: |
|
987 | except ValueError: | |
@@ -994,12 +994,12 b' def filelog(web, req, tmpl):' | |||||
994 | morevars = copy.copy(tmpl.defaults['sessionvars']) |
|
994 | morevars = copy.copy(tmpl.defaults['sessionvars']) | |
995 | morevars['revcount'] = revcount * 2 |
|
995 | morevars['revcount'] = revcount * 2 | |
996 |
|
996 | |||
997 |
patch = 'patch' in req. |
|
997 | patch = 'patch' in req.req.qsparams | |
998 | if patch: |
|
998 | if patch: | |
999 |
lessvars['patch'] = morevars['patch'] = req. |
|
999 | lessvars['patch'] = morevars['patch'] = req.req.qsparams['patch'] | |
1000 |
descend = 'descend' in req. |
|
1000 | descend = 'descend' in req.req.qsparams | |
1001 | if descend: |
|
1001 | if descend: | |
1002 |
lessvars['descend'] = morevars['descend'] = req. |
|
1002 | lessvars['descend'] = morevars['descend'] = req.req.qsparams['descend'] | |
1003 |
|
1003 | |||
1004 | count = fctx.filerev() + 1 |
|
1004 | count = fctx.filerev() + 1 | |
1005 | start = max(0, count - revcount) # first rev on this page |
|
1005 | start = max(0, count - revcount) # first rev on this page | |
@@ -1103,9 +1103,9 b' def archive(web, req, tmpl):' | |||||
1103 | No template is used for this handler. Raw, binary content is generated. |
|
1103 | No template is used for this handler. Raw, binary content is generated. | |
1104 | """ |
|
1104 | """ | |
1105 |
|
1105 | |||
1106 |
type_ = req. |
|
1106 | type_ = req.req.qsparams.get('type') | |
1107 | allowed = web.configlist("web", "allow_archive") |
|
1107 | allowed = web.configlist("web", "allow_archive") | |
1108 |
key = req. |
|
1108 | key = req.req.qsparams['node'] | |
1109 |
|
1109 | |||
1110 | if type_ not in web.archivespecs: |
|
1110 | if type_ not in web.archivespecs: | |
1111 | msg = 'Unsupported archive type: %s' % type_ |
|
1111 | msg = 'Unsupported archive type: %s' % type_ | |
@@ -1126,15 +1126,15 b' def archive(web, req, tmpl):' | |||||
1126 | ctx = webutil.changectx(web.repo, req) |
|
1126 | ctx = webutil.changectx(web.repo, req) | |
1127 | pats = [] |
|
1127 | pats = [] | |
1128 | match = scmutil.match(ctx, []) |
|
1128 | match = scmutil.match(ctx, []) | |
1129 |
file = req. |
|
1129 | file = req.req.qsparams.get('file') | |
1130 | if file: |
|
1130 | if file: | |
1131 |
pats = ['path:' + file |
|
1131 | pats = ['path:' + file] | |
1132 | match = scmutil.match(ctx, pats, default='path') |
|
1132 | match = scmutil.match(ctx, pats, default='path') | |
1133 | if pats: |
|
1133 | if pats: | |
1134 | files = [f for f in ctx.manifest().keys() if match(f)] |
|
1134 | files = [f for f in ctx.manifest().keys() if match(f)] | |
1135 | if not files: |
|
1135 | if not files: | |
1136 | raise ErrorResponse(HTTP_NOT_FOUND, |
|
1136 | raise ErrorResponse(HTTP_NOT_FOUND, | |
1137 |
'file(s) not found: %s' % file |
|
1137 | 'file(s) not found: %s' % file) | |
1138 |
|
1138 | |||
1139 | mimetype, artype, extension, encoding = web.archivespecs[type_] |
|
1139 | mimetype, artype, extension, encoding = web.archivespecs[type_] | |
1140 | headers = [ |
|
1140 | headers = [ | |
@@ -1153,7 +1153,7 b' def archive(web, req, tmpl):' | |||||
1153 |
|
1153 | |||
1154 | @webcommand('static') |
|
1154 | @webcommand('static') | |
1155 | def static(web, req, tmpl): |
|
1155 | def static(web, req, tmpl): | |
1156 |
fname = req. |
|
1156 | fname = req.req.qsparams['file'] | |
1157 | # a repo owner may set web.static in .hg/hgrc to get any file |
|
1157 | # a repo owner may set web.static in .hg/hgrc to get any file | |
1158 | # readable by the user running the CGI script |
|
1158 | # readable by the user running the CGI script | |
1159 | static = web.config("web", "static", None, untrusted=False) |
|
1159 | static = web.config("web", "static", None, untrusted=False) | |
@@ -1189,7 +1189,7 b' def graph(web, req, tmpl):' | |||||
1189 | This handler will render the ``graph`` template. |
|
1189 | This handler will render the ``graph`` template. | |
1190 | """ |
|
1190 | """ | |
1191 |
|
1191 | |||
1192 |
if 'node' in req. |
|
1192 | if 'node' in req.req.qsparams: | |
1193 | ctx = webutil.changectx(web.repo, req) |
|
1193 | ctx = webutil.changectx(web.repo, req) | |
1194 | symrev = webutil.symrevorshortnode(req, ctx) |
|
1194 | symrev = webutil.symrevorshortnode(req, ctx) | |
1195 | else: |
|
1195 | else: | |
@@ -1199,9 +1199,9 b' def graph(web, req, tmpl):' | |||||
1199 |
|
1199 | |||
1200 | bg_height = 39 |
|
1200 | bg_height = 39 | |
1201 | revcount = web.maxshortchanges |
|
1201 | revcount = web.maxshortchanges | |
1202 |
if 'revcount' in req. |
|
1202 | if 'revcount' in req.req.qsparams: | |
1203 | try: |
|
1203 | try: | |
1204 |
revcount = int(req. |
|
1204 | revcount = int(req.req.qsparams.get('revcount', revcount)) | |
1205 | revcount = max(revcount, 1) |
|
1205 | revcount = max(revcount, 1) | |
1206 | tmpl.defaults['sessionvars']['revcount'] = revcount |
|
1206 | tmpl.defaults['sessionvars']['revcount'] = revcount | |
1207 | except ValueError: |
|
1207 | except ValueError: | |
@@ -1212,7 +1212,7 b' def graph(web, req, tmpl):' | |||||
1212 | morevars = copy.copy(tmpl.defaults['sessionvars']) |
|
1212 | morevars = copy.copy(tmpl.defaults['sessionvars']) | |
1213 | morevars['revcount'] = revcount * 2 |
|
1213 | morevars['revcount'] = revcount * 2 | |
1214 |
|
1214 | |||
1215 |
graphtop = req. |
|
1215 | graphtop = req.req.qsparams.get('graphtop', ctx.hex()) | |
1216 | graphvars = copy.copy(tmpl.defaults['sessionvars']) |
|
1216 | graphvars = copy.copy(tmpl.defaults['sessionvars']) | |
1217 | graphvars['graphtop'] = graphtop |
|
1217 | graphvars['graphtop'] = graphtop | |
1218 |
|
1218 | |||
@@ -1342,7 +1342,7 b' def help(web, req, tmpl):' | |||||
1342 | """ |
|
1342 | """ | |
1343 | from .. import commands, help as helpmod # avoid cycle |
|
1343 | from .. import commands, help as helpmod # avoid cycle | |
1344 |
|
1344 | |||
1345 |
topicname = req. |
|
1345 | topicname = req.req.qsparams.get('node') | |
1346 | if not topicname: |
|
1346 | if not topicname: | |
1347 | def topics(**map): |
|
1347 | def topics(**map): | |
1348 | for entries, summary, _doc in helpmod.helptable: |
|
1348 | for entries, summary, _doc in helpmod.helptable: |
@@ -177,7 +177,7 b' def difffeatureopts(req, ui, section):' | |||||
177 | section=section, whitespace=True) |
|
177 | section=section, whitespace=True) | |
178 |
|
178 | |||
179 | for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'): |
|
179 | for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'): | |
180 |
v = req. |
|
180 | v = req.req.qsparams.get(k) | |
181 | if v is not None: |
|
181 | if v is not None: | |
182 | v = util.parsebool(v) |
|
182 | v = util.parsebool(v) | |
183 | setattr(diffopts, k, v if v is not None else True) |
|
183 | setattr(diffopts, k, v if v is not None else True) | |
@@ -295,19 +295,19 b' def changeidctx(repo, changeid):' | |||||
295 |
|
295 | |||
296 | def changectx(repo, req): |
|
296 | def changectx(repo, req): | |
297 | changeid = "tip" |
|
297 | changeid = "tip" | |
298 |
if 'node' in req. |
|
298 | if 'node' in req.req.qsparams: | |
299 |
changeid = req. |
|
299 | changeid = req.req.qsparams['node'] | |
300 | ipos = changeid.find(':') |
|
300 | ipos = changeid.find(':') | |
301 | if ipos != -1: |
|
301 | if ipos != -1: | |
302 | changeid = changeid[(ipos + 1):] |
|
302 | changeid = changeid[(ipos + 1):] | |
303 |
elif 'manifest' in req. |
|
303 | elif 'manifest' in req.req.qsparams: | |
304 |
changeid = req. |
|
304 | changeid = req.req.qsparams['manifest'] | |
305 |
|
305 | |||
306 | return changeidctx(repo, changeid) |
|
306 | return changeidctx(repo, changeid) | |
307 |
|
307 | |||
308 | def basechangectx(repo, req): |
|
308 | def basechangectx(repo, req): | |
309 |
if 'node' in req. |
|
309 | if 'node' in req.req.qsparams: | |
310 |
changeid = req. |
|
310 | changeid = req.req.qsparams['node'] | |
311 | ipos = changeid.find(':') |
|
311 | ipos = changeid.find(':') | |
312 | if ipos != -1: |
|
312 | if ipos != -1: | |
313 | changeid = changeid[:ipos] |
|
313 | changeid = changeid[:ipos] | |
@@ -316,13 +316,13 b' def basechangectx(repo, req):' | |||||
316 | return None |
|
316 | return None | |
317 |
|
317 | |||
318 | def filectx(repo, req): |
|
318 | def filectx(repo, req): | |
319 |
if 'file' not in req. |
|
319 | if 'file' not in req.req.qsparams: | |
320 | raise ErrorResponse(HTTP_NOT_FOUND, 'file not given') |
|
320 | raise ErrorResponse(HTTP_NOT_FOUND, 'file not given') | |
321 |
path = cleanpath(repo, req. |
|
321 | path = cleanpath(repo, req.req.qsparams['file']) | |
322 |
if 'node' in req. |
|
322 | if 'node' in req.req.qsparams: | |
323 |
changeid = req. |
|
323 | changeid = req.req.qsparams['node'] | |
324 |
elif 'filenode' in req. |
|
324 | elif 'filenode' in req.req.qsparams: | |
325 |
changeid = req. |
|
325 | changeid = req.req.qsparams['filenode'] | |
326 | else: |
|
326 | else: | |
327 | raise ErrorResponse(HTTP_NOT_FOUND, 'node or filenode not given') |
|
327 | raise ErrorResponse(HTTP_NOT_FOUND, 'node or filenode not given') | |
328 | try: |
|
328 | try: | |
@@ -333,8 +333,8 b' def filectx(repo, req):' | |||||
333 | return fctx |
|
333 | return fctx | |
334 |
|
334 | |||
335 | def linerange(req): |
|
335 | def linerange(req): | |
336 |
linerange = req. |
|
336 | linerange = req.req.qsparams.getall('linerange') | |
337 |
if linerange |
|
337 | if not linerange: | |
338 | return None |
|
338 | return None | |
339 | if len(linerange) > 1: |
|
339 | if len(linerange) > 1: | |
340 | raise ErrorResponse(HTTP_BAD_REQUEST, |
|
340 | raise ErrorResponse(HTTP_BAD_REQUEST, | |
@@ -412,8 +412,8 b' def changelistentry(web, ctx, tmpl):' | |||||
412 | return entry |
|
412 | return entry | |
413 |
|
413 | |||
414 | def symrevorshortnode(req, ctx): |
|
414 | def symrevorshortnode(req, ctx): | |
415 |
if 'node' in req. |
|
415 | if 'node' in req.req.qsparams: | |
416 |
return templatefilters.revescape(req. |
|
416 | return templatefilters.revescape(req.req.qsparams['node']) | |
417 | else: |
|
417 | else: | |
418 | return short(ctx.node()) |
|
418 | return short(ctx.node()) | |
419 |
|
419 |
@@ -10,7 +10,7 b' def raiseerror(web, req, tmpl):' | |||||
10 | '''Dummy web command that raises an uncaught Exception.''' |
|
10 | '''Dummy web command that raises an uncaught Exception.''' | |
11 |
|
11 | |||
12 | # Simulate an error after partial response. |
|
12 | # Simulate an error after partial response. | |
13 |
if 'partialresponse' in req. |
|
13 | if 'partialresponse' in req.req.qsparams: | |
14 | req.respond(200, 'text/plain') |
|
14 | req.respond(200, 'text/plain') | |
15 | req.write('partial content\n') |
|
15 | req.write('partial content\n') | |
16 |
|
16 |
General Comments 0
You need to be logged in to leave comments.
Login now