Patchwork [2,of,3] debugextensions: show raw testedwith value (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 30, 2016, 3:10 p.m.
Message ID <8bae198823d55c18e640.1472569813@mimosa>
Download mbox | patch
Permalink /patch/16481/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 30, 2016, 3:10 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1472221877 -32400
#      Fri Aug 26 23:31:17 2016 +0900
# Node ID 8bae198823d55c18e640f22df8c8ef89f50fd998
# Parent  4c32b2f6aa852fc6260d63bb359d6b2129b8bede
debugextensions: show raw testedwith value (BC)

Otherwise we would see no difference between "internal" liar and real
"ships-with-hg-core".

This is a debug command. There would be no need to keep backward compatibility.
Augie Fackler - Aug. 30, 2016, 9:32 p.m.
On Wed, Aug 31, 2016 at 12:10:13AM +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 8bae198823d55c18e640f22df8c8ef89f50fd998
> # Parent  4c32b2f6aa852fc6260d63bb359d6b2129b8bede
> debugextensions: show raw testedwith value (BC)
>
> Otherwise we would see no difference between "internal" liar and real
> "ships-with-hg-core".

I did this on purpose, so that the shown-to-users string wouldn't be
the magic string we actually care about. We could change it from
"internal" to something else that still isn't the magic string
though...

>
> This is a debug command. There would be no need to keep backward compatibility.

Agreed.

>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2397,10 +2397,6 @@ def debugextensions(ui, **opts):
>          isinternal = extensions.ismoduleinternal(extmod)
>          extsource = extmod.__file__
>          exttestedwith = getattr(extmod, 'testedwith', '').split()
> -        if isinternal:
> -            showtestedwith = ['internal']
> -        else:
> -            showtestedwith = exttestedwith
>          extbuglink = getattr(extmod, 'buglink', None)
>
>          fm.startitem()
> @@ -2420,9 +2416,9 @@ def debugextensions(ui, **opts):
>          fm.condwrite(ui.verbose and extsource, 'source',
>                   _('  location: %s\n'), extsource or "")
>
> -        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
> @@ -26,21 +26,21 @@
>    $ hg debugextensions -v
>    color
>      location: */hgext/color.py* (glob)
> -    tested with: internal
> +    tested with: ships-with-hg-core
>    ext1
>      location: */extwithoutinfos.py* (glob)
>    histedit
>      location: */hgext/histedit.py* (glob)
> -    tested with: internal
> +    tested with: ships-with-hg-core
>    mq
>      location: */hgext/mq.py* (glob)
> -    tested with: internal
> +    tested with: ships-with-hg-core
>    patchbomb
>      location: */hgext/patchbomb.py* (glob)
> -    tested with: internal
> +    tested with: ships-with-hg-core
>    rebase
>      location: */hgext/rebase.py* (glob)
> -    tested with: internal
> +    tested with: ships-with-hg-core
>
>    $ hg debugextensions -Tjson | sed 's|\\\\|/|g'
>    [
> @@ -48,7 +48,7 @@
>      "buglink": "",
>      "name": "color",
>      "source": "*/hgext/color.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": ["ships-with-hg-core"]
>     },
>     {
>      "buglink": "",
> @@ -60,27 +60,28 @@
>      "buglink": "",
>      "name": "histedit",
>      "source": "*/hgext/histedit.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": ["ships-with-hg-core"]
>     },
>     {
>      "buglink": "",
>      "name": "mq",
>      "source": "*/hgext/mq.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": ["ships-with-hg-core"]
>     },
>     {
>      "buglink": "",
>      "name": "patchbomb",
>      "source": "*/hgext/patchbomb.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": ["ships-with-hg-core"]
>     },
>     {
>      "buglink": "",
>      "name": "rebase",
>      "source": "*/hgext/rebase.py*", (glob)
> -    "testedwith": ["internal"]
> +    "testedwith": ["ships-with-hg-core"]
>     }
>    ]
>
> -  $ hg debugextensions -T '{ifcontains("internal", testedwith, "", "{name}\n")}'
> +  $ hg debugextensions \
> +  > -T '{ifcontains("ships-with-hg-core", testedwith, "", "{name}\n")}'
>    ext1
> _______________________________________________
> 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
@@ -2397,10 +2397,6 @@  def debugextensions(ui, **opts):
         isinternal = extensions.ismoduleinternal(extmod)
         extsource = extmod.__file__
         exttestedwith = getattr(extmod, 'testedwith', '').split()
-        if isinternal:
-            showtestedwith = ['internal']
-        else:
-            showtestedwith = exttestedwith
         extbuglink = getattr(extmod, 'buglink', None)
 
         fm.startitem()
@@ -2420,9 +2416,9 @@  def debugextensions(ui, **opts):
         fm.condwrite(ui.verbose and extsource, 'source',
                  _('  location: %s\n'), extsource or "")
 
-        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
@@ -26,21 +26,21 @@ 
   $ hg debugextensions -v
   color
     location: */hgext/color.py* (glob)
-    tested with: internal
+    tested with: ships-with-hg-core
   ext1
     location: */extwithoutinfos.py* (glob)
   histedit
     location: */hgext/histedit.py* (glob)
-    tested with: internal
+    tested with: ships-with-hg-core
   mq
     location: */hgext/mq.py* (glob)
-    tested with: internal
+    tested with: ships-with-hg-core
   patchbomb
     location: */hgext/patchbomb.py* (glob)
-    tested with: internal
+    tested with: ships-with-hg-core
   rebase
     location: */hgext/rebase.py* (glob)
-    tested with: internal
+    tested with: ships-with-hg-core
 
   $ hg debugextensions -Tjson | sed 's|\\\\|/|g'
   [
@@ -48,7 +48,7 @@ 
     "buglink": "",
     "name": "color",
     "source": "*/hgext/color.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": ["ships-with-hg-core"]
    },
    {
     "buglink": "",
@@ -60,27 +60,28 @@ 
     "buglink": "",
     "name": "histedit",
     "source": "*/hgext/histedit.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": ["ships-with-hg-core"]
    },
    {
     "buglink": "",
     "name": "mq",
     "source": "*/hgext/mq.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": ["ships-with-hg-core"]
    },
    {
     "buglink": "",
     "name": "patchbomb",
     "source": "*/hgext/patchbomb.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": ["ships-with-hg-core"]
    },
    {
     "buglink": "",
     "name": "rebase",
     "source": "*/hgext/rebase.py*", (glob)
-    "testedwith": ["internal"]
+    "testedwith": ["ships-with-hg-core"]
    }
   ]
 
-  $ hg debugextensions -T '{ifcontains("internal", testedwith, "", "{name}\n")}'
+  $ hg debugextensions \
+  > -T '{ifcontains("ships-with-hg-core", testedwith, "", "{name}\n")}'
   ext1