changeset 27990:96bfd2875213

version: verbose list internal and external extension source (issue4731)
author liscju <piotr.listkiewicz@gmail.com>
date Fri, 05 Feb 2016 13:20:23 +0100
parents e77ac31b64a1
children 5daf1a8c5f1d
files mercurial/commands.py mercurial/extensions.py tests/test-extension.t
diffstat 3 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Feb 02 21:20:04 2016 -0800
+++ b/mercurial/commands.py	Fri Feb 05 13:20:23 2016 +0100
@@ -7030,10 +7030,16 @@
         # 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):
-                ui.write("  %-*s  %s\n" % (maxnamelen, name, vers[i]))
+                ui.write("  %-*s  %s  %s\n" %
+                         (maxnamelen, name, place[i], vers[i]))
--- a/mercurial/extensions.py	Tue Feb 02 21:20:04 2016 -0800
+++ b/mercurial/extensions.py	Fri Feb 05 13:20:23 2016 +0100
@@ -468,3 +468,7 @@
     if isinstance(version, (list, tuple)):
         version = '.'.join(str(o) for o in version)
     return version
+
+def ismoduleinternal(module):
+    exttestedwith = getattr(module, 'testedwith', None)
+    return exttestedwith == "internal"
--- a/tests/test-extension.t	Tue Feb 02 21:20:04 2016 -0800
+++ b/tests/test-extension.t	Fri Feb 05 13:20:23 2016 +0100
@@ -1003,7 +1003,7 @@
   
   Enabled extensions:
   
-    throw  1.2.3
+    throw  external  1.2.3
   $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
   $ rm -f throw.pyc throw.pyo
   $ hg version -v --config extensions.throw=throw.py
@@ -1016,7 +1016,7 @@
   
   Enabled extensions:
   
-    throw  1.twentythree
+    throw  external  1.twentythree
 
 Refuse to load extensions with minimum version requirements