##// END OF EJS Templates
hgweb: extract code for emitting multiple changelist records...
Gregory Szorc -
r38054:5989261a default
parent child Browse files
Show More
@@ -398,14 +398,8 b' def changelog(web, shortlog=False):'
398 revs = []
398 revs = []
399 if pos != -1:
399 if pos != -1:
400 revs = web.repo.changelog.revs(pos, 0)
400 revs = web.repo.changelog.revs(pos, 0)
401 curcount = 0
402 for rev in revs:
403 curcount += 1
404 if curcount > revcount + 1:
405 break
406
401
407 entry = webutil.changelistentry(web, web.repo[rev])
402 for entry in webutil.changelistentries(web, revs, revcount, parity):
408 entry['parity'] = next(parity)
409 yield entry
403 yield entry
410
404
411 if shortlog:
405 if shortlog:
@@ -457,6 +457,22 b' def changelistentry(web, ctx):'
457 )
457 )
458 return entry
458 return entry
459
459
460 def changelistentries(web, revs, maxcount, parityfn):
461 """Emit up to N records for an iterable of revisions."""
462 repo = web.repo
463
464 count = 0
465 for rev in revs:
466 if count >= maxcount:
467 break
468
469 count += 1
470
471 entry = changelistentry(web, repo[rev])
472 entry['parity'] = next(parityfn)
473
474 yield entry
475
460 def symrevorshortnode(req, ctx):
476 def symrevorshortnode(req, ctx):
461 if 'node' in req.qsparams:
477 if 'node' in req.qsparams:
462 return templatefilters.revescape(req.qsparams['node'])
478 return templatefilters.revescape(req.qsparams['node'])
General Comments 0
You need to be logged in to leave comments. Login now