You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/06/19 20:26:30 UTC

svn commit: r1351792 - in /subversion/trunk/subversion: libsvn_client/merge.c tests/cmdline/merge_tests.py

Author: stsp
Date: Tue Jun 19 18:26:30 2012
New Revision: 1351792

URL: http://svn.apache.org/viewvc?rev=1351792&view=rev
Log:
Teach 'svn merge' to invoke the interactive conflict resolution callback
after the merge, not during the merge.

As with update (see r1350795), this change currently affects users of 1.7
and above APIs only.

* subversion/libsvn_client/merge.c
  (merge_locked, merge_peg_locked, do_symmetric_merge_locked): Do not invoke
   the conflict callback during the merge, but run let the resolver invoke
   it after the merge is complete.

* subversion/tests/cmdline/merge_tests.py
  (merge_automatic_conflict_resolution): Adjust expected output. During the
   merge, all conflicts now appear as 'C' but --accept options result in
   the expected on-disk state.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/tests/cmdline/merge_tests.py

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1351792&r1=1351791&r2=1351792&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Jun 19 18:26:30 2012
@@ -9545,6 +9545,10 @@ merge_locked(const char *source1,
   svn_client__pathrev_t *yca = NULL;
   apr_pool_t *sesspool;
   svn_boolean_t same_repos;
+  /* Resolve conflicts post-update for 1.7 and above API users. */
+  svn_boolean_t resolve_conflicts_post_update = (ctx->conflict_func2 != NULL);
+  svn_wc_conflict_resolver_func2_t conflict_func2;
+  void *conflict_baton2;
 
   /* ### FIXME: This function really ought to do a history check on
      the left and right sides of the merge source, and -- if one is an
@@ -9581,6 +9585,16 @@ merge_locked(const char *source1,
                     &yca, source1_loc, source2_loc, ra_session1, ctx,
                     scratch_pool, scratch_pool));
 
+  if (resolve_conflicts_post_update)
+    {
+      /* Remove the conflict resolution callback from the client context.
+       * We invoke it after of the merge instead of during the merge. */
+      conflict_func2 = ctx->conflict_func2;
+      conflict_baton2 = ctx->conflict_baton2;
+      ctx->conflict_func2 = NULL;
+      ctx->conflict_baton2 = NULL;
+    }
+
   /* Check for a youngest common ancestor.  If we have one, we'll be
      doing merge tracking.
 
@@ -9683,6 +9697,21 @@ merge_locked(const char *source1,
   if (err)
     return svn_error_trace(err);
 
+  if (resolve_conflicts_post_update)
+    {
+      /* Resolve conflicts within the merge target. */
+      SVN_ERR(svn_wc__resolve_conflicts(ctx->wc_ctx, target_abspath,
+                                        depth,
+                                        TRUE /* resolve_text */,
+                                        "" /* resolve_prop (ALL props) */,
+                                        TRUE /* resolve_tree */,
+                                        svn_wc_conflict_choose_unspecified,
+                                        conflict_func2, conflict_baton2,
+                                        ctx->cancel_func, ctx->cancel_baton,
+                                        ctx->notify_func2, ctx->notify_baton2,
+                                        scratch_pool));
+    }
+
   return SVN_NO_ERROR;
 }
 
@@ -10943,6 +10972,10 @@ merge_peg_locked(const char *source_path
   svn_boolean_t use_sleep = FALSE;
   svn_error_t *err;
   svn_boolean_t same_repos;
+  /* Resolve conflicts post-update for 1.7 and above API users. */
+  svn_boolean_t resolve_conflicts_post_update = (ctx->conflict_func2 != NULL);
+  svn_wc_conflict_resolver_func2_t conflict_func2;
+  void *conflict_baton2;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(target_abspath));
 
