You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Sperling <st...@elego.de> on 2010/06/07 13:33:16 UTC

Re: svn commit: r952205 - /subversion/trunk/subversion/libsvn_client/diff.c

On Mon, Jun 07, 2010 at 12:43:19PM -0000, dannas@apache.org wrote:
> Author: dannas
> Date: Mon Jun  7 12:43:19 2010
> New Revision: 952205
> 
> URL: http://svn.apache.org/viewvc?rev=952205&view=rev
> Log:
> Use several smaller functions for printing git diff headers instead of one.
> 
> * subversion/libsvn_client/diff.c
>   (print_git_diff_header): Split this one into ...
>   (print_git_diff_header_added): ..this ...
>   (print_git_diff_header_deleted): .. and this ...
>   (print_git_diff_header_copied): .. and this ...
>   (print_git_diff_header_moved): .. and this ...
>   (print_git_diff_header_modified): .. and this.
>   (diff_content_changed): Adjust caller.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_client/diff.c

> +/*
> + * Print a git diff header for PATH to the stream OS using HEADER_ENCODING.
> + * COPYFROM_PATH is the origin of the operation.  All allocations are done
> + * in RESULT_POOL. */
> +static svn_error_t *
> +print_git_diff_header_copied(svn_stream_t *os, const char *header_encoding, 
> +                             const char *path, const char *copyfrom_path,
> +                             apr_pool_t *result_pool)
> +{
> +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> +                                      "diff --git a/%s b/%s%s",
> +                                      copyfrom_path, path, APR_EOL_STR));
> +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> +                                      "copy from %s%s", path, APR_EOL_STR));
                                               ^^^^       ^^^^^
> +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> +                                      "copy to %s%s", copyfrom_path, 
                                              ^^^            ^^^^
> +                                      APR_EOL_STR));

Shouldn't the copyfrom_path be printed for copy from, and the path for
copy to?

> +  return SVN_NO_ERROR;
> +}
> +
> +/*
> + * Print a git diff header for PATH to the stream OS using HEADER_ENCODING.
> + * COPYFROM_PATH is the origin of the operation.  All allocations are done
> + * in RESULT_POOL. */
> +static svn_error_t *
> +print_git_diff_header_moved(svn_stream_t *os, const char *header_encoding,
> +                            const char *path, const char *copyfrom_path,
> +                            apr_pool_t *result_pool)
> +{
> +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> +                                      "diff --git a/%s b/%s%s",
> +                                      copyfrom_path, path, APR_EOL_STR));
> +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> +                                      "rename from %s%s", path, 
> +                                      APR_EOL_STR));
> +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> +                                      "rename to %s%s", copyfrom_path, 
> +                                      APR_EOL_STR));

Same here.

Stefan

Re: svn commit: r952205 - /subversion/trunk/subversion/libsvn_client/diff.c

Posted by Daniel Näslund <da...@longitudo.com>.
On Mon, Jun 07, 2010 at 03:33:16PM +0200, Stefan Sperling wrote:
> On Mon, Jun 07, 2010 at 12:43:19PM -0000, dannas@apache.org wrote:
> > +static svn_error_t *
> > +print_git_diff_header_copied(svn_stream_t *os, const char *header_encoding, 
> > +                             const char *path, const char *copyfrom_path,
> > +                             apr_pool_t *result_pool)
> > +{
> > +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> > +                                      "diff --git a/%s b/%s%s",
> > +                                      copyfrom_path, path, APR_EOL_STR));
> > +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> > +                                      "copy from %s%s", path, APR_EOL_STR));
>                                                ^^^^       ^^^^^
> > +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> > +                                      "copy to %s%s", copyfrom_path, 
>                                               ^^^            ^^^^
> > +                                      APR_EOL_STR));
> 
> Shouldn't the copyfrom_path be printed for copy from, and the path for
> copy to?
> 
> > +static svn_error_t *
> > +print_git_diff_header_moved(svn_stream_t *os, const char *header_encoding,
> > +                            const char *path, const char *copyfrom_path,
> > +                            apr_pool_t *result_pool)
> > +{
> > +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> > +                                      "diff --git a/%s b/%s%s",
> > +                                      copyfrom_path, path, APR_EOL_STR));
> > +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> > +                                      "rename from %s%s", path, 
> > +                                      APR_EOL_STR));
> > +  SVN_ERR(svn_stream_printf_from_utf8(os, header_encoding, result_pool,
> > +                                      "rename to %s%s", copyfrom_path, 
> > +                                      APR_EOL_STR));
> 
> Same here.

Doh, fixed in r952344.

Thanks,
Daniel