Patchwork [3,of,3,V2] debugextensions: hide "ships-with-hg-core" magic string (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 31, 2016, 3:13 p.m.
Message ID <6d7c9804606c2b09f10f.1472656429@mimosa>
Download mbox | patch
Permalink /patch/16515/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 31, 2016, 3:13 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1472221877 -32400
#      Fri Aug 26 23:31:17 2016 +0900
# Node ID 6d7c9804606c2b09f10f21dd13875e537584c8ce
# Parent  2bf5cbb72b04754f5aab0b31672dbfc28216b3b8
debugextensions: hide "ships-with-hg-core" magic string (BC)

Since we have "bundled" flag, we no longer need to rephrase "ships-with-hg-core"
to show as "internal".
Augie Fackler - Aug. 31, 2016, 6:10 p.m.
On Thu, Sep 01, 2016 at 12:13:49AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1472221877 -32400
> #      Fri Aug 26 23:31:17 2016 +0900
> # Node ID 6d7c9804606c2b09f10f21dd13875e537584c8ce
> # Parent  2bf5cbb72b04754f5aab0b31672dbfc28216b3b8
> debugextensions: hide "ships-with-hg-core" magic string (BC)

These are queued, many thanks

>
> Since we have "bundled" flag, we no longer need to rephrase "ships-with-hg-core"
> to show as "internal".
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2396,11 +2396,10 @@ def debugextensions(ui, **opts):
>      for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
>          isinternal = extensions.ismoduleinternal(extmod)
>          extsource = extmod.__file__
> -        exttestedwith = getattr(extmod, 'testedwith', '').split()
>          if isinternal:
> -            showtestedwith = ['internal']
> +            exttestedwith = []  # never expose magic string to users
>          else:
> -            showtestedwith = exttestedwith
> +            exttestedwith = getattr(extmod, 'testedwith', '').split()
>          extbuglink = getattr(extmod, 'buglink', None)
>
>          fm.startitem()
> @@ -2409,10 +2408,10 @@ def debugextensions(ui, **opts):
>              fm.write('name', '%s\n', extname)
>          else:
>              fm.write('name', '%s', extname)
> -            if not exttestedwith:
> +            if isinternal or hgver in exttestedwith:
> +                fm.plain('\n')
> +            elif not exttestedwith:
>                  fm.plain(_(' (untested!)\n'))
> -            elif isinternal or hgver in exttestedwith:
> -                fm.plain('\n')
>              else:
>                  lasttestedversion = exttestedwith[-1]
>                  fm.plain(' (%s!)\n' % lasttestedversion)
> @@ -2424,9 +2423,9 @@ def debugextensions(ui, **opts):
>              fm.plain(_('  bundled: %s\n') % ['no', 'yes'][isinternal])
>          fm.data(bundled=isinternal)
>
> -        fm.condwrite(ui.verbose and showtestedwith, 'testedwith',
> +        fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
>                       _('  tested with: %s\n'),
> -                     fm.formatlist(showtestedwith, name='ver'))
> +                     fm.formatlist(exttestedwith, name='ver'))
>
>          fm.condwrite(ui.verbose and extbuglink, 'buglink',
>                   _('  bug reporting: %s\n'), extbuglink or "")
> diff --git a/tests/test-debugextensions.t b/tests/test-debugextensions.t
> --- a/tests/test-debugextensions.t
> +++ b/tests/test-debugextensions.t
> @@ -33,7 +33,6 @@
>    color
>      location: */hgext/color.py* (glob)
>      bundled: yes
> -    tested with: internal
>    ext1
>      location: */extwithoutinfos.py* (glob)
>      bundled: no
> @@ -45,19 +44,15 @@
>    histedit
>      location: */hgext/histedit.py* (glob)
>      bundled: yes
> -    tested with: internal
>    mq
>      location: */hgext/mq.py* (glob)
>      bundled: yes
> -    tested with: internal
>    patchbomb
>      location: */hgext/patchbomb.py* (glob)
>      bundled: yes
> -    tested with: internal
>    rebase
>      location: */hgext/rebase.py* (glob)
>      bundled: yes
> -    tested with: internal
>
>    $ hg debugextensions -Tjson | sed 's|\\\\|/|g'
>    [
> @@ -66,7 +61,7 @@
>      "bundled": true,
>      "name": "color",
>      "source": "*/hgext/color.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": []
>     },
>     {
>      "buglink": "",
> @@ -87,28 +82,28 @@
>      "bundled": true,
>      "name": "histedit",
>      "source": "*/hgext/histedit.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": []
>     },
>     {
>      "buglink": "",
>      "bundled": true,
>      "name": "mq",
>      "source": "*/hgext/mq.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": []
>     },
>     {
>      "buglink": "",
>      "bundled": true,
>      "name": "patchbomb",
>      "source": "*/hgext/patchbomb.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": []
>     },
>     {
>      "buglink": "",
>      "bundled": true,
>      "name": "rebase",
>      "source": "*/hgext/rebase.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": []
>     }
>    ]
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2396,11 +2396,10 @@  def debugextensions(ui, **opts):
     for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
         isinternal = extensions.ismoduleinternal(extmod)
         extsource = extmod.__file__
