Author: julianfoad
Date: Wed Apr 24 23:02:04 2013
New Revision: 1471759
URL: http://svn.apache.org/r1471759
Log:
Make 'svn' print a summary of conflicts before starting interactive
conflict resolution, as well as after resolution is finished, to give the
user an idea of how much resolution work will be needed.
Addresses issue #3497, "auto merge as much as can; then print summary, then
go into conflict resolution".
* subversion/svn/cl.h,
subversion/svn/notify.c
(svn_cl__notifier_print_conflict_stats): Rewrite as a wrapper ...
(svn_cl__print_conflict_stats): ... around this new function.
* subversion/svn/conflict-callbacks.c
(svn_cl__interactive_conflict_baton): Add a flag to remember whether we
have printed the summary yet.
(svn_cl__get_conflict_func_interactive_baton): Initialize that flag.
(conflict_func_interactive): Print a summary of conflicts before starting
interactive resolution.
Modified:
subversion/trunk/subversion/svn/cl.h
subversion/trunk/subversion/svn/conflict-callbacks.c
subversion/trunk/subversion/svn/notify.c
Modified: subversion/trunk/subversion/svn/cl.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1471759&r1=1471758&r2=1471759&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Wed Apr 24 23:02:04 2013
@@ -347,6 +347,14 @@ svn_cl__conflict_stats_resolved(svn_cl__
const char *path_local,
svn_wc_conflict_kind_t conflict_kind);
+/* Print the conflict stats accumulated in CONFLICT_STATS.
+ *
+ * Return any error encountered during printing.
+ * See also svn_cl__notifier_print_conflict_stats().
+ */
+svn_error_t *
+svn_cl__print_conflict_stats(svn_cl__conflict_stats_t *conflict_stats,
+ apr_pool_t *scratch_pool);
/* Create and return an baton for use with svn_cl__conflict_func_interactive
* in *B, allocated from RESULT_POOL, and initialised with the values
@@ -571,7 +579,9 @@ svn_cl__check_externals_failed_notify_wr
apr_pool_t *pool);
/* Print the conflict stats accumulated in BATON, which is the
- * notifier baton from svn_cl__get_notifier().
+ * notifier baton from svn_cl__get_notifier(). This is just like
+ * calling svn_cl__print_conflict_stats().
+ *
* Return any error encountered during printing.
*/
svn_error_t *
Modified: subversion/trunk/subversion/svn/conflict-callbacks.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/conflict-callbacks.c?rev=1471759&r1=1471758&r2=1471759&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/conflict-callbacks.c (original)
+++ subversion/trunk/subversion/svn/conflict-callbacks.c Wed Apr 24 23:02:04
2013
@@ -56,6 +56,7 @@ struct svn_cl__interactive_conflict_bato
const char *path_prefix;
svn_boolean_t quit;
svn_cl__conflict_stats_t *conflict_stats;
+ svn_boolean_t printed_summary;
};
svn_error_t *
@@ -82,6 +83,7 @@ svn_cl__get_conflict_func_interactive_ba
SVN_ERR(svn_dirent_get_absolute(&(*b)->path_prefix, "", result_pool));
(*b)->quit = FALSE;
(*b)->conflict_stats = conflict_stats;
+ (*b)->printed_summary = FALSE;
return SVN_NO_ERROR;
}
@@ -1201,6 +1203,13 @@ conflict_func_interactive(svn_wc_conflic
break;
}
+ /* Print a summary of conflicts before starting interactive resolution */
+ if (! b->printed_summary)
+ {
+ SVN_ERR(svn_cl__print_conflict_stats(b->conflict_stats, scratch_pool));
+ b->printed_summary = TRUE;
+ }
+
/* We're in interactive mode and either the user gave no --accept
option or the option did not apply; let's prompt. */
Modified: subversion/trunk/subversion/svn/notify.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1471759&r1=1471758&r2=1471759&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Wed Apr 24 23:02:04 2013
@@ -145,20 +145,20 @@ resolved_str(apr_pool_t *pool, int n_res
}
svn_error_t *
-svn_cl__notifier_print_conflict_stats(void *baton, apr_pool_t *scratch_pool)
+svn_cl__print_conflict_stats(svn_cl__conflict_stats_t *conflict_stats,
+ apr_pool_t *scratch_pool)
{
- struct notify_baton *nb = baton;
- int n_text = apr_hash_count(nb->conflict_stats->text_conflicts);
- int n_prop = apr_hash_count(nb->conflict_stats->prop_conflicts);
- int n_tree = apr_hash_count(nb->conflict_stats->tree_conflicts);
- int n_text_r = nb->conflict_stats->text_conflicts_resolved;
- int n_prop_r = nb->conflict_stats->prop_conflicts_resolved;
- int n_tree_r = nb->conflict_stats->tree_conflicts_resolved;
+ int n_text = apr_hash_count(conflict_stats->text_conflicts);
+ int n_prop = apr_hash_count(conflict_stats->prop_conflicts);
+ int n_tree = apr_hash_count(conflict_stats->tree_conflicts);
+ int n_text_r = conflict_stats->text_conflicts_resolved;
+ int n_prop_r = conflict_stats->prop_conflicts_resolved;
+ int n_tree_r = conflict_stats->tree_conflicts_resolved;
if (n_text > 0 || n_text_r > 0
|| n_prop > 0 || n_prop_r > 0
|| n_tree > 0 || n_tree_r > 0
- || nb->conflict_stats->skipped_paths > 0)
+ || conflict_stats->skipped_paths > 0)
SVN_ERR(svn_cmdline_printf(scratch_pool,
_("Summary of conflicts:\n")));
@@ -195,11 +195,20 @@ svn_cl__notifier_print_conflict_stats(vo
remaining_str(scratch_pool, n_tree),
resolved_str(scratch_pool, n_tree_r)));
}
- if (nb->conflict_stats->skipped_paths > 0)
+ if (conflict_stats->skipped_paths > 0)
SVN_ERR(svn_cmdline_printf(scratch_pool,
_(" Skipped paths: %d\n"),
- nb->conflict_stats->skipped_paths));
+ conflict_stats->skipped_paths));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_cl__notifier_print_conflict_stats(void *baton, apr_pool_t *scratch_pool)
+{
+ struct notify_baton *nb = baton;
+ SVN_ERR(svn_cl__print_conflict_stats(nb->conflict_stats, scratch_pool));
return SVN_NO_ERROR;
}