Patchwork [06,of,11,STABLE] tests: use "sh -c 'script'" style to evaluate "$HG_ARGS" correctly anywhere

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Oct. 20, 2014, 1:27 p.m.
Message ID <e5555e390871e982270f.1413811620@juju>
Download mbox | patch
Permalink /patch/6420/
State Changes Requested
Headers show

Comments

Katsunori FUJIWARA - Oct. 20, 2014, 1:27 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1413810488 -32400
#      Mon Oct 20 22:08:08 2014 +0900
# Branch stable
# Node ID e5555e390871e982270f94cd62bfd771faa97f0b
# Parent  da9791c9eb40fc5f2fdb89b97b487e80dcd1a04d
tests: use "sh -c 'script'" style to evaluate "$HG_ARGS" correctly anywhere

Before this patch, a part of "test-alias.t" fails unexpectedly on
Windows environment, because "cmd.exe" can't evaluate "$HG_ARGS"
expression in shell alias.

This patch uses "sh -c 'script'" style to evaluate "$HG_ARGS"
expression correctly anywhere.
Mads Kiilerich - Oct. 20, 2014, 2:04 p.m.
On 10/20/2014 03:27 PM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1413810488 -32400
> #      Mon Oct 20 22:08:08 2014 +0900
> # Branch stable
> # Node ID e5555e390871e982270f94cd62bfd771faa97f0b
> # Parent  da9791c9eb40fc5f2fdb89b97b487e80dcd1a04d
> tests: use "sh -c 'script'" style to evaluate "$HG_ARGS" correctly anywhere
>
> Before this patch, a part of "test-alias.t" fails unexpectedly on
> Windows environment, because "cmd.exe" can't evaluate "$HG_ARGS"
> expression in shell alias.
>
> This patch uses "sh -c 'script'" style to evaluate "$HG_ARGS"
> expression correctly anywhere.
>
> diff --git a/tests/test-alias.t b/tests/test-alias.t
> --- a/tests/test-alias.t
> +++ b/tests/test-alias.t
> @@ -395,7 +395,7 @@ command provided extension, should be ab
>     > [extensions]
>     > hgext.rebase =
>     > [alias]
> -  > rebate = !echo this is \$HG_ARGS
> +  > rebate = !bash -c 'echo this is \$HG_ARGS'

We do (unfortunately) not depend on bash.

It would perhaps be more "correct" to test that native shell syntax 
works and use %HG_ARGS% when on windows.

I guess this also means that the help for config.alias is incorrect. It 
is not ' "$HG" expands to ' but more like ' the HG environment variable 
is set to '.

/Mads
Katsunori FUJIWARA - Oct. 23, 2014, 5:53 p.m.
At Mon, 20 Oct 2014 16:04:47 +0200,
Mads Kiilerich wrote:
> 
> On 10/20/2014 03:27 PM, FUJIWARA Katsunori wrote:
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> > # Date 1413810488 -32400
> > #      Mon Oct 20 22:08:08 2014 +0900
> > # Branch stable
> > # Node ID e5555e390871e982270f94cd62bfd771faa97f0b
> > # Parent  da9791c9eb40fc5f2fdb89b97b487e80dcd1a04d
> > tests: use "sh -c 'script'" style to evaluate "$HG_ARGS" correctly anywhere
> >
> > Before this patch, a part of "test-alias.t" fails unexpectedly on
> > Windows environment, because "cmd.exe" can't evaluate "$HG_ARGS"
> > expression in shell alias.
> >
> > This patch uses "sh -c 'script'" style to evaluate "$HG_ARGS"
> > expression correctly anywhere.
> >
> > diff --git a/tests/test-alias.t b/tests/test-alias.t
> > --- a/tests/test-alias.t
> > +++ b/tests/test-alias.t
> > @@ -395,7 +395,7 @@ command provided extension, should be ab
> >     > [extensions]
> >     > hgext.rebase =
> >     > [alias]
> > -  > rebate = !echo this is \$HG_ARGS
> > +  > rebate = !bash -c 'echo this is \$HG_ARGS'
> 
> We do (unfortunately) not depend on bash.
> 
> It would perhaps be more "correct" to test that native shell syntax 
> works and use %HG_ARGS% when on windows.

I'll send revised one.


> I guess this also means that the help for config.alias is incorrect. It 
> is not ' "$HG" expands to ' but more like ' the HG environment variable 
> is set to '.

What about the notation "$FOO" instead of "environment variable FOO"
in other help document ? Should we also replace them for
understand-ability of users (especially on Windows) ?

Of course, we should replace them after this code freeze period,
because this may cause trivial mistakes in changes and/or overwork of
translators in a short period, even if it is useful :-)


> /Mads
> 
> 

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy@lares.dti.ne.jp

Patch

diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -395,7 +395,7 @@  command provided extension, should be ab
   > [extensions]
   > hgext.rebase =
   > [alias]
-  > rebate = !echo this is \$HG_ARGS
+  > rebate = !bash -c 'echo this is \$HG_ARGS'
   > EOF
   $ hg reba
   hg: command 'reba' is ambiguous: