comparison mercurial/hgweb/hgwebdir_mod.py @ 40729:c93d046d4300

extensions: add "uipopulate" hook, called per instance, not per process In short, this is the "reposetup" function for ui. It allows us to modify ui attributes without extending ui.__class__. Before, the only way to do that was to abuse the config dictionary, which is copied across ui instances. See the next patch for usage example.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 12 Nov 2018 21:10:51 +0900
parents 2cd5f1fac788
children 46781c1b5049
comparison
equal deleted inserted replaced
40728:2cd5f1fac788 40729:c93d046d4300
270 self.motd = None 270 self.motd = None
271 self.refresh() 271 self.refresh()
272 if not baseui: 272 if not baseui:
273 # set up environment for new ui 273 # set up environment for new ui
274 extensions.loadall(self.ui) 274 extensions.loadall(self.ui)
275 extensions.populateui(self.ui)
275 276
276 def refresh(self): 277 def refresh(self):
277 if self.ui: 278 if self.ui:
278 refreshinterval = self.ui.configint('web', 'refreshinterval') 279 refreshinterval = self.ui.configint('web', 'refreshinterval')
279 else: 280 else:
306 paths.append((name, path)) 307 paths.append((name, path))
307 elif isinstance(self.conf, (list, tuple)): 308 elif isinstance(self.conf, (list, tuple)):
308 paths = self.conf 309 paths = self.conf
309 elif isinstance(self.conf, dict): 310 elif isinstance(self.conf, dict):
310 paths = self.conf.items() 311 paths = self.conf.items()
312 extensions.populateui(u)
311 313
312 repos = findrepos(paths) 314 repos = findrepos(paths)
313 for prefix, root in u.configitems('collections'): 315 for prefix, root in u.configitems('collections'):
314 prefix = util.pconvert(prefix) 316 prefix = util.pconvert(prefix)
315 for path in scmutil.walkrepos(root, followsym=True): 317 for path in scmutil.walkrepos(root, followsym=True):