415 shortlog=changelist, |
415 shortlog=changelist, |
416 node=hex(cl.tip()), |
416 node=hex(cl.tip()), |
417 archives=web.archivelist("tip")) |
417 archives=web.archivelist("tip")) |
418 |
418 |
419 def filediff(web, req, tmpl): |
419 def filediff(web, req, tmpl): |
420 fctx = webutil.filectx(web.repo, req) |
420 fctx, ctx = None, None |
421 n = fctx.node() |
421 try: |
422 path = fctx.path() |
422 fctx = webutil.filectx(web.repo, req) |
423 parents = fctx.parents() |
423 except LookupError, inst: |
424 p1 = parents and parents[0].node() or nullid |
424 ctx = webutil.changectx(web.repo, req) |
|
425 path = webutil.cleanpath(web.repo, req.form['file'][0]) |
|
426 if path not in ctx.files(): |
|
427 raise |
|
428 |
|
429 if fctx is not None: |
|
430 n = fctx.node() |
|
431 path = fctx.path() |
|
432 parents = fctx.parents() |
|
433 p1 = parents and parents[0].node() or nullid |
|
434 else: |
|
435 n = ctx.node() |
|
436 # path already defined in except clause |
|
437 parents = ctx.parents() |
|
438 p1 = parents and parents[0].node() or nullid |
425 |
439 |
426 diffs = web.diff(tmpl, p1, n, [path]) |
440 diffs = web.diff(tmpl, p1, n, [path]) |
|
441 rename = fctx and webutil.renamelink(fctx) or [] |
|
442 ctx = fctx and fctx or ctx |
427 return tmpl("filediff", |
443 return tmpl("filediff", |
428 file=path, |
444 file=path, |
429 node=hex(n), |
445 node=hex(n), |
430 rev=fctx.rev(), |
446 rev=ctx.rev(), |
431 date=fctx.date(), |
447 date=ctx.date(), |
432 desc=fctx.description(), |
448 desc=ctx.description(), |
433 author=fctx.user(), |
449 author=ctx.user(), |
434 rename=webutil.renamelink(fctx), |
450 rename=rename, |
435 branch=webutil.nodebranchnodefault(fctx), |
451 branch=webutil.nodebranchnodefault(ctx), |
436 parent=webutil.siblings(parents), |
452 parent=webutil.siblings(parents), |
437 child=webutil.siblings(fctx.children()), |
453 child=webutil.siblings(ctx.children()), |
438 diff=diffs) |
454 diff=diffs) |
439 |
455 |
440 diff = filediff |
456 diff = filediff |
441 |
457 |
442 def annotate(web, req, tmpl): |
458 def annotate(web, req, tmpl): |