##// END OF EJS Templates
hgweb: use web.req instead of req.req...
Gregory Szorc -
r36898:66f62d12 default
parent child Browse files
Show More
@@ -93,7 +93,7 b' def log(web, req, tmpl):'
93 93 file will be shown. This form is equivalent to the ``filelog`` handler.
94 94 """
95 95
96 if req.req.qsparams.get('file'):
96 if web.req.qsparams.get('file'):
97 97 return filelog(web, req, tmpl)
98 98 else:
99 99 return changelog(web, req, tmpl)
@@ -102,7 +102,7 b' def log(web, req, tmpl):'
102 102 def rawfile(web, req, tmpl):
103 103 guessmime = web.configbool('web', 'guessmime')
104 104
105 path = webutil.cleanpath(web.repo, req.req.qsparams.get('file', ''))
105 path = webutil.cleanpath(web.repo, web.req.qsparams.get('file', ''))
106 106 if not path:
107 107 return manifest(web, req, tmpl)
108 108
@@ -187,7 +187,7 b' def file(web, req, tmpl):'
187 187 if web.req.qsparams.get('style') == 'raw':
188 188 return rawfile(web, req, tmpl)
189 189
190 path = webutil.cleanpath(web.repo, req.req.qsparams.get('file', ''))
190 path = webutil.cleanpath(web.repo, web.req.qsparams.get('file', ''))
191 191 if not path:
192 192 return manifest(web, req, tmpl)
193 193 try:
@@ -198,7 +198,7 b' def file(web, req, tmpl):'
198 198 except ErrorResponse:
199 199 raise inst
200 200
201 def _search(web, req, tmpl):
201 def _search(web, tmpl):
202 202 MODE_REVISION = 'rev'
203 203 MODE_KEYWORD = 'keyword'
204 204 MODE_REVSET = 'revset'
@@ -303,11 +303,11 b' def _search(web, req, tmpl):'
303 303 if count >= revcount:
304 304 break
305 305
306 query = req.req.qsparams['rev']
306 query = web.req.qsparams['rev']
307 307 revcount = web.maxchanges
308 if 'revcount' in req.req.qsparams:
308 if 'revcount' in web.req.qsparams:
309 309 try:
310 revcount = int(req.req.qsparams.get('revcount', revcount))
310 revcount = int(web.req.qsparams.get('revcount', revcount))
311 311 revcount = max(revcount, 1)
312 312 tmpl.defaults['sessionvars']['revcount'] = revcount
313 313 except ValueError:
@@ -322,7 +322,7 b' def _search(web, req, tmpl):'
322 322
323 323 mode, funcarg = getsearchmode(query)
324 324
325 if 'forcekw' in req.req.qsparams:
325 if 'forcekw' in web.req.qsparams:
326 326 showforcekw = ''
327 327 showunforcekw = searchfuncs[mode][1]
328 328 mode = MODE_KEYWORD
@@ -381,11 +381,11 b' def changelog(web, req, tmpl, shortlog=F'
381 381 """
382 382
383 383 query = ''
384 if 'node' in req.req.qsparams:
384 if 'node' in web.req.qsparams:
385 385 ctx = webutil.changectx(web.repo, req)
386 386 symrev = webutil.symrevorshortnode(req, ctx)
387 elif 'rev' in req.req.qsparams:
388 return _search(web, req, tmpl)
387 elif 'rev' in web.req.qsparams:
388 return _search(web, tmpl)
389 389 else:
390 390 ctx = web.repo['tip']
391 391 symrev = 'tip'
@@ -409,9 +409,9 b' def changelog(web, req, tmpl, shortlog=F'
409 409 else:
410 410 revcount = web.maxchanges
411 411
412 if 'revcount' in req.req.qsparams:
412 if 'revcount' in web.req.qsparams:
413 413 try:
414 revcount = int(req.req.qsparams.get('revcount', revcount))
414 revcount = int(web.req.qsparams.get('revcount', revcount))
415 415 revcount = max(revcount, 1)
416 416 tmpl.defaults['sessionvars']['revcount'] = revcount
417 417 except ValueError:
@@ -516,13 +516,13 b' def manifest(web, req, tmpl):'
516 516
517 517 The ``manifest`` template will be rendered for this handler.
518 518 """
519 if 'node' in req.req.qsparams:
519 if 'node' in web.req.qsparams:
520 520 ctx = webutil.changectx(web.repo, req)
521 521 symrev = webutil.symrevorshortnode(req, ctx)
522 522 else:
523 523 ctx = web.repo['tip']
524 524 symrev = 'tip'
525 path = webutil.cleanpath(web.repo, req.req.qsparams.get('file', ''))
525 path = webutil.cleanpath(web.repo, web.req.qsparams.get('file', ''))
526 526 mf = ctx.manifest()
527 527 node = ctx.node()
528 528
@@ -806,7 +806,7 b' def filediff(web, req, tmpl):'
806 806 fctx = webutil.filectx(web.repo, req)
807 807 except LookupError:
808 808 ctx = webutil.changectx(web.repo, req)
809 path = webutil.cleanpath(web.repo, req.req.qsparams['file'])
809 path = webutil.cleanpath(web.repo, web.req.qsparams['file'])
810 810 if path not in ctx.files():
811 811 raise
812 812
@@ -816,8 +816,8 b' def filediff(web, req, tmpl):'
816 816 basectx = ctx.p1()
817 817
818 818 style = web.config('web', 'style')
819 if 'style' in req.req.qsparams:
820 style = req.req.qsparams['style']
819 if 'style' in web.req.qsparams:
820 style = web.req.qsparams['style']
821 821
822 822 diffs = webutil.diffs(web, tmpl, ctx, basectx, [path], style)
823 823 if fctx is not None:
@@ -857,13 +857,13 b' def comparison(web, req, tmpl):'
857 857 The ``filecomparison`` template is rendered.
858 858 """
859 859 ctx = webutil.changectx(web.repo, req)
860 if 'file' not in req.req.qsparams:
860 if 'file' not in web.req.qsparams:
861 861 raise ErrorResponse(HTTP_NOT_FOUND, 'file not given')
862 path = webutil.cleanpath(web.repo, req.req.qsparams['file'])
862 path = webutil.cleanpath(web.repo, web.req.qsparams['file'])
863 863
864 864 parsecontext = lambda v: v == 'full' and -1 or int(v)
865 if 'context' in req.req.qsparams:
866 context = parsecontext(req.req.qsparams['context'])
865 if 'context' in web.req.qsparams:
866 context = parsecontext(web.req.qsparams['context'])
867 867 else:
868 868 context = parsecontext(web.config('web', 'comparisoncontext', '5'))
869 869
@@ -1029,7 +1029,7 b' def filelog(web, req, tmpl):'
1029 1029 f = fctx.path()
1030 1030 fl = fctx.filelog()
1031 1031 except error.LookupError:
1032 f = webutil.cleanpath(web.repo, req.req.qsparams['file'])
1032 f = webutil.cleanpath(web.repo, web.req.qsparams['file'])
1033 1033 fl = web.repo.file(f)
1034 1034 numrevs = len(fl)
1035 1035 if not numrevs: # file doesn't exist at all
@@ -1044,9 +1044,9 b' def filelog(web, req, tmpl):'
1044 1044 fctx = web.repo.filectx(f, fl.linkrev(frev))
1045 1045
1046 1046 revcount = web.maxshortchanges
1047 if 'revcount' in req.req.qsparams:
1047 if 'revcount' in web.req.qsparams:
1048 1048 try:
1049 revcount = int(req.req.qsparams.get('revcount', revcount))
1049 revcount = int(web.req.qsparams.get('revcount', revcount))
1050 1050 revcount = max(revcount, 1)
1051 1051 tmpl.defaults['sessionvars']['revcount'] = revcount
1052 1052 except ValueError:
@@ -1059,12 +1059,12 b' def filelog(web, req, tmpl):'
1059 1059 morevars = copy.copy(tmpl.defaults['sessionvars'])
1060 1060 morevars['revcount'] = revcount * 2
1061 1061
1062 patch = 'patch' in req.req.qsparams
1062 patch = 'patch' in web.req.qsparams
1063 1063 if patch:
1064 lessvars['patch'] = morevars['patch'] = req.req.qsparams['patch']
1065 descend = 'descend' in req.req.qsparams
1064 lessvars['patch'] = morevars['patch'] = web.req.qsparams['patch']
1065 descend = 'descend' in web.req.qsparams
1066 1066 if descend:
1067 lessvars['descend'] = morevars['descend'] = req.req.qsparams['descend']
1067 lessvars['descend'] = morevars['descend'] = web.req.qsparams['descend']
1068 1068
1069 1069 count = fctx.filerev() + 1
1070 1070 start = max(0, count - revcount) # first rev on this page
@@ -1076,8 +1076,8 b' def filelog(web, req, tmpl):'
1076 1076 entries = []
1077 1077
1078 1078 diffstyle = web.config('web', 'style')
1079 if 'style' in req.req.qsparams:
1080 diffstyle = req.req.qsparams['style']
1079 if 'style' in web.req.qsparams:
1080 diffstyle = web.req.qsparams['style']
1081 1081
1082 1082 def diff(fctx, linerange=None):
1083 1083 ctx = fctx.changectx()
@@ -1171,9 +1171,9 b' def archive(web, req, tmpl):'
1171 1171 No template is used for this handler. Raw, binary content is generated.
1172 1172 """
1173 1173
1174 type_ = req.req.qsparams.get('type')
1174 type_ = web.req.qsparams.get('type')
1175 1175 allowed = web.configlist("web", "allow_archive")
1176 key = req.req.qsparams['node']
1176 key = web.req.qsparams['node']
1177 1177
1178 1178 if type_ not in web.archivespecs:
1179 1179 msg = 'Unsupported archive type: %s' % type_
@@ -1194,7 +1194,7 b' def archive(web, req, tmpl):'
1194 1194 ctx = webutil.changectx(web.repo, req)
1195 1195 pats = []
1196 1196 match = scmutil.match(ctx, [])
1197 file = req.req.qsparams.get('file')
1197 file = web.req.qsparams.get('file')
1198 1198 if file:
1199 1199 pats = ['path:' + file]
1200 1200 match = scmutil.match(ctx, pats, default='path')
@@ -1226,7 +1226,7 b' def archive(web, req, tmpl):'
1226 1226
1227 1227 @webcommand('static')
1228 1228 def static(web, req, tmpl):
1229 fname = req.req.qsparams['file']
1229 fname = web.req.qsparams['file']
1230 1230 # a repo owner may set web.static in .hg/hgrc to get any file
1231 1231 # readable by the user running the CGI script
1232 1232 static = web.config("web", "static", None, untrusted=False)
@@ -1263,7 +1263,7 b' def graph(web, req, tmpl):'
1263 1263 This handler will render the ``graph`` template.
1264 1264 """
1265 1265
1266 if 'node' in req.req.qsparams:
1266 if 'node' in web.req.qsparams:
1267 1267 ctx = webutil.changectx(web.repo, req)
1268 1268 symrev = webutil.symrevorshortnode(req, ctx)
1269 1269 else:
@@ -1273,9 +1273,9 b' def graph(web, req, tmpl):'
1273 1273
1274 1274 bg_height = 39
1275 1275 revcount = web.maxshortchanges
1276 if 'revcount' in req.req.qsparams:
1276 if 'revcount' in web.req.qsparams:
1277 1277 try:
1278 revcount = int(req.req.qsparams.get('revcount', revcount))
1278 revcount = int(web.req.qsparams.get('revcount', revcount))
1279 1279 revcount = max(revcount, 1)
1280 1280 tmpl.defaults['sessionvars']['revcount'] = revcount
1281 1281 except ValueError:
@@ -1286,7 +1286,7 b' def graph(web, req, tmpl):'
1286 1286 morevars = copy.copy(tmpl.defaults['sessionvars'])
1287 1287 morevars['revcount'] = revcount * 2
1288 1288
1289 graphtop = req.req.qsparams.get('graphtop', ctx.hex())
1289 graphtop = web.req.qsparams.get('graphtop', ctx.hex())
1290 1290 graphvars = copy.copy(tmpl.defaults['sessionvars'])
1291 1291 graphvars['graphtop'] = graphtop
1292 1292
@@ -1425,7 +1425,7 b' def help(web, req, tmpl):'
1425 1425 """
1426 1426 from .. import commands, help as helpmod # avoid cycle
1427 1427
1428 topicname = req.req.qsparams.get('node')
1428 topicname = web.req.qsparams.get('node')
1429 1429 if not topicname:
1430 1430 def topics(**map):
1431 1431 for entries, summary, _doc in helpmod.helptable:
General Comments 0
You need to be logged in to leave comments. Login now