##// END OF EJS Templates
extensions: warn about invalid extensions when listing disabled commands...
Mads Kiilerich -
r13191:1aea66b7 default
parent child Browse files
Show More
@@ -2034,7 +2034,7 b' def help_(ui, name=None, with_version=Fa'
2034 'extensions\n'))
2034 'extensions\n'))
2035
2035
2036 def helpextcmd(name):
2036 def helpextcmd(name):
2037 cmd, ext, mod = extensions.disabledcmd(name, ui.config('ui', 'strict'))
2037 cmd, ext, mod = extensions.disabledcmd(ui, name, ui.config('ui', 'strict'))
2038 doc = gettext(mod.__doc__).splitlines()[0]
2038 doc = gettext(mod.__doc__).splitlines()[0]
2039
2039
2040 msg = help.listexts(_("'%s' is provided by the following "
2040 msg = help.listexts(_("'%s' is provided by the following "
@@ -248,7 +248,7 b' def disabledext(name):'
248 if name in paths:
248 if name in paths:
249 return _disabledhelp(paths[name])
249 return _disabledhelp(paths[name])
250
250
251 def disabledcmd(cmd, strict=False):
251 def disabledcmd(ui, cmd, strict=False):
252 '''import disabled extensions until cmd is found.
252 '''import disabled extensions until cmd is found.
253 returns (cmdname, extname, doc)'''
253 returns (cmdname, extname, doc)'''
254
254
@@ -266,6 +266,10 b' def disabledcmd(cmd, strict=False):'
266 getattr(mod, 'cmdtable', {}), strict)
266 getattr(mod, 'cmdtable', {}), strict)
267 except (error.AmbiguousCommand, error.UnknownCommand):
267 except (error.AmbiguousCommand, error.UnknownCommand):
268 return
268 return
269 except Exception:
270 ui.warn(_('warning: error finding commands in %s\n') % path)
271 ui.traceback()
272 return
269 for c in aliases:
273 for c in aliases:
270 if c.startswith(cmd):
274 if c.startswith(cmd):
271 cmd = c
275 cmd = c
@@ -315,6 +315,11 b' Broken disabled extension and command:'
315
315
316 use "hg help extensions" for information on enabling extensions
316 use "hg help extensions" for information on enabling extensions
317
317
318 $ cat > hgext/forest.py <<EOF
319 > cmdtable = None
320 > EOF
318 $ hg --config extensions.path=./path.py help foo > /dev/null
321 $ hg --config extensions.path=./path.py help foo > /dev/null
322 warning: error finding commands in $TESTTMP/hgext/forest.py
319 hg: unknown command 'foo'
323 hg: unknown command 'foo'
324 warning: error finding commands in $TESTTMP/hgext/forest.py
320 [255]
325 [255]
General Comments 0
You need to be logged in to leave comments. Login now