# HG changeset patch # User Matt Mackall # Date 1406132182 18000 # Node ID 54ff2789d75e0662a536b3da61ca25c07436966b # Parent 1ce8df4b2322fb051df501c4a78dca6bf6a68c92 version: don't traceback if no extensions to list (issue4312) diff -r 1ce8df4b2322 -r 54ff2789d75e mercurial/commands.py --- a/mercurial/commands.py Wed Jul 23 10:50:21 2014 -0500 +++ b/mercurial/commands.py Wed Jul 23 11:16:22 2014 -0500 @@ -6026,6 +6026,7 @@ for name, module in extensions.extensions(): names.append(name) vers.append(extensions.moduleversion(module)) - maxnamelen = max(len(n) for n in names) - for i, name in enumerate(names): - ui.write(" %-*s %s\n" % (maxnamelen, name, vers[i])) + if names: + maxnamelen = max(len(n) for n in names) + for i, name in enumerate(names): + ui.write(" %-*s %s\n" % (maxnamelen, name, vers[i])) diff -r 1ce8df4b2322 -r 54ff2789d75e tests/test-extension.t --- a/tests/test-extension.t Wed Jul 23 10:50:21 2014 -0500 +++ b/tests/test-extension.t Wed Jul 23 11:16:22 2014 -0500 @@ -748,6 +748,17 @@ Test version number support in 'hg version': $ echo '__version__ = (1, 2, 3)' >> throw.py $ rm -f throw.pyc throw.pyo + $ hg version -v + Mercurial Distributed SCM (version *) (glob) + (see http://mercurial.selenic.com for more information) + + Copyright (C) 2005-* Matt Mackall and others (glob) + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Enabled extensions: + + $ hg version -v --config extensions.throw=throw.py Mercurial Distributed SCM (version *) (glob) (see http://mercurial.selenic.com for more information)