comparison mercurial/hgweb/webcommands.py @ 38043:5989261a8356

hgweb: extract code for emitting multiple changelist records changelistentry() exists so extensions can easily monkeypatch the function to add additional metadata. In at least one case at Mozilla, we have an extension doing this where performance would greatly benefit if we were able to "batch fetch" metadata for all revisions that will eventually have their data set. By extracting the logic for "obtain records for N revisions" into a standalone function, we make it possible for a monkeypatched function to more efficiently bulk fetch data for N revisions. Differential Revision: https://phab.mercurial-scm.org/D3573
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 17 May 2018 12:23:38 -0700
parents 623dc2651d26
children aeccb08af311
comparison
equal deleted inserted replaced
38042:5a7cf42ba6ef 38043:5989261a8356
396 396
397 def changelist(): 397 def changelist():
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 401
402 for rev in revs: 402 for entry in webutil.changelistentries(web, revs, revcount, parity):
403 curcount += 1
404 if curcount > revcount + 1:
405 break
406
407 entry = webutil.changelistentry(web, web.repo[rev])
408 entry['parity'] = next(parity)
409 yield entry 403 yield entry
410 404
411 if shortlog: 405 if shortlog:
412 revcount = web.maxshortchanges 406 revcount = web.maxshortchanges
413 else: 407 else: