comparison mercurial/hgweb/hgwebdir_mod.py @ 13436:b391c0c9be61 stable

hgwebdir: reduce memory usage for index generation The archive list generator was holding a reference to each temporary ui copy passed by rawentries(), so the memory usage for index generation growed proportionally to the ui object size and the amount of repositories. By returning a list instead, the temporary reference is dropped immediately.
author Wagner Bruna <wbruna@softwareexpress.com.br>
date Thu, 17 Feb 2011 18:05:27 -0200
parents 8ed91088acbb
children d24e97fd52a9
comparison
equal deleted inserted replaced
13435:90d7ce986565 13436:b391c0c9be61
201 201
202 def makeindex(self, req, tmpl, subdir=""): 202 def makeindex(self, req, tmpl, subdir=""):
203 203
204 def archivelist(ui, nodeid, url): 204 def archivelist(ui, nodeid, url):
205 allowed = ui.configlist("web", "allow_archive", untrusted=True) 205 allowed = ui.configlist("web", "allow_archive", untrusted=True)
206 archives = []
206 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: 207 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
207 if i[0] in allowed or ui.configbool("web", "allow" + i[0], 208 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
208 untrusted=True): 209 untrusted=True):
209 yield {"type" : i[0], "extension": i[1], 210 archives.append({"type" : i[0], "extension": i[1],
210 "node": nodeid, "url": url} 211 "node": nodeid, "url": url})
212 return archives
211 213
212 def rawentries(subdir="", **map): 214 def rawentries(subdir="", **map):
213 215
214 descend = self.ui.configbool('web', 'descend', True) 216 descend = self.ui.configbool('web', 'descend', True)
215 for name, path in self.repos: 217 for name, path in self.repos: