Mercurial > hg
comparison mercurial/hg.py @ 40996:6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
The output format changes and the messages will be sent to stderr instead of
stdout, but I don't think that matters.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 15 Dec 2018 16:28:29 +0900 |
parents | 437520219e0c |
children | ce0bc2952e2a |
comparison
equal
deleted
inserted
replaced
40995:19178aeb9b43 | 40996:6f2510b581a0 |
---|---|
158 intents=None, createopts=None): | 158 intents=None, createopts=None): |
159 """return a repository object for the specified path""" | 159 """return a repository object for the specified path""" |
160 obj = _peerlookup(path).instance(ui, path, create, intents=intents, | 160 obj = _peerlookup(path).instance(ui, path, create, intents=intents, |
161 createopts=createopts) | 161 createopts=createopts) |
162 ui = getattr(obj, "ui", ui) | 162 ui = getattr(obj, "ui", ui) |
163 if ui.configbool('devel', 'debug.extensions'): | |
164 log = lambda msg, *values: ui.debug('debug.extensions: ', | |
165 msg % values, label='debug.extensions') | |
166 else: | |
167 log = lambda *a, **kw: None | |
168 for f in presetupfuncs or []: | 163 for f in presetupfuncs or []: |
169 f(ui, obj) | 164 f(ui, obj) |
170 log('- executing reposetup hooks\n') | 165 ui.log(b'extension', b'- executing reposetup hooks\n') |
171 with util.timedcm('all reposetup') as allreposetupstats: | 166 with util.timedcm('all reposetup') as allreposetupstats: |
172 for name, module in extensions.extensions(ui): | 167 for name, module in extensions.extensions(ui): |
173 log(' - running reposetup for %s\n' % (name,)) | 168 ui.log(b'extension', b' - running reposetup for %s\n', name) |
174 hook = getattr(module, 'reposetup', None) | 169 hook = getattr(module, 'reposetup', None) |
175 if hook: | 170 if hook: |
176 with util.timedcm('reposetup %r', name) as stats: | 171 with util.timedcm('reposetup %r', name) as stats: |
177 hook(ui, obj) | 172 hook(ui, obj) |
178 log(' > reposetup for %s took %s\n', name, stats) | 173 ui.log(b'extension', b' > reposetup for %s took %s\n', |
179 log('> all reposetup took %s\n', allreposetupstats) | 174 name, stats) |
175 ui.log(b'extension', b'> all reposetup took %s\n', allreposetupstats) | |
180 if not obj.local(): | 176 if not obj.local(): |
181 for f in wirepeersetupfuncs: | 177 for f in wirepeersetupfuncs: |
182 f(ui, obj) | 178 f(ui, obj) |
183 return obj | 179 return obj |
184 | 180 |