@@ -10967,6 +11000,16 @@ merge_peg_locked(const char *source_path
   /* Check for same_repos. */
   same_repos = is_same_repos(&target->loc, source_loc, TRUE /* strict_urls */);
 
+  if (resolve_conflicts_post_update)
+    {
+      /* Remove the conflict resolution callback from the client context.
+       * We invoke it after of the merge instead of during the merge. */
+      conflict_func2 = ctx->conflict_func2;
+      conflict_baton2 = ctx->conflict_baton2;
+      ctx->conflict_func2 = NULL;
+      ctx->conflict_baton2 = NULL;
+    }
+
   /* Do the real merge!  (We say with confidence that our merge
      sources are both ancestral and related.) */
   err = do_merge(NULL, NULL, merge_sources, target, ra_session,
@@ -10980,6 +11023,21 @@ merge_peg_locked(const char *source_path
   /* We're done with our RA session. */
   svn_pool_destroy(sesspool);
 
+  if (resolve_conflicts_post_update)
+    {
+      /* Resolve conflicts within the merge target. */
+      SVN_ERR(svn_wc__resolve_conflicts(ctx->wc_ctx, target_abspath,
+                                        depth,
+                                        TRUE /* resolve_text */,
+                                        "" /* resolve_prop (ALL props) */,
+                                        TRUE /* resolve_tree */,
+                                        svn_wc_conflict_choose_unspecified,
+                                        conflict_func2, conflict_baton2,
+                                        ctx->cancel_func, ctx->cancel_baton,
+                                        ctx->notify_func2, ctx->notify_baton2,
+                                        scratch_pool));
+    }
+
   return svn_error_trace(err);
 }
 
@@ -11573,10 +11631,24 @@ do_symmetric_merge_locked(const svn_clie
   merge_target_t *target;
   svn_boolean_t use_sleep = FALSE;
   svn_error_t *err;
+  /* Resolve conflicts post-update for 1.7 and above API users. */
+  svn_boolean_t resolve_conflicts_post_update = (ctx->conflict_func2 != NULL);
+  svn_wc_conflict_resolver_func2_t conflict_func2;
+  void *conflict_baton2;
 
   SVN_ERR(open_target_wc(&target, target_abspath, TRUE, TRUE, TRUE,
                          ctx, scratch_pool, scratch_pool));
 
+  if (resolve_conflicts_post_update)
+    {
+      /* Remove the conflict resolution callback from the client context.
+       * We invoke it after of the merge instead of during the merge. */
+      conflict_func2 = ctx->conflict_func2;
+      conflict_baton2 = ctx->conflict_baton2;
+      ctx->conflict_func2 = NULL;
+      ctx->conflict_baton2 = NULL;
+    }
+
   if (merge->mid)
     {
       merge_source_t source = { merge->base, merge->right,
@@ -11627,6 +11699,21 @@ do_symmetric_merge_locked(const svn_clie
 
   SVN_ERR(err);
 
+  if (resolve_conflicts_post_update)
+    {
+      /* Resolve conflicts within the merge target. */
+      SVN_ERR(svn_wc__resolve_conflicts(ctx->wc_ctx, target_abspath,
+                                        depth,
+                                        TRUE /* resolve_text */,
+                                        "" /* resolve_prop (ALL props) */,
+                                        TRUE /* resolve_tree */,
+                                        svn_wc_conflict_choose_unspecified,
+                                        conflict_func2, conflict_baton2,
+                                        ctx->cancel_func, ctx->cancel_baton,
+                                        ctx->notify_func2, ctx->notify_baton2,
+                                        scratch_pool));
+    }
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1351792&r1=1351791&r2=1351792&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Tue Jun 19 18:26:30 2012
@@ -15216,7 +15216,7 @@ def merge_automatic_conflict_resolution(
                                      'revert', '--recursive', wc_dir)
 
   # Test --accept mine-conflict and mine-full
-  expected_output = wc.State(A_COPY_path, {'D/H/psi' : Item(status='U ')})
+  expected_output = wc.State(A_COPY_path, {'D/H/psi' : Item(status='C ')})
   expected_disk.tweak('D/H/psi', contents="BASE.\n")
   expected_status.tweak('D/H/psi', status='  ')
   svntest.actions.run_and_verify_merge(A_COPY_path, '2', '3',
@@ -15251,7 +15251,7 @@ def merge_automatic_conflict_resolution(
                                      'revert', '--recursive', wc_dir)
 
   # Test --accept theirs-conflict and theirs-full
-  expected_output = wc.State(A_COPY_path, {'D/H/psi' : Item(status='U ')})
+  expected_output = wc.State(A_COPY_path, {'D/H/psi' : Item(status='C ')})
   expected_disk.tweak('D/H/psi', contents="New content")
   expected_status.tweak('D/H/psi', status='M ')
   svntest.actions.run_and_verify_merge(A_COPY_path, '2', '3',
@@ -15285,7 +15285,7 @@ def merge_automatic_conflict_resolution(
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'revert', '--recursive', wc_dir)
   # Test --accept base
-  expected_output = wc.State(A_COPY_path, {'D/H/psi' : Item(status='U ')})
+  expected_output = wc.State(A_COPY_path, {'D/H/psi' : Item(status='C ')})
   expected_elision_output = wc.State(A_COPY_path, {
     })
   expected_disk.tweak('D/H/psi', contents="This is the file 'psi'.\n")



Re: svn commit: r1351792 - in /subversion/trunk/subversion: libsvn_client/merge.c tests/cmdline/merge_tests.py

Posted by Stefan Sperling <st...@elego.de>.
On Mon, Jun 25, 2012 at 08:00:03PM -0400, Greg Stein wrote:
> On Tue, Jun 19, 2012 at 2:26 PM,  <st...@apache.org> wrote:
> > Author: stsp
> > Date: Tue Jun 19 18:26:30 2012
> > New Revision: 1351792
> >
> > URL: http://svn.apache.org/viewvc?rev=1351792&view=rev
> > Log:
> > Teach 'svn merge' to invoke the interactive conflict resolution callback
> > after the merge, not during the merge.
> 
> Don't forget these changes, too...
> 
> Thanks
> -g

Yup, they're on my list.

Re: svn commit: r1351792 - in /subversion/trunk/subversion: libsvn_client/merge.c tests/cmdline/merge_tests.py

Posted by Greg Stein <gs...@gmail.com>.
On Tue, Jun 19, 2012 at 2:26 PM,  <st...@apache.org> wrote:
> Author: stsp
> Date: Tue Jun 19 18:26:30 2012
> New Revision: 1351792
>
> URL: http://svn.apache.org/viewvc?rev=1351792&view=rev
> Log:
> Teach 'svn merge' to invoke the interactive conflict resolution callback
> after the merge, not during the merge.

Don't forget these changes, too...

Thanks
-g