Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 7310:bd522d09d5e3
hgweb: move the diffs() generator into webutil
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 03 Nov 2008 20:41:48 +0100 |
parents | c21d236ca897 |
children | de9c87fe1620 |
comparison
equal
deleted
inserted
replaced
7309:e74a9173c2d7 | 7310:bd522d09d5e3 |
---|---|
222 def shortlog(web, req, tmpl): | 222 def shortlog(web, req, tmpl): |
223 return changelog(web, req, tmpl, shortlog = True) | 223 return changelog(web, req, tmpl, shortlog = True) |
224 | 224 |
225 def changeset(web, req, tmpl): | 225 def changeset(web, req, tmpl): |
226 ctx = webutil.changectx(web.repo, req) | 226 ctx = webutil.changectx(web.repo, req) |
227 n = ctx.node() | 227 showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node()) |
228 showtags = webutil.showtag(web.repo, tmpl, 'changesettag', n) | |
229 parents = ctx.parents() | 228 parents = ctx.parents() |
230 p1 = parents[0].node() | |
231 | 229 |
232 files = [] | 230 files = [] |
233 parity = paritygen(web.stripecount) | 231 parity = paritygen(web.stripecount) |
234 for f in ctx.files(): | 232 for f in ctx.files(): |
235 template = f in ctx and 'filenodelink' or 'filenolink' | 233 template = f in ctx and 'filenodelink' or 'filenolink' |
236 files.append(tmpl(template, | 234 files.append(tmpl(template, |
237 node=hex(n), file=f, | 235 node=ctx.hex(), file=f, |
238 parity=parity.next())) | 236 parity=parity.next())) |
239 | 237 |
240 diffs = web.diff(tmpl, p1, n, None) | 238 parity = paritygen(web.stripecount) |
239 diffs = webutil.diffs(web.repo, tmpl, ctx, None, parity) | |
241 return tmpl('changeset', | 240 return tmpl('changeset', |
242 diff=diffs, | 241 diff=diffs, |
243 rev=ctx.rev(), | 242 rev=ctx.rev(), |
244 node=hex(n), | 243 node=ctx.hex(), |
245 parent=webutil.siblings(parents), | 244 parent=webutil.siblings(parents), |
246 child=webutil.siblings(ctx.children()), | 245 child=webutil.siblings(ctx.children()), |
247 changesettag=showtags, | 246 changesettag=showtags, |
248 author=ctx.user(), | 247 author=ctx.user(), |
249 desc=ctx.description(), | 248 desc=ctx.description(), |
250 date=ctx.date(), | 249 date=ctx.date(), |
251 files=files, | 250 files=files, |
252 archives=web.archivelist(hex(n)), | 251 archives=web.archivelist(ctx.hex()), |
253 tags=webutil.nodetagsdict(web.repo, n), | 252 tags=webutil.nodetagsdict(web.repo, ctx.node()), |
254 branch=webutil.nodebranchnodefault(ctx), | 253 branch=webutil.nodebranchnodefault(ctx), |
255 inbranch=webutil.nodeinbranch(web.repo, ctx), | 254 inbranch=webutil.nodeinbranch(web.repo, ctx), |
256 branches=webutil.nodebranchdict(web.repo, ctx)) | 255 branches=webutil.nodebranchdict(web.repo, ctx)) |
257 | 256 |
258 rev = changeset | 257 rev = changeset |
444 p1 = parents and parents[0].node() or nullid | 443 p1 = parents and parents[0].node() or nullid |
445 else: | 444 else: |
446 n = ctx.node() | 445 n = ctx.node() |
447 # path already defined in except clause | 446 # path already defined in except clause |
448 parents = ctx.parents() | 447 parents = ctx.parents() |
449 p1 = parents and parents[0].node() or nullid | 448 |
450 | 449 parity = paritygen(web.stripecount) |
451 diffs = web.diff(tmpl, p1, n, [path]) | 450 diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity) |
452 rename = fctx and webutil.renamelink(fctx) or [] | 451 rename = fctx and webutil.renamelink(fctx) or [] |
453 ctx = fctx and fctx or ctx | 452 ctx = fctx and fctx or ctx |
454 return tmpl("filediff", | 453 return tmpl("filediff", |
455 file=path, | 454 file=path, |
456 node=hex(n), | 455 node=hex(n), |