comparison mercurial/extensions.py @ 43238:101ae8bbfa02

cleanup: hgdemandimport.tracing accepts strings, not bytes This does mean that the resulting traces will have some b'' goo in them on Python 3, but I think that's a worthwile price to pay since it doesn't break any tests. Differential Revision: https://phab.mercurial-scm.org/D7108
author Augie Fackler <augie@google.com>
date Tue, 15 Oct 2019 11:06:04 -0400
parents d783f945a701
children 313e3a279828
comparison
equal deleted inserted replaced
43237:b21e3a747501 43238:101ae8bbfa02
205 return None 205 return None
206 if shortname in _extensions: 206 if shortname in _extensions:
207 return _extensions[shortname] 207 return _extensions[shortname]
208 ui.log(b'extension', b' - loading extension: %s\n', shortname) 208 ui.log(b'extension', b' - loading extension: %s\n', shortname)
209 _extensions[shortname] = None 209 _extensions[shortname] = None
210 with util.timedcm(b'load extension %s', shortname) as stats: 210 with util.timedcm('load extension %s', shortname) as stats:
211 mod = _importext(name, path, bind(_reportimporterror, ui)) 211 mod = _importext(name, path, bind(_reportimporterror, ui))
212 ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats) 212 ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats)
213 if loadingtime is not None: 213 if loadingtime is not None:
214 loadingtime[shortname] += stats.elapsed 214 loadingtime[shortname] += stats.elapsed
215 215
231 _extensions[shortname] = mod 231 _extensions[shortname] = mod
232 _order.append(shortname) 232 _order.append(shortname)
233 ui.log( 233 ui.log(
234 b'extension', b' - invoking registered callbacks: %s\n', shortname 234 b'extension', b' - invoking registered callbacks: %s\n', shortname
235 ) 235 )
236 with util.timedcm(b'callbacks extension %s', shortname) as stats: 236 with util.timedcm('callbacks extension %s', shortname) as stats:
237 for fn in _aftercallbacks.get(shortname, []): 237 for fn in _aftercallbacks.get(shortname, []):
238 fn(loaded=True) 238 fn(loaded=True)
239 ui.log(b'extension', b' > callbacks completed in %s\n', stats) 239 ui.log(b'extension', b' > callbacks completed in %s\n', stats)
240 return mod 240 return mod
241 241
276 b'extension', 276 b'extension',
277 b'loading %sextensions\n', 277 b'loading %sextensions\n',
278 b'additional ' if newindex else b'', 278 b'additional ' if newindex else b'',
279 ) 279 )
280 ui.log(b'extension', b'- processing %d entries\n', len(result)) 280 ui.log(b'extension', b'- processing %d entries\n', len(result))
281 with util.timedcm(b'load all extensions') as stats: 281 with util.timedcm('load all extensions') as stats:
282 for (name, path) in result: 282 for (name, path) in result:
283 if path: 283 if path:
284 if path[0:1] == b'!': 284 if path[0:1] == b'!':
285 if name not in _disabledextensions: 285 if name not in _disabledextensions:
286 ui.log( 286 ui.log(
329 ui.log(b'extension', b'- loading configtable attributes\n') 329 ui.log(b'extension', b'- loading configtable attributes\n')
330 _loadextra(ui, newindex, earlyextraloaders) 330 _loadextra(ui, newindex, earlyextraloaders)
331 331
332 broken = set() 332 broken = set()
333 ui.log(b'extension', b'- executing uisetup hooks\n') 333 ui.log(b'extension', b'- executing uisetup hooks\n')
334 with util.timedcm(b'all uisetup') as alluisetupstats: 334 with util.timedcm('all uisetup') as alluisetupstats:
335 for name in _order[newindex:]: 335 for name in _order[newindex:]:
336 ui.log(b'extension', b' - running uisetup for %s\n', name) 336 ui.log(b'extension', b' - running uisetup for %s\n', name)
337 with util.timedcm(b'uisetup %s', name) as stats: 337 with util.timedcm('uisetup %s', name) as stats:
338 if not _runuisetup(name, ui): 338 if not _runuisetup(name, ui):
339 ui.log( 339 ui.log(
340 b'extension', 340 b'extension',
341 b' - the %s extension uisetup failed\n', 341 b' - the %s extension uisetup failed\n',
342 name, 342 name,
345 ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats) 345 ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats)
346 loadingtime[name] += stats.elapsed 346 loadingtime[name] += stats.elapsed
347 ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats) 347 ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats)
348 348
349 ui.log(b'extension', b'- executing extsetup hooks\n') 349 ui.log(b'extension', b'- executing extsetup hooks\n')
350 with util.timedcm(b'all extsetup') as allextetupstats: 350 with util.timedcm('all extsetup') as allextetupstats:
351 for name in _order[newindex:]: 351 for name in _order[newindex:]:
352 if name in broken: 352 if name in broken:
353 continue 353 continue
354 ui.log(b'extension', b' - running extsetup for %s\n', name) 354 ui.log(b'extension', b' - running extsetup for %s\n', name)
355 with util.timedcm(b'extsetup %s', name) as stats: 355 with util.timedcm('extsetup %s', name) as stats:
356 if not _runextsetup(name, ui): 356 if not _runextsetup(name, ui):
357 ui.log( 357 ui.log(
358 b'extension', 358 b'extension',
359 b' - the %s extension extsetup failed\n', 359 b' - the %s extension extsetup failed\n',
360 name, 360 name,
368 ui.log(b'extension', b' - disabling broken %s extension\n', name) 368 ui.log(b'extension', b' - disabling broken %s extension\n', name)
369 _extensions[name] = None 369 _extensions[name] = None
370 370
371 # Call aftercallbacks that were never met. 371 # Call aftercallbacks that were never met.
372 ui.log(b'extension', b'- executing remaining aftercallbacks\n') 372 ui.log(b'extension', b'- executing remaining aftercallbacks\n')
373 with util.timedcm(b'aftercallbacks') as stats: 373 with util.timedcm('aftercallbacks') as stats:
374 for shortname in _aftercallbacks: 374 for shortname in _aftercallbacks:
375 if shortname in _extensions: 375 if shortname in _extensions:
376 continue 376 continue
377 377
378 for fn in _aftercallbacks[shortname]: 378 for fn in _aftercallbacks[shortname]:
415 (b'revsetpredicate', revset, b'loadpredicate'), 415 (b'revsetpredicate', revset, b'loadpredicate'),
416 (b'templatefilter', templatefilters, b'loadfilter'), 416 (b'templatefilter', templatefilters, b'loadfilter'),
417 (b'templatefunc', templatefuncs, b'loadfunction'), 417 (b'templatefunc', templatefuncs, b'loadfunction'),
418 (b'templatekeyword', templatekw, b'loadkeyword'), 418 (b'templatekeyword', templatekw, b'loadkeyword'),
419 ] 419 ]
420 with util.timedcm(b'load registration objects') as stats: 420 with util.timedcm('load registration objects') as stats:
421 _loadextra(ui, newindex, extraloaders) 421 _loadextra(ui, newindex, extraloaders)
422 ui.log( 422 ui.log(
423 b'extension', 423 b'extension',
424 b'> extension registration object loading took %s\n', 424 b'> extension registration object loading took %s\n',
425 stats, 425 stats,