diff mercurial/hgweb/webcommands.py @ 38076: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
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Wed May 16 22:44:27 2018 -0400
+++ b/mercurial/hgweb/webcommands.py	Thu May 17 12:23:38 2018 -0700
@@ -398,14 +398,8 @@
         revs = []
         if pos != -1:
             revs = web.repo.changelog.revs(pos, 0)
-        curcount = 0
-        for rev in revs:
-            curcount += 1
-            if curcount > revcount + 1:
-                break
 
-            entry = webutil.changelistentry(web, web.repo[rev])
-            entry['parity'] = next(parity)
+        for entry in webutil.changelistentries(web, revs, revcount, parity):
             yield entry
 
     if shortlog: