version: always build list of extension versions
This patch just moves "if ui.verbose:" to the inner loop, as preparation
for formatter support.
--- a/mercurial/commands.py Sun Mar 13 19:59:39 2016 +0900
+++ b/mercurial/commands.py Tue Aug 16 16:03:09 2016 +0900
@@ -7255,21 +7255,21 @@
))
ui.note(_("\nEnabled extensions:\n\n"))
- if ui.verbose:
- # format names and versions into columns
- names = []
- vers = []
- place = []
- for name, module in extensions.extensions():
- names.append(name)
- vers.append(extensions.moduleversion(module))
- if extensions.ismoduleinternal(module):
- place.append(_("internal"))
- else:
- place.append(_("external"))
- if names:
- maxnamelen = max(len(n) for n in names)
- for i, name in enumerate(names):
+ # format names and versions into columns
+ names = []
+ vers = []
+ place = []
+ for name, module in extensions.extensions():
+ names.append(name)
+ vers.append(extensions.moduleversion(module))
+ if extensions.ismoduleinternal(module):
+ place.append(_("internal"))
+ else:
+ place.append(_("external"))
+ if names:
+ maxnamelen = max(len(n) for n in names)
+ for i, name in enumerate(names):
+ if ui.verbose:
ui.write(" %-*s %s %s\n" %
(maxnamelen, name, place[i], vers[i]))
--- a/tests/test-extension.t Sun Mar 13 19:59:39 2016 +0900
+++ b/tests/test-extension.t Tue Aug 16 16:03:09 2016 +0900
@@ -1236,6 +1236,9 @@
throw external 1.twentythree
+ $ hg version -q --config extensions.throw=throw.py
+ Mercurial Distributed SCM (version *) (glob)
+
Refuse to load extensions with minimum version requirements
$ cat > minversion1.py << EOF