[PATCH] version: makes verbose option distinct between internal and external extension (issue4731)

liscju piotr.listkiewicz at gmail.com
Fri Feb 5 12:21:52 UTC 2016


# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1454674823 -3600
#      Fri Feb 05 13:20:23 2016 +0100
# Node ID 3d78f69eb3dbea4efbe59c60f2ab30c6c9da1a4f
# Parent  01a5143cd25f285f8c745a92986cd7186bb32c90
version: makes verbose option distinct between internal and external extension (issue4731)

diff -r 01a5143cd25f -r 3d78f69eb3db mercurial/commands.py
--- a/mercurial/commands.py	Wed Feb 03 16:24:24 2016 -0600
+++ 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]))
diff -r 01a5143cd25f -r 3d78f69eb3db mercurial/extensions.py
--- a/mercurial/extensions.py	Wed Feb 03 16:24:24 2016 -0600
+++ 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"
diff -r 01a5143cd25f -r 3d78f69eb3db tests/test-extension.t
--- a/tests/test-extension.t	Wed Feb 03 16:24:24 2016 -0600
+++ 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
 


More information about the Mercurial-devel mailing list