[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1034139 - in /subversion/trunk/subversion: libsvn_client/patch.c tests/cmdline/patch_tests.py

From: Stefan Sperling <stsp_at_elego.de>
Date: Fri, 12 Nov 2010 01:07:53 +0100

On Thu, Nov 11, 2010 at 09:21:26PM -0000, dannas_at_apache.org wrote:
> Author: dannas
> Date: Thu Nov 11 21:21:16 2010
> New Revision: 1034139
>
> URL: http://svn.apache.org/viewvc?rev=1034139&view=rev
> Log:
> Add support for handling symlinks in 'svn patch'.

Nice :)

If you haven't done so, can you close the corresponding issue, too?
Thanks!

One question below:

>
> * subversion/libsvn_client_patch.c
> (patch_target_t): Add 'is_special' field.
> (apply_one_patch): Record the possible presence of a svn:special
> property.
> (install_patched_target): Install symlinks.
>
> * subversion/tests/cmdline/patch_tests.py
> (patch_add_symlink): New.
>
> Modified:
> subversion/trunk/subversion/libsvn_client/patch.c
> subversion/trunk/subversion/tests/cmdline/patch_tests.py
>
> Modified: subversion/trunk/subversion/libsvn_client/patch.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1034139&r1=1034138&r2=1034139&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/patch.c (original)
> +++ subversion/trunk/subversion/libsvn_client/patch.c Thu Nov 11 21:21:16 2010
> @@ -203,6 +203,9 @@ typedef struct patch_target_t {
> /* True if the patch changed any of the properties of the target. */
> svn_boolean_t has_prop_changes;
>
> + /* True if the patch contained a svn:special property. */
> + svn_boolean_t is_special;
> +
> /* All the information that is specific to the content of the target. */
> target_content_info_t *content_info;
>
> @@ -1736,6 +1739,9 @@ apply_one_patch(patch_target_t **patch_t
> prop_name = svn__apr_hash_index_key(hash_index);
> prop_patch = svn__apr_hash_index_val(hash_index);
>
> + if (! strcmp(prop_name, SVN_PROP_SPECIAL))
> + target->is_special = TRUE;
> +
> /* We'll store matched hunks in prop_content_info. */
> prop_target = apr_hash_get(target->prop_targets, prop_name,
> APR_HASH_KEY_STRING);
> @@ -2105,9 +2111,33 @@ install_patched_target(patch_target_t *t
>
> if (! dry_run && ! target->skipped)
> {
> - /* Copy the patched file on top of the target file. */
> - SVN_ERR(svn_io_copy_file(target->patched_path,
> - target->local_abspath, FALSE, pool));
> + if (target->is_special)
> + {
> + svn_stream_t *stream;
> + svn_stream_t *patched_stream;
> + apr_file_t *file;
> +
> + SVN_ERR(svn_io_file_open(&file, target->patched_path,
> + APR_READ | APR_BINARY, APR_OS_DEFAULT,
> + pool));
> +
> + patched_stream = svn_stream_from_aprfile2(file, FALSE /* disown */,
> + pool);
> + SVN_ERR(svn_subst_create_specialfile(&stream,
> + target->local_abspath,
> + pool, pool));
> + SVN_ERR(svn_stream_copy3(patched_stream, stream,
> + NULL, /* cancel_func */
> + NULL, /* cancel_baton */
> + pool));
> + }

What's the effect of the copy? Isn't svn_subst_create_specialfile() enough?

> + else
> + {
> + /* Copy the patched file on top of the target file. */
> + SVN_ERR(svn_io_copy_file(target->patched_path,
> + target->local_abspath, FALSE, pool));
> + }
> +
Received on 2010-11-12 01:08:35 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.