Show More
@@ -75,7 +75,7 b' def filerevision_highlight(orig, web, re' | |||
|
75 | 75 | def annotate_highlight(orig, web, req, tmpl): |
|
76 | 76 | mt = ''.join(web.tmpl('mimetype', encoding=encoding.encoding)) |
|
77 | 77 | if 'html' in mt: |
|
78 | fctx = webutil.filectx(web.repo, req) | |
|
78 | fctx = webutil.filectx(web.repo, web.req) | |
|
79 | 79 | pygmentize(web, 'annotateline', fctx, web.tmpl) |
|
80 | 80 | |
|
81 | 81 | return orig(web, req, web.tmpl) |
@@ -108,7 +108,7 b' def rawfile(web, req, tmpl):' | |||
|
108 | 108 | return manifest(web, req, None) |
|
109 | 109 | |
|
110 | 110 | try: |
|
111 | fctx = webutil.filectx(web.repo, req) | |
|
111 | fctx = webutil.filectx(web.repo, web.req) | |
|
112 | 112 | except error.LookupError as inst: |
|
113 | 113 | try: |
|
114 | 114 | return manifest(web, req, None) |
@@ -157,7 +157,7 b' def _filerevision(web, req, fctx):' | |||
|
157 | 157 | file=f, |
|
158 | 158 | path=webutil.up(f), |
|
159 | 159 | text=lines(), |
|
160 | symrev=webutil.symrevorshortnode(req, fctx), | |
|
160 | symrev=webutil.symrevorshortnode(web.req, fctx), | |
|
161 | 161 | rename=webutil.renamelink(fctx), |
|
162 | 162 | permissions=fctx.manifest().flags(f), |
|
163 | 163 | ishead=int(ishead), |
@@ -190,7 +190,7 b' def file(web, req, tmpl):' | |||
|
190 | 190 | if not path: |
|
191 | 191 | return manifest(web, req, None) |
|
192 | 192 | try: |
|
193 | return _filerevision(web, req, webutil.filectx(web.repo, req)) | |
|
193 | return _filerevision(web, req, webutil.filectx(web.repo, web.req)) | |
|
194 | 194 | except error.LookupError as inst: |
|
195 | 195 | try: |
|
196 | 196 | return manifest(web, req, None) |
@@ -381,8 +381,8 b' def changelog(web, req, tmpl, shortlog=F' | |||
|
381 | 381 | |
|
382 | 382 | query = '' |
|
383 | 383 | if 'node' in web.req.qsparams: |
|
384 | ctx = webutil.changectx(web.repo, req) | |
|
385 | symrev = webutil.symrevorshortnode(req, ctx) | |
|
384 | ctx = webutil.changectx(web.repo, web.req) | |
|
385 | symrev = webutil.symrevorshortnode(web.req, ctx) | |
|
386 | 386 | elif 'rev' in web.req.qsparams: |
|
387 | 387 | return _search(web) |
|
388 | 388 | else: |
@@ -481,11 +481,11 b' def changeset(web, req, tmpl):' | |||
|
481 | 481 | ``changesetbookmark``, ``filenodelink``, ``filenolink``, and the many |
|
482 | 482 | templates related to diffs may all be used to produce the output. |
|
483 | 483 | """ |
|
484 | ctx = webutil.changectx(web.repo, req) | |
|
484 | ctx = webutil.changectx(web.repo, web.req) | |
|
485 | 485 | |
|
486 | 486 | return web.sendtemplate( |
|
487 | 487 | 'changeset', |
|
488 |
**webutil.changesetentry(web, |
|
|
488 | **webutil.changesetentry(web, ctx)) | |
|
489 | 489 | |
|
490 | 490 | rev = webcommand('rev')(changeset) |
|
491 | 491 | |
@@ -515,8 +515,8 b' def manifest(web, req, tmpl):' | |||
|
515 | 515 | The ``manifest`` template will be rendered for this handler. |
|
516 | 516 | """ |
|
517 | 517 | if 'node' in web.req.qsparams: |
|
518 | ctx = webutil.changectx(web.repo, req) | |
|
519 | symrev = webutil.symrevorshortnode(req, ctx) | |
|
518 | ctx = webutil.changectx(web.repo, web.req) | |
|
519 | symrev = webutil.symrevorshortnode(web.req, ctx) | |
|
520 | 520 | else: |
|
521 | 521 | ctx = web.repo['tip'] |
|
522 | 522 | symrev = 'tip' |
@@ -792,9 +792,9 b' def filediff(web, req, tmpl):' | |||
|
792 | 792 | """ |
|
793 | 793 | fctx, ctx = None, None |
|
794 | 794 | try: |
|
795 | fctx = webutil.filectx(web.repo, req) | |
|
795 | fctx = webutil.filectx(web.repo, web.req) | |
|
796 | 796 | except LookupError: |
|
797 | ctx = webutil.changectx(web.repo, req) | |
|
797 | ctx = webutil.changectx(web.repo, web.req) | |
|
798 | 798 | path = webutil.cleanpath(web.repo, web.req.qsparams['file']) |
|
799 | 799 | if path not in ctx.files(): |
|
800 | 800 | raise |
@@ -819,7 +819,7 b' def filediff(web, req, tmpl):' | |||
|
819 | 819 | return web.sendtemplate( |
|
820 | 820 | 'filediff', |
|
821 | 821 | file=path, |
|
822 | symrev=webutil.symrevorshortnode(req, ctx), | |
|
822 | symrev=webutil.symrevorshortnode(web.req, ctx), | |
|
823 | 823 | rename=rename, |
|
824 | 824 | diff=diffs, |
|
825 | 825 | **pycompat.strkwargs(webutil.commonentry(web.repo, ctx))) |
@@ -843,7 +843,7 b' def comparison(web, req, tmpl):' | |||
|
843 | 843 | |
|
844 | 844 | The ``filecomparison`` template is rendered. |
|
845 | 845 | """ |
|
846 | ctx = webutil.changectx(web.repo, req) | |
|
846 | ctx = webutil.changectx(web.repo, web.req) | |
|
847 | 847 | if 'file' not in web.req.qsparams: |
|
848 | 848 | raise ErrorResponse(HTTP_NOT_FOUND, 'file not given') |
|
849 | 849 | path = webutil.cleanpath(web.repo, web.req.qsparams['file']) |
@@ -892,7 +892,7 b' def comparison(web, req, tmpl):' | |||
|
892 | 892 | return web.sendtemplate( |
|
893 | 893 | 'filecomparison', |
|
894 | 894 | file=path, |
|
895 | symrev=webutil.symrevorshortnode(req, ctx), | |
|
895 | symrev=webutil.symrevorshortnode(web.req, ctx), | |
|
896 | 896 | rename=rename, |
|
897 | 897 | leftrev=leftrev, |
|
898 | 898 | leftnode=hex(leftnode), |
@@ -918,7 +918,7 b' def annotate(web, req, tmpl):' | |||
|
918 | 918 | |
|
919 | 919 | The ``fileannotate`` template is rendered. |
|
920 | 920 | """ |
|
921 | fctx = webutil.filectx(web.repo, req) | |
|
921 | fctx = webutil.filectx(web.repo, web.req) | |
|
922 | 922 | f = fctx.path() |
|
923 | 923 | parity = paritygen(web.stripecount) |
|
924 | 924 | ishead = fctx.filerev() in fctx.filelog().headrevs() |
@@ -948,7 +948,7 b' def annotate(web, req, tmpl):' | |||
|
948 | 948 | or 'application/octet-stream') |
|
949 | 949 | lines = [((fctx.filectx(fctx.filerev()), 1), '(binary:%s)' % mt)] |
|
950 | 950 | else: |
|
951 | lines = webutil.annotate(req, fctx, web.repo.ui) | |
|
951 | lines = webutil.annotate(web.req, fctx, web.repo.ui) | |
|
952 | 952 | |
|
953 | 953 | previousrev = None |
|
954 | 954 | blockparitygen = paritygen(1) |
@@ -978,7 +978,7 b' def annotate(web, req, tmpl):' | |||
|
978 | 978 | "linenumber": "% 6d" % (lineno + 1), |
|
979 | 979 | "revdate": f.date()} |
|
980 | 980 | |
|
981 | diffopts = webutil.difffeatureopts(req, web.repo.ui, 'annotate') | |
|
981 | diffopts = webutil.difffeatureopts(web.req, web.repo.ui, 'annotate') | |
|
982 | 982 | diffopts = {k: getattr(diffopts, k) for k in diffopts.defaults} |
|
983 | 983 | |
|
984 | 984 | return web.sendtemplate( |
@@ -986,7 +986,7 b' def annotate(web, req, tmpl):' | |||
|
986 | 986 | file=f, |
|
987 | 987 | annotate=annotate, |
|
988 | 988 | path=webutil.up(f), |
|
989 | symrev=webutil.symrevorshortnode(req, fctx), | |
|
989 | symrev=webutil.symrevorshortnode(web.req, fctx), | |
|
990 | 990 | rename=webutil.renamelink(fctx), |
|
991 | 991 | permissions=fctx.manifest().flags(f), |
|
992 | 992 | ishead=int(ishead), |
@@ -1008,7 +1008,7 b' def filelog(web, req, tmpl):' | |||
|
1008 | 1008 | """ |
|
1009 | 1009 | |
|
1010 | 1010 | try: |
|
1011 | fctx = webutil.filectx(web.repo, req) | |
|
1011 | fctx = webutil.filectx(web.repo, web.req) | |
|
1012 | 1012 | f = fctx.path() |
|
1013 | 1013 | fl = fctx.filelog() |
|
1014 | 1014 | except error.LookupError: |
@@ -1017,7 +1017,7 b' def filelog(web, req, tmpl):' | |||
|
1017 | 1017 | numrevs = len(fl) |
|
1018 | 1018 | if not numrevs: # file doesn't exist at all |
|
1019 | 1019 | raise |
|
1020 | rev = webutil.changectx(web.repo, req).rev() | |
|
1020 | rev = webutil.changectx(web.repo, web.req).rev() | |
|
1021 | 1021 | first = fl.linkrev(0) |
|
1022 | 1022 | if rev < first: # current rev is from before file existed |
|
1023 | 1023 | raise |
@@ -1035,7 +1035,7 b' def filelog(web, req, tmpl):' | |||
|
1035 | 1035 | except ValueError: |
|
1036 | 1036 | pass |
|
1037 | 1037 | |
|
1038 | lrange = webutil.linerange(req) | |
|
1038 | lrange = webutil.linerange(web.req) | |
|
1039 | 1039 | |
|
1040 | 1040 | lessvars = copy.copy(web.tmpl.defaults['sessionvars']) |
|
1041 | 1041 | lessvars['revcount'] = max(revcount // 2, 1) |
@@ -1120,7 +1120,7 b' def filelog(web, req, tmpl):' | |||
|
1120 | 1120 | 'filelog', |
|
1121 | 1121 | file=f, |
|
1122 | 1122 | nav=nav, |
|
1123 | symrev=webutil.symrevorshortnode(req, fctx), | |
|
1123 | symrev=webutil.symrevorshortnode(web.req, fctx), | |
|
1124 | 1124 | entries=entries, |
|
1125 | 1125 | descend=descend, |
|
1126 | 1126 | patch=patch, |
@@ -1172,7 +1172,7 b' def archive(web, req, tmpl):' | |||
|
1172 | 1172 | arch_version = short(cnode) |
|
1173 | 1173 | name = "%s-%s" % (reponame, arch_version) |
|
1174 | 1174 | |
|
1175 | ctx = webutil.changectx(web.repo, req) | |
|
1175 | ctx = webutil.changectx(web.repo, web.req) | |
|
1176 | 1176 | pats = [] |
|
1177 | 1177 | match = scmutil.match(ctx, []) |
|
1178 | 1178 | file = web.req.qsparams.get('file') |
@@ -1245,8 +1245,8 b' def graph(web, req, tmpl):' | |||
|
1245 | 1245 | """ |
|
1246 | 1246 | |
|
1247 | 1247 | if 'node' in web.req.qsparams: |
|
1248 | ctx = webutil.changectx(web.repo, req) | |
|
1249 | symrev = webutil.symrevorshortnode(req, ctx) | |
|
1248 | ctx = webutil.changectx(web.repo, web.req) | |
|
1249 | symrev = webutil.symrevorshortnode(web.req, ctx) | |
|
1250 | 1250 | else: |
|
1251 | 1251 | ctx = web.repo['tip'] |
|
1252 | 1252 | symrev = 'tip' |
@@ -177,7 +177,7 b' def difffeatureopts(req, ui, section):' | |||
|
177 | 177 | section=section, whitespace=True) |
|
178 | 178 | |
|
179 | 179 | for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'): |
|
180 |
v = |
|
|
180 | v = req.qsparams.get(k) | |
|
181 | 181 | if v is not None: |
|
182 | 182 | v = util.parsebool(v) |
|
183 | 183 | setattr(diffopts, k, v if v is not None else True) |
@@ -295,19 +295,19 b' def changeidctx(repo, changeid):' | |||
|
295 | 295 | |
|
296 | 296 | def changectx(repo, req): |
|
297 | 297 | changeid = "tip" |
|
298 |
if 'node' in req. |
|
|
299 |
changeid = |
|
|
298 | if 'node' in req.qsparams: | |
|
299 | changeid = req.qsparams['node'] | |
|
300 | 300 | ipos = changeid.find(':') |
|
301 | 301 | if ipos != -1: |
|
302 | 302 | changeid = changeid[(ipos + 1):] |
|
303 |
elif 'manifest' in req. |
|
|
304 |
changeid = |
|
|
303 | elif 'manifest' in req.qsparams: | |
|
304 | changeid = req.qsparams['manifest'] | |
|
305 | 305 | |
|
306 | 306 | return changeidctx(repo, changeid) |
|
307 | 307 | |
|
308 | 308 | def basechangectx(repo, req): |
|
309 |
if 'node' in req. |
|
|
310 |
changeid = |
|
|
309 | if 'node' in req.qsparams: | |
|
310 | changeid = req.qsparams['node'] | |
|
311 | 311 | ipos = changeid.find(':') |
|
312 | 312 | if ipos != -1: |
|
313 | 313 | changeid = changeid[:ipos] |
@@ -316,13 +316,13 b' def basechangectx(repo, req):' | |||
|
316 | 316 | return None |
|
317 | 317 | |
|
318 | 318 | def filectx(repo, req): |
|
319 |
if 'file' not in req. |
|
|
319 | if 'file' not in req.qsparams: | |
|
320 | 320 | raise ErrorResponse(HTTP_NOT_FOUND, 'file not given') |
|
321 |
path = cleanpath(repo, req. |
|
|
322 |
if 'node' in req. |
|
|
323 |
changeid = |
|
|
324 |
elif 'filenode' in req. |
|
|
325 |
changeid = |
|
|
321 | path = cleanpath(repo, req.qsparams['file']) | |
|
322 | if 'node' in req.qsparams: | |
|
323 | changeid = req.qsparams['node'] | |
|
324 | elif 'filenode' in req.qsparams: | |
|
325 | changeid = req.qsparams['filenode'] | |
|
326 | 326 | else: |
|
327 | 327 | raise ErrorResponse(HTTP_NOT_FOUND, 'node or filenode not given') |
|
328 | 328 | try: |
@@ -333,7 +333,7 b' def filectx(repo, req):' | |||
|
333 | 333 | return fctx |
|
334 | 334 | |
|
335 | 335 | def linerange(req): |
|
336 |
linerange = |
|
|
336 | linerange = req.qsparams.getall('linerange') | |
|
337 | 337 | if not linerange: |
|
338 | 338 | return None |
|
339 | 339 | if len(linerange) > 1: |
@@ -412,12 +412,12 b' def changelistentry(web, ctx):' | |||
|
412 | 412 | return entry |
|
413 | 413 | |
|
414 | 414 | def symrevorshortnode(req, ctx): |
|
415 |
if 'node' in req. |
|
|
416 |
return templatefilters.revescape(req. |
|
|
415 | if 'node' in req.qsparams: | |
|
416 | return templatefilters.revescape(req.qsparams['node']) | |
|
417 | 417 | else: |
|
418 | 418 | return short(ctx.node()) |
|
419 | 419 | |
|
420 |
def changesetentry(web, |
|
|
420 | def changesetentry(web, ctx): | |
|
421 | 421 | '''Obtain a dictionary to be used to render the "changeset" template.''' |
|
422 | 422 | |
|
423 | 423 | showtags = showtag(web.repo, web.tmpl, 'changesettag', ctx.node()) |
@@ -433,13 +433,13 b' def changesetentry(web, req, ctx):' | |||
|
433 | 433 | node=ctx.hex(), file=f, blockno=blockno + 1, |
|
434 | 434 | parity=next(parity))) |
|
435 | 435 | |
|
436 | basectx = basechangectx(web.repo, req) | |
|
436 | basectx = basechangectx(web.repo, web.req) | |
|
437 | 437 | if basectx is None: |
|
438 | 438 | basectx = ctx.p1() |
|
439 | 439 | |
|
440 | 440 | style = web.config('web', 'style') |
|
441 |
if 'style' in |
|
|
442 |
style = |
|
|
441 | if 'style' in web.req.qsparams: | |
|
442 | style = web.req.qsparams['style'] | |
|
443 | 443 | |
|
444 | 444 | diff = diffs(web, ctx, basectx, None, style) |
|
445 | 445 | |
@@ -449,7 +449,7 b' def changesetentry(web, req, ctx):' | |||
|
449 | 449 | |
|
450 | 450 | return dict( |
|
451 | 451 | diff=diff, |
|
452 | symrev=symrevorshortnode(req, ctx), | |
|
452 | symrev=symrevorshortnode(web.req, ctx), | |
|
453 | 453 | basenode=basectx.hex(), |
|
454 | 454 | changesettag=showtags, |
|
455 | 455 | changesetbookmark=showbookmarks, |
General Comments 0
You need to be logged in to leave comments.
Login now