version: don't traceback if no extensions to list (
issue4312)
--- 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]))
--- 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)