[PATCH] test-hardlinks: enable for Windows

Adrian Buehlmann adrian at cadifra.com
Mon Jun 11 17:35:37 CDT 2012


On 2012-06-11 20:02, Adrian Buehlmann wrote:
> # HG changeset patch
> # User Adrian Buehlmann <adrian at cadifra.com>
> # Date 1339437445 -7200
> # Node ID fc715b5cbdb2ff940d691da5d4b520ec3d55f911
> # Parent  6ef74c31ef5a5fb86fffbc24d84bfd34c70dbf8e
> test-hardlinks: enable for Windows
> 
> diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t
> --- a/tests/test-hardlinks.t
> +++ b/tests/test-hardlinks.t
> @@ -1,10 +1,9 @@
> -  $ "$TESTDIR/hghave" no-windows || exit 80
> -
>    $ cat > nlinks.py <<EOF
> -  > import os, sys
> +  > import sys
> +  > from mercurial import util
>    > for f in sorted(sys.stdin.readlines()):
>    >     f = f[:-1]
> -  >     print os.lstat(f).st_nlink, f
> +  >     print util.nlinks(f), f
>    > EOF
>  
>    $ nlinksdir()

[..]

> @@ -104,7 +103,10 @@
>  Create a non-inlined filelog in r3:
>  
>    $ cd r3/d1
> -  $ python -c 'for x in range(10000): print x' >> data1
> +  >>> f = open('data1', 'wb')
> +  >>> for x in range(10000):
> +  ...     f.write("%s\n" % str(x))
> +  >>> f.close()
>    $ for j in 0 1 2 3 4 5 6 7 8 9; do
>    >   cat data1 >> f2
>    >   hg commit -m$j
> @@ -133,7 +135,7 @@

I should probably have added an explanation why I did this. The reason
is, that "print" is not portable: it writes CR LF on Windows, but LF on
Linux.

Later on, there is a cset hash in the expected output, so the checked-in
payload needs to be the same on all platforms.

>    $ cd r3
>    $ hg push
> -  pushing to $TESTTMP/r1
> +  pushing to $TESTTMP/r1 (glob)
>    searching for changes
>    adding changesets
>    adding manifests



More information about the Mercurial-devel mailing list