[PATCH STABLE] test-mq: fix sed call on OSX

Patrick Mézard pmezard at gmail.com
Fri Feb 3 19:23:24 UTC 2012


Le 03/02/12 20:08, Christian Ebert a écrit :
> * Patrick Mezard on Friday, February 03, 2012 at 19:45:29 +0100
>> # HG changeset patch
>> # User Patrick Mezard <pmezard at gmail.com>
>> # Date 1328293393 -3600
>> # Branch stable
>> # Node ID 3b9c18ed998553ab19321e1c8b852fa6b76eac13
>> # Parent  0620421044a2bcaafd054a6ee454614888699de8
>> test-mq: fix sed call on OSX
>>
>> - The regular sed on OSX wants: -i "" not -i""
>> - GNU sed wants: -i"" not -i ""
>>
>> Backups are fine.
> 
> With heredoc syntax the sed call can be avoided althogether:
> 
> diff --git a/tests/test-mq.t b/tests/test-mq.t
> --- a/tests/test-mq.t
> +++ b/tests/test-mq.t
> @@ -1476,7 +1476,10 @@
>  
>  Test that qfinish preserve phase when mq.secret=false
>  
> -  $ sed -i'' $HGRCPATH -e 's/secret=true/secret=false/'
> +  >>> import os
> +  >>> hgrcpath = os.getenv('HGRCPATH')
> +  >>> text = open(hgrcpath).read()
> +  >>> open(hgrcpath, 'w').write(text.replace('secret=true', 'secret=false'))
>    $ hg qfinish qbase
>    patch add-file2 finalized without changeset message
>    $ hg phase 'all()'

Hey thanks, I was not aware run-test.py supported this. I considered using inline python with -c, but honestly... backups are fine.

--
Patrick Mézard



More information about the Mercurial-devel mailing list