##// END OF EJS Templates
extensions: add notloaded method to return extensions failed to load...
Jun Wu -
r28155:7f430b2a default
parent child Browse files
Show More
@@ -456,6 +456,10 b' def enabled(shortname=True):'
456
456
457 return exts
457 return exts
458
458
459 def notloaded():
460 '''return short names of extensions that failed to load'''
461 return [name for name, mod in _extensions.iteritems() if mod is None]
462
459 def moduleversion(module):
463 def moduleversion(module):
460 '''return version information from given module as a string'''
464 '''return version information from given module as a string'''
461 if (util.safehasattr(module, 'getversion')
465 if (util.safehasattr(module, 'getversion')
@@ -31,6 +31,19 b' show traceback'
31 Traceback (most recent call last):
31 Traceback (most recent call last):
32 ImportError: No module named badext2
32 ImportError: No module named badext2
33
33
34 names of extensions failed to load can be accessed via extensions.notloaded()
35
36 $ cat <<EOF > showbadexts.py
37 > from mercurial import cmdutil, commands, extensions
38 > cmdtable = {}
39 > command = cmdutil.command(cmdtable)
40 > @command('showbadexts', norepo=True)
41 > def showbadexts(ui, *pats, **opts):
42 > ui.write('BADEXTS: %s' % ' '.join(sorted(extensions.notloaded())))
43 > EOF
44 $ hg --config extensions.badexts=showbadexts.py showbadexts 2>&1 | grep '^BADEXTS'
45 BADEXTS: badext badext2
46
34 show traceback for ImportError of hgext.name if debug is set
47 show traceback for ImportError of hgext.name if debug is set
35 (note that --debug option isn't applied yet when loading extensions)
48 (note that --debug option isn't applied yet when loading extensions)
36
49
General Comments 0
You need to be logged in to leave comments. Login now