Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 13596:270f57d35525 stable
hgweb: add display of bookmarks for changelog and changeset
author | Alexander Solovyov <alexander@solovyov.net> |
---|---|
date | Sat, 12 Mar 2011 11:19:44 +0100 |
parents | a38df1250945 |
children | 38c9837b1f75 |
comparison
equal
deleted
inserted
replaced
13594:64a458707fd4 | 13596:270f57d35525 |
---|---|
203 "date": ctx.date(), | 203 "date": ctx.date(), |
204 "files": files, | 204 "files": files, |
205 "rev": i, | 205 "rev": i, |
206 "node": hex(n), | 206 "node": hex(n), |
207 "tags": webutil.nodetagsdict(web.repo, n), | 207 "tags": webutil.nodetagsdict(web.repo, n), |
208 "bookmarks": webutil.nodebookmarksdict(web.repo, n), | |
208 "inbranch": webutil.nodeinbranch(web.repo, ctx), | 209 "inbranch": webutil.nodeinbranch(web.repo, ctx), |
209 "branches": webutil.nodebranchdict(web.repo, ctx) | 210 "branches": webutil.nodebranchdict(web.repo, ctx) |
210 }) | 211 }) |
211 | 212 |
212 if limit > 0: | 213 if limit > 0: |
245 return changelog(web, req, tmpl, shortlog = True) | 246 return changelog(web, req, tmpl, shortlog = True) |
246 | 247 |
247 def changeset(web, req, tmpl): | 248 def changeset(web, req, tmpl): |
248 ctx = webutil.changectx(web.repo, req) | 249 ctx = webutil.changectx(web.repo, req) |
249 showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node()) | 250 showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node()) |
251 showbookmarks = webutil.showbookmark(web.repo, tmpl, 'changesetbookmark', | |
252 ctx.node()) | |
250 showbranch = webutil.nodebranchnodefault(ctx) | 253 showbranch = webutil.nodebranchnodefault(ctx) |
251 | 254 |
252 files = [] | 255 files = [] |
253 parity = paritygen(web.stripecount) | 256 parity = paritygen(web.stripecount) |
254 for f in ctx.files(): | 257 for f in ctx.files(): |
268 rev=ctx.rev(), | 271 rev=ctx.rev(), |
269 node=ctx.hex(), | 272 node=ctx.hex(), |
270 parent=webutil.parents(ctx), | 273 parent=webutil.parents(ctx), |
271 child=webutil.children(ctx), | 274 child=webutil.children(ctx), |
272 changesettag=showtags, | 275 changesettag=showtags, |
276 changesetbookmark=showbookmarks, | |
273 changesetbranch=showbranch, | 277 changesetbranch=showbranch, |
274 author=ctx.user(), | 278 author=ctx.user(), |
275 desc=ctx.description(), | 279 desc=ctx.description(), |
276 date=ctx.date(), | 280 date=ctx.date(), |
277 files=files, | 281 files=files, |
278 archives=web.archivelist(ctx.hex()), | 282 archives=web.archivelist(ctx.hex()), |
279 tags=webutil.nodetagsdict(web.repo, ctx.node()), | 283 tags=webutil.nodetagsdict(web.repo, ctx.node()), |
284 bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()), | |
280 branch=webutil.nodebranchnodefault(ctx), | 285 branch=webutil.nodebranchnodefault(ctx), |
281 inbranch=webutil.nodeinbranch(web.repo, ctx), | 286 inbranch=webutil.nodeinbranch(web.repo, ctx), |
282 branches=webutil.nodebranchdict(web.repo, ctx)) | 287 branches=webutil.nodebranchdict(web.repo, ctx)) |
283 | 288 |
284 rev = changeset | 289 rev = changeset |
719 desc = templatefilters.firstline(ctx.description()) | 724 desc = templatefilters.firstline(ctx.description()) |
720 desc = cgi.escape(templatefilters.nonempty(desc)) | 725 desc = cgi.escape(templatefilters.nonempty(desc)) |
721 user = cgi.escape(templatefilters.person(ctx.user())) | 726 user = cgi.escape(templatefilters.person(ctx.user())) |
722 branch = ctx.branch() | 727 branch = ctx.branch() |
723 branch = branch, web.repo.branchtags().get(branch) == ctx.node() | 728 branch = branch, web.repo.branchtags().get(branch) == ctx.node() |
724 data.append((node, vtx, edges, desc, user, age, branch, ctx.tags())) | 729 data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(), ctx.bookmarks())) |
725 | 730 |
726 return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev, | 731 return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev, |
727 lessvars=lessvars, morevars=morevars, downrev=downrev, | 732 lessvars=lessvars, morevars=morevars, downrev=downrev, |
728 canvasheight=canvasheight, jsdata=data, bg_height=bg_height, | 733 canvasheight=canvasheight, jsdata=data, bg_height=bg_height, |
729 node=revnode_hex, changenav=changenav) | 734 node=revnode_hex, changenav=changenav) |