mercurial/hgweb/webcommands.py
changeset 7671 06cf09c822c4
parent 7637 1d54e2f6c0b7
child 7873 4a4c7f6a5912
equal deleted inserted replaced
7670:e5f445c94226 7671:06cf09c822c4
    79                 node=hex(fctx.node()),
    79                 node=hex(fctx.node()),
    80                 author=fctx.user(),
    80                 author=fctx.user(),
    81                 date=fctx.date(),
    81                 date=fctx.date(),
    82                 desc=fctx.description(),
    82                 desc=fctx.description(),
    83                 branch=webutil.nodebranchnodefault(fctx),
    83                 branch=webutil.nodebranchnodefault(fctx),
    84                 parent=webutil.siblings(fctx.parents()),
    84                 parent=webutil.parents(fctx),
    85                 child=webutil.siblings(fctx.children()),
    85                 child=webutil.children(fctx),
    86                 rename=webutil.renamelink(fctx),
    86                 rename=webutil.renamelink(fctx),
    87                 permissions=fctx.manifest().flags(f))
    87                 permissions=fctx.manifest().flags(f))
    88 
    88 
    89 def file(web, req, tmpl):
    89 def file(web, req, tmpl):
    90     path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0])
    90     path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0])
   132             files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
   132             files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
   133 
   133 
   134             yield tmpl('searchentry',
   134             yield tmpl('searchentry',
   135                        parity=parity.next(),
   135                        parity=parity.next(),
   136                        author=ctx.user(),
   136                        author=ctx.user(),
   137                        parent=webutil.siblings(ctx.parents()),
   137                        parent=webutil.parents(ctx),
   138                        child=webutil.siblings(ctx.children()),
   138                        child=webutil.children(ctx),
   139                        changelogtag=showtags,
   139                        changelogtag=showtags,
   140                        desc=ctx.description(),
   140                        desc=ctx.description(),
   141                        date=ctx.date(),
   141                        date=ctx.date(),
   142                        files=files,
   142                        files=files,
   143                        rev=ctx.rev(),
   143                        rev=ctx.rev(),
   180             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
   180             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
   181             files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
   181             files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
   182 
   182 
   183             l.insert(0, {"parity": parity.next(),
   183             l.insert(0, {"parity": parity.next(),
   184                          "author": ctx.user(),
   184                          "author": ctx.user(),
   185                          "parent": webutil.siblings(ctx.parents(), i - 1),
   185                          "parent": webutil.parents(ctx, i - 1),
   186                          "child": webutil.siblings(ctx.children(), i + 1),
   186                          "child": webutil.children(ctx, i + 1),
   187                          "changelogtag": showtags,
   187                          "changelogtag": showtags,
   188                          "desc": ctx.description(),
   188                          "desc": ctx.description(),
   189                          "date": ctx.date(),
   189                          "date": ctx.date(),
   190                          "files": files,
   190                          "files": files,
   191                          "rev": i,
   191                          "rev": i,
   225 
   225 
   226 def changeset(web, req, tmpl):
   226 def changeset(web, req, tmpl):
   227     ctx = webutil.changectx(web.repo, req)
   227     ctx = webutil.changectx(web.repo, req)
   228     showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node())
   228     showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node())
   229     showbranch = webutil.nodebranchnodefault(ctx)
   229     showbranch = webutil.nodebranchnodefault(ctx)
   230     parents = ctx.parents()
       
   231 
   230 
   232     files = []
   231     files = []
   233     parity = paritygen(web.stripecount)
   232     parity = paritygen(web.stripecount)
   234     for f in ctx.files():
   233     for f in ctx.files():
   235         template = f in ctx and 'filenodelink' or 'filenolink'
   234         template = f in ctx and 'filenodelink' or 'filenolink'
   241     diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity)
   240     diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity)
   242     return tmpl('changeset',
   241     return tmpl('changeset',
   243                 diff=diffs,
   242                 diff=diffs,
   244                 rev=ctx.rev(),
   243                 rev=ctx.rev(),
   245                 node=ctx.hex(),
   244                 node=ctx.hex(),
   246                 parent=webutil.siblings(parents),
   245                 parent=webutil.parents(ctx),
   247                 child=webutil.siblings(ctx.children()),
   246                 child=webutil.children(ctx),
   248                 changesettag=showtags,
   247                 changesettag=showtags,
   249                 changesetbranch=showbranch,
   248                 changesetbranch=showbranch,
   250                 author=ctx.user(),
   249                 author=ctx.user(),
   251                 desc=ctx.description(),
   250                 desc=ctx.description(),
   252                 date=ctx.date(),
   251                 date=ctx.date(),
   440             raise
   439             raise
   441 
   440 
   442     if fctx is not None:
   441     if fctx is not None:
   443         n = fctx.node()
   442         n = fctx.node()
   444         path = fctx.path()
   443         path = fctx.path()
   445         parents = fctx.parents()
       
   446         p1 = parents and parents[0].node() or nullid
       
   447     else:
   444     else:
   448         n = ctx.node()
   445         n = ctx.node()
   449         # path already defined in except clause
   446         # path already defined in except clause
   450         parents = ctx.parents()
       
   451 
   447 
   452     parity = paritygen(web.stripecount)
   448     parity = paritygen(web.stripecount)
   453     diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity)
   449     diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity)
   454     rename = fctx and webutil.renamelink(fctx) or []
   450     rename = fctx and webutil.renamelink(fctx) or []
   455     ctx = fctx and fctx or ctx
   451     ctx = fctx and fctx or ctx
   460                 date=ctx.date(),
   456                 date=ctx.date(),
   461                 desc=ctx.description(),
   457                 desc=ctx.description(),
   462                 author=ctx.user(),
   458                 author=ctx.user(),
   463                 rename=rename,
   459                 rename=rename,
   464                 branch=webutil.nodebranchnodefault(ctx),
   460                 branch=webutil.nodebranchnodefault(ctx),
   465                 parent=webutil.siblings(parents),
   461                 parent=webutil.parents(ctx),
   466                 child=webutil.siblings(ctx.children()),
   462                 child=webutil.children(ctx),
   467                 diff=diffs)
   463                 diff=diffs)
   468 
   464 
   469 diff = filediff
   465 diff = filediff
   470 
   466 
   471 def annotate(web, req, tmpl):
   467 def annotate(web, req, tmpl):
   508                 author=fctx.user(),
   504                 author=fctx.user(),
   509                 date=fctx.date(),
   505                 date=fctx.date(),
   510                 desc=fctx.description(),
   506                 desc=fctx.description(),
   511                 rename=webutil.renamelink(fctx),
   507                 rename=webutil.renamelink(fctx),
   512                 branch=webutil.nodebranchnodefault(fctx),
   508                 branch=webutil.nodebranchnodefault(fctx),
   513                 parent=webutil.siblings(fctx.parents()),
   509                 parent=webutil.parents(fctx),
   514                 child=webutil.siblings(fctx.children()),
   510                 child=webutil.children(fctx),
   515                 permissions=fctx.manifest().flags(f))
   511                 permissions=fctx.manifest().flags(f))
   516 
   512 
   517 def filelog(web, req, tmpl):
   513 def filelog(web, req, tmpl):
   518 
   514 
   519     try:
   515     try:
   553                          "file": f,
   549                          "file": f,
   554                          "node": hex(iterfctx.node()),
   550                          "node": hex(iterfctx.node()),
   555                          "author": iterfctx.user(),
   551                          "author": iterfctx.user(),
   556                          "date": iterfctx.date(),
   552                          "date": iterfctx.date(),
   557                          "rename": webutil.renamelink(iterfctx),
   553                          "rename": webutil.renamelink(iterfctx),
   558                          "parent": webutil.siblings(iterfctx.parents()),
   554                          "parent": webutil.parents(iterfctx),
   559                          "child": webutil.siblings(iterfctx.children()),
   555                          "child": webutil.children(iterfctx),
   560                          "desc": iterfctx.description(),
   556                          "desc": iterfctx.description(),
   561                          "tags": webutil.nodetagsdict(repo, iterfctx.node()),
   557                          "tags": webutil.nodetagsdict(repo, iterfctx.node()),
   562                          "branch": webutil.nodebranchnodefault(iterfctx),
   558                          "branch": webutil.nodebranchnodefault(iterfctx),
   563                          "inbranch": webutil.nodeinbranch(repo, iterfctx),
   559                          "inbranch": webutil.nodeinbranch(repo, iterfctx),
   564                          "branches": webutil.nodebranchdict(repo, iterfctx)})
   560                          "branches": webutil.nodebranchdict(repo, iterfctx)})