[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: Philip Martin <philip.martin_at_wandisco.com>
Date: Mon, 16 Jan 2012 10:34:26 +0000

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);
 

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com
Received on 2012-01-16 11:35:05 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.