Patchwork [4,of,4] debugextension: change "testedwith" to a list (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 4, 2016, 4:13 p.m.
Message ID <d49c204b998e4ecb4bce.1470327200@mimosa>
Download mbox | patch
Permalink /patch/16090/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 4, 2016, 4:13 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1458433143 25200
#      Sat Mar 19 17:19:03 2016 -0700
# Node ID d49c204b998e4ecb4bce1e113b5ef10fc2182bb2
# Parent  224606acd9ce2da7d1b1bf25c88bafabe5e373c0
debugextension: change "testedwith" to a list (BC)

It wasn't a list since the formatter couldn't process a list. We have no
such problem now and the -T option is experimental, so we can change it.
Augie Fackler - Aug. 4, 2016, 6:16 p.m.
On Fri, Aug 05, 2016 at 01:13:20AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1458433143 25200
> #      Sat Mar 19 17:19:03 2016 -0700
> # Node ID d49c204b998e4ecb4bce1e113b5ef10fc2182bb2
> # Parent  224606acd9ce2da7d1b1bf25c88bafabe5e373c0
> debugextension: change "testedwith" to a list (BC)

Queued, thanks

>
> It wasn't a list since the formatter couldn't process a list. We have no
> such problem now and the -T option is experimental, so we can change it.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2423,7 +2423,8 @@ def debugextensions(ui, **opts):
>                   _('  location: %s\n'), extsource or "")
>
>          fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
> -                 _('  tested with: %s\n'), ' '.join(exttestedwith))
> +                     _('  tested with: %s\n'),
> +                     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
> @@ -48,36 +48,39 @@
>      "buglink": "",
>      "name": "color",
>      "source": "*/hgext/color.py*", (glob)
> -    "testedwith": "internal"
> +    "testedwith": ["internal"]
>     },
>     {
>      "buglink": "",
>      "name": "ext1",
>      "source": "*/extwithoutinfos.py*", (glob)
> -    "testedwith": ""
> +    "testedwith": []
>     },
>     {
>      "buglink": "",
>      "name": "histedit",
>      "source": "*/hgext/histedit.py*", (glob)
> -    "testedwith": "internal"
> +    "testedwith": ["internal"]
>     },
>     {
>      "buglink": "",
>      "name": "mq",
>      "source": "*/hgext/mq.py*", (glob)
> -    "testedwith": "internal"
> +    "testedwith": ["internal"]
>     },
>     {
>      "buglink": "",
>      "name": "patchbomb",
>      "source": "*/hgext/patchbomb.py*", (glob)
> -    "testedwith": "internal"
> +    "testedwith": ["internal"]
>     },
>     {
>      "buglink": "",
>      "name": "rebase",
>      "source": "*/hgext/rebase.py*", (glob)
> -    "testedwith": "internal"
> +    "testedwith": ["internal"]
>     }
>    ]
> +
> +  $ hg debugextensions -T '{ifcontains("internal", 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
@@ -2423,7 +2423,8 @@  def debugextensions(ui, **opts):
                  _('  location: %s\n'), extsource or "")
 
         fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
-                 _('  tested with: %s\n'), ' '.join(exttestedwith))
+                     _('  tested with: %s\n'),
+                     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
@@ -48,36 +48,39 @@ 
     "buglink": "",
     "name": "color",
     "source": "*/hgext/color.py*", (glob)
-    "testedwith": "internal"
+    "testedwith": ["internal"]
    },
    {
     "buglink": "",
     "name": "ext1",
     "source": "*/extwithoutinfos.py*", (glob)
-    "testedwith": ""
+    "testedwith": []
    },
    {
     "buglink": "",
     "name": "histedit",
     "source": "*/hgext/histedit.py*", (glob)
-    "testedwith": "internal"
+    "testedwith": ["internal"]
    },
    {
     "buglink": "",
     "name": "mq",
     "source": "*/hgext/mq.py*", (glob)
-    "testedwith": "internal"
+    "testedwith": ["internal"]
    },
    {
     "buglink": "",
     "name": "patchbomb",
     "source": "*/hgext/patchbomb.py*", (glob)
-    "testedwith": "internal"
+    "testedwith": ["internal"]
    },
    {
     "buglink": "",
     "name": "rebase",
     "source": "*/hgext/rebase.py*", (glob)
-    "testedwith": "internal"
+    "testedwith": ["internal"]
    }
   ]
+
+  $ hg debugextensions -T '{ifcontains("internal", testedwith, "", "{name}\n")}'
+  ext1