##// END OF EJS Templates
hgweb: extract changelist entry generation into own function...
Gregory Szorc -
r23745:513d4790 default
parent child Browse files
Show More
@@ -282,31 +282,14 b' def changelog(web, req, tmpl, shortlog=F'
282 if pos != -1:
282 if pos != -1:
283 revs = web.repo.changelog.revs(pos, 0)
283 revs = web.repo.changelog.revs(pos, 0)
284 curcount = 0
284 curcount = 0
285 for i in revs:
285 for rev in revs:
286 ctx = web.repo[i]
287 n = ctx.node()
288 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
289 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
290
291 curcount += 1
286 curcount += 1
292 if curcount > revcount + 1:
287 if curcount > revcount + 1:
293 break
288 break
294 yield {"parity": parity.next(),
289
295 "author": ctx.user(),
290 entry = webutil.changelistentry(web, web.repo[rev], tmpl)
296 "parent": webutil.parents(ctx, i - 1),
291 entry['parity'] = parity.next()
297 "child": webutil.children(ctx, i + 1),
292 yield entry
298 "changelogtag": showtags,
299 "desc": ctx.description(),
300 "extra": ctx.extra(),
301 "date": ctx.date(),
302 "files": files,
303 "rev": i,
304 "node": hex(n),
305 "tags": webutil.nodetagsdict(web.repo, n),
306 "bookmarks": webutil.nodebookmarksdict(web.repo, n),
307 "inbranch": webutil.nodeinbranch(web.repo, ctx),
308 "branches": webutil.nodebranchdict(web.repo, ctx)
309 }
310
293
311 revcount = shortlog and web.maxshortchanges or web.maxchanges
294 revcount = shortlog and web.maxshortchanges or web.maxchanges
312 if 'revcount' in req.form:
295 if 'revcount' in req.form:
@@ -249,6 +249,35 b' def filectx(repo, req):'
249
249
250 return fctx
250 return fctx
251
251
252 def changelistentry(web, ctx, tmpl):
253 '''Obtain a dictionary to be used for entries in a changelist.
254
255 This function is called when producing items for the "entries" list passed
256 to the "shortlog" and "changelog" templates.
257 '''
258 repo = web.repo
259 rev = ctx.rev()
260 n = ctx.node()
261 showtags = showtag(repo, tmpl, 'changelogtag', n)
262 files = listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
263
264 return {
265 "author": ctx.user(),
266 "parent": parents(ctx, rev - 1),
267 "child": children(ctx, rev + 1),
268 "changelogtag": showtags,
269 "desc": ctx.description(),
270 "extra": ctx.extra(),
271 "date": ctx.date(),
272 "files": files,
273 "rev": rev,
274 "node": hex(n),
275 "tags": nodetagsdict(repo, n),
276 "bookmarks": nodebookmarksdict(repo, n),
277 "inbranch": nodeinbranch(repo, ctx),
278 "branches": nodebranchdict(repo, ctx)
279 }
280
252 def listfilediffs(tmpl, files, node, max):
281 def listfilediffs(tmpl, files, node, max):
253 for f in files[:max]:
282 for f in files[:max]:
254 yield tmpl('filedifflink', node=hex(node), file=f)
283 yield tmpl('filedifflink', node=hex(node), file=f)
General Comments 0
You need to be logged in to leave comments. Login now