changeset 29889:42751543fa06

version: change "place" field of extension to "bundled" flag The name "place" sounds odd. We can simply expose raw boolean values instead of switching external/internal literals.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 26 Aug 2016 23:38:52 +0900
parents ed793f41e83f
children e2c086f147ef
files mercurial/commands.py tests/test-extension.t
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Aug 27 00:00:28 2016 +0900
+++ b/mercurial/commands.py	Fri Aug 26 23:38:52 2016 +0900
@@ -7297,14 +7297,13 @@
     fn = fm.nested("extensions")
     if names:
         namefmt = "  %%-%ds  " % max(len(n) for n in names)
-        if fn:
-            places = ["external", "internal"]
-        else:
-            places = [_("external"), _("internal")]
+        places = [_("external"), _("internal")]
         for n, v, p in zip(names, vers, isinternals):
             fn.startitem()
             fn.condwrite(ui.verbose, "name", namefmt, n)
-            fn.condwrite(ui.verbose, "place", "%s  ", places[p])
+            if ui.verbose:
+                fn.plain("%s  " % places[p])
+            fn.data(bundled=p)
             fn.condwrite(ui.verbose and v, "ver", "%s", v)
             if ui.verbose:
                 fn.plain("\n")
--- a/tests/test-extension.t	Sat Aug 27 00:00:28 2016 +0900
+++ b/tests/test-extension.t	Fri Aug 26 23:38:52 2016 +0900
@@ -1253,15 +1253,15 @@
   $ hg version --config extensions.throw=throw.py -Tjson
   [
    {
-    "extensions": [{"name": "throw", "place": "external", "ver": "1.twentythree"}],
+    "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}],
     "ver": "3.2.2"
    }
   ]
 
-  $ LANGUAGE= LC_ALL=ja_JP.UTF-8 hg version --config extensions.strip= -Tjson
+  $ hg version --config extensions.strip= -Tjson
   [
    {
-    "extensions": [{"name": "strip", "place": "internal", "ver": null}],
+    "extensions": [{"bundled": true, "name": "strip", "ver": null}],
     "ver": "*" (glob)
    }
   ]
@@ -1269,7 +1269,7 @@
 Test template output of version:
 
   $ hg version --config extensions.throw=throw.py --config extensions.strip= \
-  > -T'{extensions % "{name}  {pad(ver, 16)}  ({place})\n"}'
+  > -T'{extensions % "{name}  {pad(ver, 16)}  ({if(bundled, "internal", "external")})\n"}'
   throw  1.twentythree     (external)
   strip                    (internal)