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/15 23:03:35 UTC
svn commit: r1350795 - in /subversion/trunk/subversion:
libsvn_client/update.c tests/cmdline/update_tests.py
Author: stsp
Date: Fri Jun 15 21:03:35 2012
New Revision: 1350795
URL: http://svn.apache.org/viewvc?rev=1350795&view=rev
Log:
Invoke the interactive conflict resolution callback after an update operation,
instead of during an update operation.
* subversion/libsvn_client/update.c
(svn_client_update4): If the caller passes in a ctx->conflict_func2, remove
it from the context to force postponed conflicts during the update, and
invoke the callback via the conflict resolver after the update has completed.
Behaviour for callers passing a 1.5-style ctx->conflict_func is unchanged
for now because there is currently no way of invoking the resolver with
the old conflict callback type.
* subversion/tests/cmdline/update_tests.py
(update_accept_conflicts): Adjust expected output. Conflicts are now shown
in update output even if auto-resolved via the --accept option.
(eof_in_interactive_conflict_resolver): Adjust expected output/status/disk.
The file 'iota' is now already in conflicted state when the conflict
callback fails because of EOF.
Modified:
subversion/trunk/subversion/libsvn_client/update.c
subversion/trunk/subversion/tests/cmdline/update_tests.py
Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1350795&r1=1350794&r2=1350795&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Fri Jun 15 21:03:35 2012
@@ -565,6 +565,10 @@ svn_client_update4(apr_array_header_t **
apr_pool_t *iterpool = svn_pool_create(pool);
const char *path = NULL;
svn_boolean_t sleep = FALSE;
+ /* 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;
if (result_revs)
*result_revs = apr_array_make(pool, paths->nelts, sizeof(svn_revnum_t));
@@ -578,6 +582,16 @@ svn_client_update4(apr_array_header_t **
_("'%s' is not a local path"), path);
}
+ if (resolve_conflicts_post_update)
+ {
+ /* Remove the conflict resolution callback from the client context.
+ * We invoke it after of the update instead of during the update. */
+ conflict_func2 = ctx->conflict_func2;
+ conflict_baton2 = ctx->conflict_baton2;
+ ctx->conflict_func2 = NULL;
+ ctx->conflict_baton2 = NULL;
+ }
+
for (i = 0; i < paths->nelts; ++i)
{
svn_error_t *err = SVN_NO_ERROR;
@@ -627,5 +641,26 @@ svn_client_update4(apr_array_header_t **
if (sleep)
svn_io_sleep_for_timestamps((paths->nelts == 1) ? path : NULL, pool);
+ if (resolve_conflicts_post_update)
+ {
+ const char *common_abspath;
+
+ /* Resolve conflicts within the updated subtree.
+ * ### This will resolve conflicts which are siblings of paths in
+ * ### the target list but were not part of this update. */
+ SVN_ERR(svn_dirent_condense_targets(&common_abspath, NULL, paths,
+ TRUE, pool, pool));
+ SVN_ERR(svn_wc__resolve_conflicts(ctx->wc_ctx, common_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,
+ pool));
+ }
+
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1350795&r1=1350794&r2=1350795&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Fri Jun 15 21:03:35 2012
@@ -3914,8 +3914,12 @@ def update_accept_conflicts(sbox):
# Accept the pre-update base file.
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (mu_path_backup),
- 'G %s\n' % (mu_path_backup,),
- 'Updated to revision 2.\n'],
+ 'C %s\n' % (mu_path_backup,),
+ 'Updated to revision 2.\n',
+ "Resolved conflicted state of '%s'\n"
+ % (mu_path_backup),
+ 'Summary of conflicts:\n',
+ ' Text conflicts: 1\n'],
[],
'update', '--accept=base',
mu_path_backup)
@@ -3924,8 +3928,12 @@ def update_accept_conflicts(sbox):
# Accept the user's working file.
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (alpha_path_backup),
- 'G %s\n' % (alpha_path_backup,),
- 'Updated to revision 2.\n'],
+ 'C %s\n' % (alpha_path_backup,),
+ 'Updated to revision 2.\n',
+ "Resolved conflicted state of '%s'\n"
+ % (alpha_path_backup),
+ 'Summary of conflicts:\n',
+ ' Text conflicts: 1\n'],
[],
'update', '--accept=mine-full',
alpha_path_backup)
@@ -3934,8 +3942,12 @@ def update_accept_conflicts(sbox):
# Accept their file.
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (beta_path_backup),
- 'G %s\n' % (beta_path_backup,),
- 'Updated to revision 2.\n'],
+ 'C %s\n' % (beta_path_backup,),
+ 'Updated to revision 2.\n',
+ "Resolved conflicted state of '%s'\n"
+ % (beta_path_backup),
+ 'Summary of conflicts:\n',
+ ' Text conflicts: 1\n'],
[],
'update', '--accept=theirs-full',
beta_path_backup)
@@ -3946,8 +3958,12 @@ def update_accept_conflicts(sbox):
# svn to exit with an exit code of 0.
svntest.actions.run_and_verify_svn2(None,
["Updating '%s':\n" % (pi_path_backup),
- 'G %s\n' % (pi_path_backup,),
- 'Updated to revision 2.\n'],
+ 'C %s\n' % (pi_path_backup,),
+ 'Updated to revision 2.\n',
+ "Resolved conflicted state of '%s'\n"
+ % (pi_path_backup),
+ 'Summary of conflicts:\n',
+ ' Text conflicts: 1\n'],
"system(.*) returned.*", 0,
'update', '--accept=edit',
pi_path_backup)
@@ -4095,14 +4111,27 @@ interactive-conflicts = true
wc_dir, '--config-dir', config_dir)
# Now update -r1 again. Hopefully we don't get a checksum error!
- expected_output = svntest.wc.State(wc_dir, {})
+ expected_output = svntest.wc.State(wc_dir, {
+ 'iota': Item(verb="Skipped"),
+ })
+
+ # The interactive callback aborts, so the file remains in conflict.
+ expected_disk.tweak('iota', contents="This is the file 'iota'.\n"
+ "<<<<<<< .mine\n"
+ "Local mods to r1 text.\n"
+ "=======\n"
+ "Appended text in r2.\n"
+ ">>>>>>> .r2\n"),
+ expected_disk.add({
+ 'iota.r1' : Item(contents="This is the file 'iota'.\n"),
+ 'iota.r2' : Item(contents="This is the file 'iota'.\n"
+ "Appended text in r2.\n"),
+ 'iota.mine' : Item(contents="This is the file 'iota'.\n"
+ "Local mods to r1 text.\n"),
+ })
- # note: it's possible that the correct disk here should be the
- # merged file?
- expected_disk.tweak('iota', contents=("This is the file 'iota'.\n"
- "Local mods to r1 text.\n"))
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
- expected_status.tweak('iota', status='M ')
+ expected_status.tweak('iota', status='C ', wc_rev=2)
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
RE: svn commit: r1350795 - in /subversion/trunk/subversion: libsvn_client/update.c tests/cmdline/update_tests.py
Posted by Bert Huijben <be...@qqmail.nl>.
> -----Original Message-----
> From: stsp@apache.org [mailto:stsp@apache.org]
> Sent: vrijdag 15 juni 2012 23:04
> To: commits@subversion.apache.org
> Subject: svn commit: r1350795 - in /subversion/trunk/subversion:
> libsvn_client/update.c tests/cmdline/update_tests.py
>
> Author: stsp
> Date: Fri Jun 15 21:03:35 2012
> New Revision: 1350795
>
> URL: http://svn.apache.org/viewvc?rev=1350795&view=rev
> Log:
> Invoke the interactive conflict resolution callback after an update operation,
> instead of during an update operation.
While +1 on the concept I want to note that this currently breaks the handling of property conflicts.
As there is no storage for property conflicts yet the only thing you can do at a later time is resolve it to working or revert all the property changes. Before this patch individual property conflicts could be handled.
I hope and assume we can fix this before 1.8 with a/the new conflict storage.
Bert