Mercurial > hg-stable
changeset 11239:99bc18d1ab0f stable
hgweb: fix race in refreshing repo list (issue2188)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 14 May 2010 12:57:24 -0500 |
parents | feb2a58fc592 |
children | ccb4057e19e6 |
files | mercurial/hgweb/hgwebdir_mod.py |
diffstat | 1 files changed, 18 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py Mon May 31 17:13:15 2010 +0900 +++ b/mercurial/hgweb/hgwebdir_mod.py Fri May 14 12:57:24 2010 -0500 @@ -56,21 +56,33 @@ return if self.baseui: - self.ui = self.baseui.copy() + u = self.baseui.copy() else: - self.ui = ui.ui() - self.ui.setconfig('ui', 'report_untrusted', 'off') - self.ui.setconfig('ui', 'interactive', 'off') + u = ui.ui() + u.setconfig('ui', 'report_untrusted', 'off') + u.setconfig('ui', 'interactive', 'off') if not isinstance(self.conf, (dict, list, tuple)): map = {'paths': 'hgweb-paths'} - self.ui.readconfig(self.conf, remap=map, trust=True) - paths = self.ui.configitems('hgweb-paths') + u.readconfig(self.conf, remap=map, trust=True) + paths = u.configitems('hgweb-paths') elif isinstance(self.conf, (list, tuple)): paths = self.conf elif isinstance(self.conf, dict): paths = self.conf.items() + repos = findrepos(paths) + for prefix, root in u.configitems('collections'): + prefix = util.pconvert(prefix) + for path in util.walkrepos(root, followsym=True): + repo = os.path.normpath(path) + name = util.pconvert(repo) + if name.startswith(prefix): + name = name[len(prefix):] + repos.append((name.lstrip('/'), repo)) + + self.repos = repos + self.ui = u encoding.encoding = self.ui.config('web', 'encoding', encoding.encoding) self.style = self.ui.config('web', 'style', 'paper') @@ -78,17 +90,6 @@ if self.stripecount: self.stripecount = int(self.stripecount) self._baseurl = self.ui.config('web', 'baseurl') - - self.repos = findrepos(paths) - for prefix, root in self.ui.configitems('collections'): - prefix = util.pconvert(prefix) - for path in util.walkrepos(root, followsym=True): - repo = os.path.normpath(path) - name = util.pconvert(repo) - if name.startswith(prefix): - name = name[len(prefix):] - self.repos.append((name.lstrip('/'), repo)) - self.lastrefresh = time.time() def run(self):