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

Re: [patch] applying patch can fail with dry_run

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Mon, 16 Jan 2012 21:47:21 +0100

On 16.01.2012 11:34, Philip Martin wrote:
> Philip Martin<philip.martin_at_wandisco.com> writes:
>
>> Now I can reproduce the error.
>
> So the problem occurs when we have a patch file with one item that adds
> two levels of directories and another item that deletes a file:
>
> Index: wc/A/B/f
> ===================================================================
> --- wc/A/B/f (revision 0)
> +++ wc/A/B/f (working copy)
> @@ -0,0 +1 @@
> +foo
> Index: wc/f
> ===================================================================
> --- wc/f (revision 1)
> +++ wc/f (working copy)
> @@ -1 +0,0 @@
> -5
>
> $ svn patch --dry-run --strip 1 x.x wc
> A wc/A
> A wc/A/B
> A wc/A/B/f
> D wc/f
> svn: E155010: The node '/home/pm/sw/subversion/obj/wc/A' was not found.
>
>
> The following appears to work:
>
> Index: subversion/libsvn_client/patch.c
> ===================================================================
> --- subversion/libsvn_client/patch.c (revision 1231875)
> +++ subversion/libsvn_client/patch.c (working copy)
> @@ -2718,7 +2718,7 @@
> empty_dirs = apr_hash_make(scratch_pool);
> non_empty_dirs = apr_hash_make(scratch_pool);
> iterpool = svn_pool_create(scratch_pool);
> - for (i = 0; i< targets_info->nelts; i++)
> + for (i = 0; i< deleted_targets->nelts; i++)
> {
> svn_boolean_t parent_empty;
> patch_target_info_t *target_info;
> @@ -2729,7 +2729,7 @@
> if (ctx->cancel_func)
> SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
>
> - target_info = APR_ARRAY_IDX(targets_info, i, patch_target_info_t *);
> + target_info = APR_ARRAY_IDX(deleted_targets, i, patch_target_info_t *);
>
> parent = svn_dirent_dirname(target_info->local_abspath, iterpool);
>

Confirmed. This works.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
Received on 2012-01-16 21:47:57 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.