[PATCH] test-repair-strip: Don't rely on cat error message

Martin Geisler mg at lazybytes.net
Tue Jul 7 08:11:09 CDT 2009


Christian Ebert <blacktrash at gmx.net> writes:

> * Mads Kiilerich on Sunday, July 05, 2009 at 11:20:25 -0000
>> # HG changeset patch
>> # User Mads Kiilerich <mads at kiilerich.com>
>> # Date 1246792294 -7200
>> # Node ID f615ad3622abcccb5d9e60a5f7d112e65767c832
>> # Parent  a232b90ffb5110aeae75ff7ebf1a530ce8999bfd
>> test-repair-strip: Don't rely on cat error message
>> 
>> diff --git a/tests/test-repair-strip b/tests/test-repair-strip
>> --- a/tests/test-repair-strip
>> +++ b/tests/test-repair-strip
>> @@ -13,7 +13,7 @@
>>     chmod +$3 $4
>>     hg verify
>>     echo % journal contents
>> -    cat .hg/store/journal | sed 's/\.i[^\n]*/\.i/'
>> +    [ -f .hg/store/journal ] && cat .hg/store/journal | sed 's/\.i[^\n]*/\.i/' || echo 'journal not found'
>
> Why not just:
>
>     [ -f .hg/store/journal ] && sed 's/\.i[^\n]*/\.i/' .hg/store/journal || echo 'journal not found'
>
> ?

And why do we even filter the journal through sed if it's not supposed
to be there? Would it not be better to do:

if [ -f .hg/store/journal ]; then
  echo "unexpected journal:"
  cat .hg/store/journal
else
  echo "no journal (as expected)"
fi

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090707/ebe32ca6/attachment.pgp 


More information about the Mercurial-devel mailing list