Porting test-tag.t

Mads Kiilerich mads at kiilerich.com
Fri Jun 1 12:38:54 CDT 2012


On 01/06/12 18:59, Adrian Buehlmann wrote:
> I've been trying to port test-tag.t for testing with MSYS on Windows, but failed so far.
>
> The closest thing I got half-way working for now is:
>
> diff --git a/tests/test-tag.t b/tests/test-tag.t
> --- a/tests/test-tag.t
> +++ b/tests/test-tag.t
> @@ -1,5 +1,3 @@
> -  $ "$TESTDIR/hghave" system-sh || exit 80
> -
>     $ hg init test
>     $ cd test
>
> @@ -219,8 +217,7 @@
>     >  echo "custom tag message">  "$1"
>     >  echo "second line">>  "$1"
>     >  __EOF__
> -  $ chmod +x editor
> -  $ HGEDITOR="'`pwd`'"/editor hg tag custom-tag -e
> +  $ HGEDITOR="sh editor" hg tag custom-tag -e

(For stability we might want to preserve the path to 'editor' so it can 
be used from any working directory. The editor pattern shows up in 
several places, so it would perhaps be simpler to include a shared 
support tool in the test suite - just like printenv.)

>     $ hg log -l1 --template "{desc}\n"
>     custom tag message
>     second line
> @@ -305,7 +302,7 @@
>
>     $ hg init repo-tag
>     $ hg init repo-tag-target
> -  $ hg -R repo-tag --config hooks.commit="hg push \"`pwd`/repo-tag-target\"" tag tag
> +  $ hg -R repo-tag --config hooks.commit="hg push \"$TESTTMP/repo-tag-target\"" tag tag

(That change is not directly related and not necessary. `pwd` is aliased 
to do what we want it to do. Variable expansion is however faster, so it 
is not a bad idea.)

>     pushing to $TESTTMP/repo-tag-target
>     searching for changes
>     adding changesets
>
> which I would expect to work, but it doesn't. I fails with
>
> --- c:\users\adi\hgrepos\hg-main\tests\test-tag.t
> +++ c:\users\adi\hgrepos\hg-main\tests\test-tag.t.err
> @@ -303,10 +303,7 @@
>     $ hg init repo-tag
>     $ hg init repo-tag-target
>     $ hg -R repo-tag --config hooks.commit="hg push \"$TESTTMP/repo-tag-target\"" tag tag
> -  pushing to $TESTTMP/repo-tag-target
> -  searching for changes
> -  adding changesets
> -  adding manifests
> -  adding file changes
> -  added 1 changesets with 1 changes to 1 files
> -
> +  pushing to c;C:\Users\adi\AppData\Local\Temp\hgtests.wbaa4t\test-tag.t\repo-tag-target
> +  abort: repository c;C:\Users\adi\AppData\Local\Temp\hgtests.wbaa4t\test-tag.t\repo-tag-target not found!
> +  warning: commit hook exited with status 255
> +
>
> If I insert a --debug I get:
>
> --- c:\users\adi\hgrepos\hg-main\tests\test-tag.t
> +++ c:\users\adi\hgrepos\hg-main\tests\test-tag.t.err
> @@ -303,10 +303,9 @@
>     $ hg init repo-tag
>     $ hg init repo-tag-target
>     $ hg --debug -R repo-tag --config hooks.commit="hg push \"$TESTTMP/repo-tag-target\"" tag tag
> -  pushing to $TESTTMP/repo-tag-target
> -  searching for changes
> -  adding changesets
> -  adding manifests
> -  adding file changes
> -  added 1 changesets with 1 changes to 1 files
> -
> +  .hgtags
> +  running hook commit: hg push "c;C:\Users\adi\AppData\Local\Temp\hgtests.kwyoh7\test-tag.t\repo-tag-target"
> +  pushing to c;C:\Users\adi\AppData\Local\Temp\hgtests.kwyoh7\test-tag.t\repo-tag-target
> +  abort: repository c;C:\Users\adi\AppData\Local\Temp\hgtests.kwyoh7\test-tag.t\repo-tag-target not found!
> +  warning: commit hook exited with status 255
> +
>
> Right now, I have no idea where this funny "c;" is coming from.

A part of it might come from msys getting something wrong, but I think 
the blame primarily should be put on the hg.exe wrapper.

It seems to work with
    ...commit="python \"$TESTDIR/../hg.py\" push ..."
which I guess is ok for the purpose of this test. It do however reveal 
that there might be a problem when launching python from python.

Using hg.py will fail on non-msys where we don't have hg.py. We could 
perhaps introduce a $HGCMD which could expand to 'hg' or 'python 
"$TESTDIR/../hg.py" '.

The wrapper also interfered when testing hg-ssh - 
http://selenic.com/repo/hg/rev/289fdcd4cb47 . Updating the recipe to use 
timeless' exe wrapper might solve the problem ... or make it possible to 
find a better solution.

/Mads


More information about the Mercurial-devel mailing list