You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bert Huijben <be...@qqmail.nl> on 2010/04/04 17:33:22 UTC

FW: svn commit: r930702 - /subversion/trunk/subversion/tests/libsvn_client/client-test.c

> -----Original Message-----
> From: rhuijben@apache.org [mailto:rhuijben@apache.org]
> Sent: zondag 4 april 2010 17:31
> To: commits@subversion.apache.org
> Subject: svn commit: r930702 -
> /subversion/trunk/subversion/tests/libsvn_client/client-test.c
> 
> Author: rhuijben
> Date: Sun Apr  4 15:31:09 2010
> New Revision: 930702
> 
> URL: http://svn.apache.org/viewvc?rev=930702&view=rev
> Log:
> Make the patch test in client-test pass on Windows by removing the
> assumption that the to be patched file has platform dependent EOLs. It
> has "\n" as end of line marker on all platforms.

	Stefan or Daniel,

Can one of you (or maybe somebody else) confirm that this is the designed behavior?

Thanks,

	Bert
> 
> * subversion/tests/libsvn_client/client-test.c
>   (check_patch_result): Add eol argument and pass this value to
>     svn_stream_readline.
>   (test_patch): Assume "\n" line endings on the tempfile, but native
>     eols on the reject file.
> 
> Modified:
>     subversion/trunk/subversion/tests/libsvn_client/client-test.c
> 
> Modified: subversion/trunk/subversion/tests/libsvn_client/client-test.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_c
> lient/client-test.c?rev=930702&r1=930701&r2=930702&view=diff
> =======================================================================
> =======
> --- subversion/trunk/subversion/tests/libsvn_client/client-test.c
> (original)
> +++ subversion/trunk/subversion/tests/libsvn_client/client-test.c Sun
> Apr  4 15:31:09 2010
> @@ -206,10 +206,10 @@ test_args_to_target_array(apr_pool_t *po
> 
> 
>  /* A helper function for test_patch().
> - * It compares a patched or reject file against expected content.
> - * It also deletes the file if the check was successful. */
> + * It compares a patched or reject file against expected content using
> the
> + *  specified EOL. It also deletes the file if the check was
> successful. */
>  static svn_error_t *
> -check_patch_result(const char *path, const char **expected_lines,
> +check_patch_result(const char *path, const char **expected_lines,
> const char *eol,
>                     int num_expected_lines, apr_pool_t *pool)
>  {
>    svn_stream_t *stream;
> @@ -226,7 +226,7 @@ check_patch_result(const char *path, con
> 
>        svn_pool_clear(iterpool);
> 
> -      SVN_ERR(svn_stream_readline(stream, &line, APR_EOL_STR, &eof,
> pool));
> +      SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
>        if (i < num_expected_lines)
>          if (strcmp(expected_lines[i++], line->data) != 0)
>            return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
> @@ -357,14 +357,14 @@ test_patch(const svn_test_opts_t *opts,
>    key = "A/D/gamma";
>    patched_tempfile_path = apr_hash_get(patched_tempfiles, key,
>                                         APR_HASH_KEY_STRING);
> -  SVN_ERR(check_patch_result(patched_tempfile_path, expected_gamma,
> +  SVN_ERR(check_patch_result(patched_tempfile_path, expected_gamma,
> "\n",
>                               EXPECTED_GAMMA_LINES, pool));
>    SVN_ERR_ASSERT(apr_hash_count(reject_tempfiles) == 1);
>    key = "A/D/gamma";
>    reject_tempfile_path = apr_hash_get(reject_tempfiles, key,
>                                       APR_HASH_KEY_STRING);
>    SVN_ERR(check_patch_result(reject_tempfile_path,
> expected_gamma_reject,
> -                             EXPECTED_GAMMA_REJECT_LINES, pool));
> +                             APR_EOL_STR, EXPECTED_GAMMA_REJECT_LINES,
> pool));
> 
>    return SVN_NO_ERROR;
>  }
> 



Re: FW: svn commit: r930702 - /subversion/trunk/subversion/tests/libsvn_client/client-test.c

Posted by Stefan Sperling <st...@elego.de>.
On Sun, Apr 04, 2010 at 06:14:49PM +0200, Stefan Sperling wrote:
> I'm not sure why the test ends up writing "\n" EOL terminators on windows.

The reason is probably that all files created in the greek
tree use "\n". Note that the patched_tempfile isn't actually
patched, because the hunk is rejected. So the patched_tempfile
ends up with the same content as A/D/gamma in the greek tree, unmodified.

Stefan

Re: FW: svn commit: r930702 - /subversion/trunk/subversion/tests/libsvn_client/client-test.c

Posted by Stefan Sperling <st...@elego.de>.
On Sun, Apr 04, 2010 at 05:33:22PM +0200, Bert Huijben wrote:
> > -----Original Message-----
> > From: rhuijben@apache.org [mailto:rhuijben@apache.org]
> > Sent: zondag 4 april 2010 17:31
> > To: commits@subversion.apache.org
> > Subject: svn commit: r930702 -
> > /subversion/trunk/subversion/tests/libsvn_client/client-test.c
> > 
> > Author: rhuijben
> > Date: Sun Apr  4 15:31:09 2010
> > New Revision: 930702
> > 
> > URL: http://svn.apache.org/viewvc?rev=930702&view=rev
> > Log:
> > Make the patch test in client-test pass on Windows by removing the
> > assumption that the to be patched file has platform dependent EOLs. It
> > has "\n" as end of line marker on all platforms.
> 
> 	Stefan or Daniel,
> 
> Can one of you (or maybe somebody else) confirm that this is the
> designed behavior?

The designed behaviour is as follows:

Lines of the diff header of reject files are always terminated
with the native EOL-character.
Other lines in the reject diff text are written with whatever
EOL character was found in the patch when the line was read.
I.e. the eol-style in reject files can be mixed.

For patched targets, we use the EOL style dictated by svn:eol-style
for all lines, or if svn:eol-style is not set:

  - if the line we're writing to the patched target comes the patch,
    (this includes lines added by the patch as well as surrounding
    context lines) we use whichever EOL character terminated the line
    in the patch file 
  - else if the line we're writing to the patched target comes from
    the target itself, we use whichever EOL character terminated the line
    in the patch target

Since files created in the greek tree do not have svn:eol-style set,
I would expect both the patched result and the reject diff text to
use APR_EOL_STR platform's EOL style for all lines taken from the patch.
I'm not sure why the test ends up writing "\n" EOL terminators on windows.

Stefan