You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/07/13 11:10:23 UTC

svn commit: r1361115 - in /subversion/branches/1.7.x-r1361007: ./ subversion/libsvn_wc/merge.c

Author: rhuijben
Date: Fri Jul 13 09:10:23 2012
New Revision: 1361115

URL: http://svn.apache.org/viewvc?rev=1361115&view=rev
Log:
Merge r1361007 and r1361019 from trunk, resolving conflict

Modified:
    subversion/branches/1.7.x-r1361007/   (props changed)
    subversion/branches/1.7.x-r1361007/subversion/libsvn_wc/merge.c

Propchange: subversion/branches/1.7.x-r1361007/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1361007,1361019

Modified: subversion/branches/1.7.x-r1361007/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-r1361007/subversion/libsvn_wc/merge.c?rev=1361115&r1=1361114&r2=1361115&view=diff
==============================================================================
--- subversion/branches/1.7.x-r1361007/subversion/libsvn_wc/merge.c (original)
+++ subversion/branches/1.7.x-r1361007/subversion/libsvn_wc/merge.c Fri Jul 13 09:10:23 2012
@@ -940,6 +940,8 @@ merge_file_trivial(svn_skel_t **work_ite
                    const char *target_abspath,
                    svn_boolean_t dry_run,
                    svn_wc__db_t *db,
+                   svn_cancel_func_t cancel_func,
+                   void *cancel_baton,
                    apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
 {
@@ -977,6 +979,41 @@ merge_file_trivial(svn_skel_t **work_ite
           *merge_outcome = svn_wc_merge_merged;
           if (!dry_run)
             {
+              const char *wcroot_abspath;
+              svn_boolean_t delete_src = FALSE;
+
+              /* The right_abspath might be outside our working copy. In that
+                 case we should copy the file to a safe location before
+                 installing to avoid breaking the workqueue */
+
+              SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath,
+                                            db, target_abspath,
+                                            scratch_pool, scratch_pool));
+
+              if (!svn_dirent_is_child(wcroot_abspath, right_abspath, NULL))
+                {
+                  svn_stream_t *tmp_src;
+                  svn_stream_t *tmp_dst;
+
+                  SVN_ERR(svn_stream_open_readonly(&tmp_src, right_abspath,
+                                                   scratch_pool,
+                                                   scratch_pool));
+
+                  SVN_ERR(svn_wc__open_writable_base(&tmp_dst, &right_abspath,
+                                                     NULL, NULL,
+                                                     db, target_abspath,
+                                                     scratch_pool,
+                                                     scratch_pool));
+
+                  SVN_ERR(svn_stream_copy3(tmp_src, tmp_dst,
+                                           cancel_func, cancel_baton,
+                                           scratch_pool));
+
+                  /* no need to strdup right_abspath, as the wq_build_()
+                     call already does that for us */
+                  delete_src = TRUE;
+                }
+
               SVN_ERR(svn_wc__wq_build_file_install(
                         &work_item, db, target_abspath, right_abspath,
                         FALSE /* use_commit_times */,
@@ -984,6 +1021,15 @@ merge_file_trivial(svn_skel_t **work_ite
                         result_pool, scratch_pool));
               *work_items = svn_wc__wq_merge(*work_items, work_item,
                                              result_pool);
+
+              if (delete_src)
+                {
+                  SVN_ERR(svn_wc__wq_build_file_remove(
+                                    &work_item, db, right_abspath,
+                                    result_pool, scratch_pool));
+                  *work_items = svn_wc__wq_merge(*work_items, work_item,
+                                                 result_pool);
+                }
             }
         }
 
@@ -1418,6 +1464,7 @@ svn_wc__internal_merge(svn_skel_t **work
   SVN_ERR(merge_file_trivial(work_items, merge_outcome,
                              left_abspath, right_abspath,
                              target_abspath, dry_run, db,
+                             cancel_func, cancel_baton,
                              result_pool, scratch_pool));
   if (*merge_outcome == svn_wc_merge_no_merge)
     {