Author: stsp
Date: Wed Jul 4 15:40:59 2012
New Revision: 1357313
URL: http://svn.apache.org/viewvc?rev=1357313&view=rev
Log:
When running the conflict resolver at the end of an 'svn update' operation,
resolve conflicts only on paths which got new conflicts flagged during the
update operation, rather than also resolving conflicts which were left behind
within the update targets by some other operation.
* subversion/svn/cl.h
(svn_cl__notifier_get_conflicted_paths): Declare.
* subversion/svn/notify.c
(notify_baton): Add conflicted_paths hash.
(add_conflicted_path): New helper to add a conflicted path to above hash.
(notify): Add any confliced paths to above hash.
(svn_cl__get_notifier): Initialise the conflicted_paths hash.
(svn_cl__notifier_get_conflicted_paths): Return a path-wise sorted array
of confliced paths added during notification.
* subversion/svn/update-cmd.c
(svn_cl__update): Pass the list of newly conflicted paths to the resolver,
rather than passing the entire update target list.
Modified:
subversion/trunk/subversion/svn/cl.h
subversion/trunk/subversion/svn/notify.c
subversion/trunk/subversion/svn/update-cmd.c
Modified: subversion/trunk/subversion/svn/cl.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1357313&r1=1357312&r2=1357313&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Wed Jul 4 15:40:59 2012
@@ -607,6 +607,10 @@ svn_cl__notifier_mark_wc_to_repos_copy(v
svn_boolean_t
svn_cl__notifier_check_conflicts(void *baton);
+/* Return a sorted array of conflicted paths detected during notification. */
+apr_array_header_t *
+svn_cl__notifier_get_conflicted_paths(void *baton, apr_pool_t *result_pool);
+
/* Baton for use with svn_cl__check_externals_failed_notify_wrapper(). */
struct svn_cl__check_externals_failed_notify_baton
{
Modified: subversion/trunk/subversion/svn/notify.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1357313&r1=1357312&r2=1357313&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Wed Jul 4 15:40:59 2012
@@ -35,6 +35,7 @@
#include "svn_pools.h"
#include "svn_dirent_uri.h"
#include "svn_path.h"
+#include "svn_sorts.h"
#include "cl.h"
#include "svn_private_config.h"
@@ -57,6 +58,7 @@ struct notify_baton
unsigned int prop_conflicts;
unsigned int tree_conflicts;
unsigned int skipped_paths;
+ apr_hash_t *conflicted_paths;
/* The cwd, for use in decomposing absolute paths. */
const char *path_prefix;
@@ -100,6 +102,16 @@ svn_cl__print_conflict_stats(void *notif
return SVN_NO_ERROR;
}
+/* Add a conflicted path to the list of conflicted paths stored
+ * in the notify baton. */
+static void
+add_conflicted_path(struct notify_baton *nb, const char *path)
+{
+ apr_hash_set(nb->conflicted_paths,
+ apr_pstrdup(apr_hash_pool_get(nb->conflicted_paths), path),
+ APR_HASH_KEY_STRING, "");
+}
+
/* This implements `svn_wc_notify_func2_t'.
* NOTE: This function can't fail, so we just ignore any print errors. */
static void
@@ -213,6 +225,7 @@ notify(void *baton, const svn_wc_notify_
if (n->content_state == svn_wc_notify_state_conflicted)
{
nb->text_conflicts++;
+ add_conflicted_path(nb, n->path);
if ((err = svn_cmdline_printf(pool, "C %s\n", path_local)))
goto print_error;
}
@@ -228,6 +241,7 @@ notify(void *baton, const svn_wc_notify_
if (n->content_state == svn_wc_notify_state_conflicted)
{
nb->text_conflicts++;
+ add_conflicted_path(nb, n->path);
statchar_buf[0] = 'C';
}
else
@@ -236,6 +250,7 @@ notify(void *baton, const svn_wc_notify_
if (n->prop_state == svn_wc_notify_state_conflicted)
{
nb->prop_conflicts++;
+ add_conflicted_path(nb, n->path);
statchar_buf[1] = 'C';
}
else if (n->prop_state == svn_wc_notify_state_merged)
@@ -302,6 +317,7 @@ notify(void *baton, const svn_wc_notify_
if (n->content_state == svn_wc_notify_state_conflicted)
{
nb->text_conflicts++;
+ add_conflicted_path(nb, n->path);
statchar_buf[0] = 'C';
}
else if (n->kind == svn_node_file)
@@ -315,6 +331,7 @@ notify(void *baton, const svn_wc_notify_
if (n->prop_state == svn_wc_notify_state_conflicted)
{
nb->prop_conflicts++;
+ add_conflicted_path(nb, n->path);
statchar_buf[1] = 'C';
}
else if (n->prop_state == svn_wc_notify_state_changed)
@@ -508,6 +525,7 @@ notify(void *baton, const svn_wc_notify_
if (n->content_state == svn_wc_notify_state_conflicted)
{
nb->text_conflicts++;
+ add_conflicted_path(nb, n->path);
statchar_buf[0] = 'C';
}
else if (n->kind == svn_node_file)
@@ -521,6 +539,7 @@ notify(void *baton, const svn_wc_notify_
if (n->prop_state == svn_wc_notify_state_conflicted)
{
nb->prop_conflicts++;
+ add_conflicted_path(nb, n->path);
statchar_buf[1] = 'C';
}
else if (n->prop_state == svn_wc_notify_state_merged)
@@ -898,6 +917,7 @@ notify(void *baton, const svn_wc_notify_
case svn_wc_notify_tree_conflict:
nb->tree_conflicts++;
+ add_conflicted_path(nb, n->path);
if ((err = svn_cmdline_printf(pool, " C %s\n", path_local)))
goto print_error;
break;
@@ -1038,6 +1058,7 @@ svn_cl__get_notifier(svn_wc_notify_func2
nb->prop_conflicts = 0;
nb->tree_conflicts = 0;
nb->skipped_paths = 0;
+ nb->conflicted_paths = apr_hash_make(pool);
SVN_ERR(svn_dirent_get_absolute(&nb->path_prefix, "", pool));
*notify_func_p = notify;
@@ -1093,3 +1114,13 @@ svn_cl__notifier_check_conflicts(void *b
return (nb->text_conflicts || nb->prop_conflicts || nb->tree_conflicts);
}
+
+apr_array_header_t *
+svn_cl__notifier_get_conflicted_paths(void *baton, apr_pool_t *result_pool)
+{
+ struct notify_baton *nb = baton;
+
+ return svn_sort__hash(nb->conflicted_paths,
+ svn_sort_compare_items_as_paths,
+ result_pool);
+}
Modified: subversion/trunk/subversion/svn/update-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/update-cmd.c?rev=1357313&r1=1357312&r2=1357313&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/update-cmd.c (original)
+++ subversion/trunk/subversion/svn/update-cmd.c Wed Jul 4 15:40:59 2012
@@ -183,7 +183,10 @@ svn_cl__update(apr_getopt_t *os,
{
ctx->conflict_func2 = conflict_func2;
ctx->conflict_baton2 = conflict_baton2;
- SVN_ERR(svn_cl__resolve_conflicts(targets, depth, ctx, scratch_pool));
+ SVN_ERR(svn_cl__resolve_conflicts(
+ svn_cl__notifier_get_conflicted_paths(nwb.wrapped_baton,
+ scratch_pool),
+ depth, ctx, scratch_pool));
}
if (nwb.had_externals_error)