Show More
@@ -399,7 +399,7 b' def changelog(web, req, tmpl, shortlog=F' | |||||
399 | if curcount > revcount + 1: |
|
399 | if curcount > revcount + 1: | |
400 | break |
|
400 | break | |
401 |
|
401 | |||
402 |
entry = webutil.changelistentry(web, web.repo[rev] |
|
402 | entry = webutil.changelistentry(web, web.repo[rev]) | |
403 | entry['parity'] = next(parity) |
|
403 | entry['parity'] = next(parity) | |
404 | yield entry |
|
404 | yield entry | |
405 |
|
405 | |||
@@ -485,7 +485,7 b' def changeset(web, req, tmpl):' | |||||
485 |
|
485 | |||
486 | return web.sendtemplate( |
|
486 | return web.sendtemplate( | |
487 | 'changeset', |
|
487 | 'changeset', | |
488 |
**webutil.changesetentry(web, req, |
|
488 | **webutil.changesetentry(web, req, ctx)) | |
489 |
|
489 | |||
490 | rev = webcommand('rev')(changeset) |
|
490 | rev = webcommand('rev')(changeset) | |
491 |
|
491 | |||
@@ -808,7 +808,7 b' def filediff(web, req, tmpl):' | |||||
808 | if 'style' in web.req.qsparams: |
|
808 | if 'style' in web.req.qsparams: | |
809 | style = web.req.qsparams['style'] |
|
809 | style = web.req.qsparams['style'] | |
810 |
|
810 | |||
811 |
diffs = webutil.diffs(web |
|
811 | diffs = webutil.diffs(web, ctx, basectx, [path], style) | |
812 | if fctx is not None: |
|
812 | if fctx is not None: | |
813 | rename = webutil.renamelink(fctx) |
|
813 | rename = webutil.renamelink(fctx) | |
814 | ctx = fctx |
|
814 | ctx = fctx | |
@@ -1066,7 +1066,7 b' def filelog(web, req, tmpl):' | |||||
1066 | ctx = fctx.changectx() |
|
1066 | ctx = fctx.changectx() | |
1067 | basectx = ctx.p1() |
|
1067 | basectx = ctx.p1() | |
1068 | path = fctx.path() |
|
1068 | path = fctx.path() | |
1069 |
return webutil.diffs(web |
|
1069 | return webutil.diffs(web, ctx, basectx, [path], diffstyle, | |
1070 | linerange=linerange, |
|
1070 | linerange=linerange, | |
1071 | lineidprefix='%s-' % ctx.hex()[:12]) |
|
1071 | lineidprefix='%s-' % ctx.hex()[:12]) | |
1072 |
|
1072 |
@@ -389,7 +389,7 b' def commonentry(repo, ctx):' | |||||
389 | 'child': lambda **x: children(ctx), |
|
389 | 'child': lambda **x: children(ctx), | |
390 | } |
|
390 | } | |
391 |
|
391 | |||
392 |
def changelistentry(web, ctx |
|
392 | def changelistentry(web, ctx): | |
393 | '''Obtain a dictionary to be used for entries in a changelist. |
|
393 | '''Obtain a dictionary to be used for entries in a changelist. | |
394 |
|
394 | |||
395 | This function is called when producing items for the "entries" list passed |
|
395 | This function is called when producing items for the "entries" list passed | |
@@ -398,8 +398,8 b' def changelistentry(web, ctx, tmpl):' | |||||
398 | repo = web.repo |
|
398 | repo = web.repo | |
399 | rev = ctx.rev() |
|
399 | rev = ctx.rev() | |
400 | n = ctx.node() |
|
400 | n = ctx.node() | |
401 | showtags = showtag(repo, tmpl, 'changelogtag', n) |
|
401 | showtags = showtag(repo, web.tmpl, 'changelogtag', n) | |
402 | files = listfilediffs(tmpl, ctx.files(), n, web.maxfiles) |
|
402 | files = listfilediffs(web.tmpl, ctx.files(), n, web.maxfiles) | |
403 |
|
403 | |||
404 | entry = commonentry(repo, ctx) |
|
404 | entry = commonentry(repo, ctx) | |
405 | entry.update( |
|
405 | entry.update( | |
@@ -417,11 +417,11 b' def symrevorshortnode(req, ctx):' | |||||
417 | else: |
|
417 | else: | |
418 | return short(ctx.node()) |
|
418 | return short(ctx.node()) | |
419 |
|
419 | |||
420 |
def changesetentry(web, req, |
|
420 | def changesetentry(web, req, ctx): | |
421 | '''Obtain a dictionary to be used to render the "changeset" template.''' |
|
421 | '''Obtain a dictionary to be used to render the "changeset" template.''' | |
422 |
|
422 | |||
423 | showtags = showtag(web.repo, tmpl, 'changesettag', ctx.node()) |
|
423 | showtags = showtag(web.repo, web.tmpl, 'changesettag', ctx.node()) | |
424 | showbookmarks = showbookmark(web.repo, tmpl, 'changesetbookmark', |
|
424 | showbookmarks = showbookmark(web.repo, web.tmpl, 'changesetbookmark', | |
425 | ctx.node()) |
|
425 | ctx.node()) | |
426 | showbranch = nodebranchnodefault(ctx) |
|
426 | showbranch = nodebranchnodefault(ctx) | |
427 |
|
427 | |||
@@ -429,9 +429,9 b' def changesetentry(web, req, tmpl, ctx):' | |||||
429 | parity = paritygen(web.stripecount) |
|
429 | parity = paritygen(web.stripecount) | |
430 | for blockno, f in enumerate(ctx.files()): |
|
430 | for blockno, f in enumerate(ctx.files()): | |
431 | template = 'filenodelink' if f in ctx else 'filenolink' |
|
431 | template = 'filenodelink' if f in ctx else 'filenolink' | |
432 | files.append(tmpl(template, |
|
432 | files.append(web.tmpl(template, | |
433 | node=ctx.hex(), file=f, blockno=blockno + 1, |
|
433 | node=ctx.hex(), file=f, blockno=blockno + 1, | |
434 | parity=next(parity))) |
|
434 | parity=next(parity))) | |
435 |
|
435 | |||
436 | basectx = basechangectx(web.repo, req) |
|
436 | basectx = basechangectx(web.repo, req) | |
437 | if basectx is None: |
|
437 | if basectx is None: | |
@@ -441,11 +441,11 b' def changesetentry(web, req, tmpl, ctx):' | |||||
441 | if 'style' in req.req.qsparams: |
|
441 | if 'style' in req.req.qsparams: | |
442 | style = req.req.qsparams['style'] |
|
442 | style = req.req.qsparams['style'] | |
443 |
|
443 | |||
444 |
diff = diffs(web |
|
444 | diff = diffs(web, ctx, basectx, None, style) | |
445 |
|
445 | |||
446 | parity = paritygen(web.stripecount) |
|
446 | parity = paritygen(web.stripecount) | |
447 | diffstatsgen = diffstatgen(ctx, basectx) |
|
447 | diffstatsgen = diffstatgen(ctx, basectx) | |
448 | diffstats = diffstat(tmpl, ctx, diffstatsgen, parity) |
|
448 | diffstats = diffstat(web.tmpl, ctx, diffstatsgen, parity) | |
449 |
|
449 | |||
450 | return dict( |
|
450 | return dict( | |
451 | diff=diff, |
|
451 | diff=diff, | |
@@ -466,7 +466,7 b' def listfilediffs(tmpl, files, node, max' | |||||
466 | if len(files) > max: |
|
466 | if len(files) > max: | |
467 | yield tmpl('fileellipses') |
|
467 | yield tmpl('fileellipses') | |
468 |
|
468 | |||
469 |
def diffs(web |
|
469 | def diffs(web, ctx, basectx, files, style, linerange=None, | |
470 | lineidprefix=''): |
|
470 | lineidprefix=''): | |
471 |
|
471 | |||
472 | def prettyprintlines(lines, blockno): |
|
472 | def prettyprintlines(lines, blockno): | |
@@ -480,11 +480,12 b' def diffs(web, tmpl, ctx, basectx, files' | |||||
480 | ltype = "difflineat" |
|
480 | ltype = "difflineat" | |
481 | else: |
|
481 | else: | |
482 | ltype = "diffline" |
|
482 | ltype = "diffline" | |
483 |
yield tmpl( |
|
483 | yield web.tmpl( | |
484 |
|
|
484 | ltype, | |
485 |
|
|
485 | line=l, | |
486 | lineid=lineidprefix + "l%s" % difflineno, |
|
486 | lineno=lineno, | |
487 |
|
|
487 | lineid=lineidprefix + "l%s" % difflineno, | |
|
488 | linenumber="% 8s" % difflineno) | |||
488 |
|
489 | |||
489 | repo = web.repo |
|
490 | repo = web.repo | |
490 | if files: |
|
491 | if files: | |
@@ -509,8 +510,8 b' def diffs(web, tmpl, ctx, basectx, files' | |||||
509 | continue |
|
510 | continue | |
510 | lines.extend(hunklines) |
|
511 | lines.extend(hunklines) | |
511 | if lines: |
|
512 | if lines: | |
512 | yield tmpl('diffblock', parity=next(parity), blockno=blockno, |
|
513 | yield web.tmpl('diffblock', parity=next(parity), blockno=blockno, | |
513 | lines=prettyprintlines(lines, blockno)) |
|
514 | lines=prettyprintlines(lines, blockno)) | |
514 |
|
515 | |||
515 | def compare(tmpl, context, leftlines, rightlines): |
|
516 | def compare(tmpl, context, leftlines, rightlines): | |
516 | '''Generator function that provides side-by-side comparison data.''' |
|
517 | '''Generator function that provides side-by-side comparison data.''' |
General Comments 0
You need to be logged in to leave comments.
Login now