-        exttestedwith = getattr(extmod, 'testedwith', '').split()
         if isinternal:
-            showtestedwith = ['internal']
+            exttestedwith = []  # never expose magic string to users
         else:
-            showtestedwith = exttestedwith
+            exttestedwith = getattr(extmod, 'testedwith', '').split()
         extbuglink = getattr(extmod, 'buglink', None)
 
         fm.startitem()
@@ -2409,10 +2408,10 @@  def debugextensions(ui, **opts):
             fm.write('name', '%s\n', extname)
         else:
             fm.write('name', '%s', extname)
-            if not exttestedwith:
+            if isinternal or hgver in exttestedwith:
+                fm.plain('\n')
+            elif not exttestedwith:
                 fm.plain(_(' (untested!)\n'))
-            elif isinternal or hgver in exttestedwith:
-                fm.plain('\n')
             else:
                 lasttestedversion = exttestedwith[-1]
                 fm.plain(' (%s!)\n' % lasttestedversion)
@@ -2424,9 +2423,9 @@  def debugextensions(ui, **opts):
             fm.plain(_('  bundled: %s\n') % ['no', 'yes'][isinternal])
         fm.data(bundled=isinternal)
 
-        fm.condwrite(ui.verbose and showtestedwith, 'testedwith',
+        fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
                      _('  tested with: %s\n'),
-                     fm.formatlist(showtestedwith, name='ver'))
+                     fm.formatlist(exttestedwith, name='ver'))
 
         fm.condwrite(ui.verbose and extbuglink, 'buglink',
                  _('  bug reporting: %s\n'), extbuglink or "")
diff --git a/tests/test-debugextensions.t b/tests/test-debugextensions.t
--- a/tests/test-debugextensions.t
+++ b/tests/test-debugextensions.t
@@ -33,7 +33,6 @@ 
   color
     location: */hgext/color.py* (glob)
     bundled: yes
-    tested with: internal
   ext1
     location: */extwithoutinfos.py* (glob)
     bundled: no
@@ -45,19 +44,15 @@ 
   histedit
     location: */hgext/histedit.py* (glob)
     bundled: yes
-    tested with: internal
   mq
     location: */hgext/mq.py* (glob)
     bundled: yes
-    tested with: internal
   patchbomb
     location: */hgext/patchbomb.py* (glob)
     bundled: yes
-    tested with: internal
   rebase
     location: */hgext/rebase.py* (glob)
     bundled: yes
-    tested with: internal
 
   $ hg debugextensions -Tjson | sed 's|\\\\|/|g'
   [
@@ -66,7 +61,7 @@ 
     "bundled": true,
     "name": "color",
     "source": "*/hgext/color.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": []
    },
    {
     "buglink": "",
@@ -87,28 +82,28 @@ 
     "bundled": true,
     "name": "histedit",
     "source": "*/hgext/histedit.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": []
    },
    {
     "buglink": "",
     "bundled": true,
     "name": "mq",
     "source": "*/hgext/mq.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": []
    },
    {
     "buglink": "",
     "bundled": true,
     "name": "patchbomb",
     "source": "*/hgext/patchbomb.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": []
    },
    {
     "buglink": "",
     "bundled": true,
     "name": "rebase",
     "source": "*/hgext/rebase.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": []
    }
   ]