summaryrefslogtreecommitdiff
path: root/subversion/svn/mergeinfo-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/svn/mergeinfo-cmd.c')
-rw-r--r--subversion/svn/mergeinfo-cmd.c157
1 files changed, 132 insertions, 25 deletions
diff --git a/subversion/svn/mergeinfo-cmd.c b/subversion/svn/mergeinfo-cmd.c
index 41edcda..c3c0305 100644
--- a/subversion/svn/mergeinfo-cmd.c
+++ b/subversion/svn/mergeinfo-cmd.c
@@ -27,7 +27,9 @@
/*** Includes. ***/
+#include "svn_compat.h"
#include "svn_pools.h"
+#include "svn_props.h"
#include "svn_client.h"
#include "svn_cmdline.h"
#include "svn_path.h"
@@ -35,6 +37,7 @@
#include "svn_error_codes.h"
#include "svn_types.h"
#include "cl.h"
+#include "cl-log.h"
#include "svn_private_config.h"
@@ -55,6 +58,25 @@ print_log_rev(void *baton,
return SVN_NO_ERROR;
}
+/* Implements a svn_log_entry_receiver_t interface that filters out changed
+ * paths data before calling the svn_cl__log_entry_receiver(). Right now we
+ * always have to pass TRUE for discover_changed_paths for
+ * svn_client_mergeinfo_log2() due to the side effect of that option. The
+ * svn_cl__log_entry_receiver() discovers if it should print the changed paths
+ * implicitly by the path info existing. As a result this filter is needed
+ * to allow expected output without changed paths.
+ */
+static svn_error_t *
+print_log_details(void *baton,
+ svn_log_entry_t *log_entry,
+ apr_pool_t *pool)
+{
+ log_entry->changed_paths = NULL;
+ log_entry->changed_paths2 = NULL;
+
+ return svn_cl__log_entry_receiver(baton, log_entry, pool);
+}
+
/* Draw a diagram (by printing text to the console) summarizing the state
* of merging between two branches, given the merge description
* indicated by YCA, BASE, RIGHT, TARGET, REINTEGRATE_LIKE. */
@@ -218,7 +240,8 @@ mergeinfo_summary(
target_is_wc = (! svn_path_is_url(target_path_or_url))
&& (target_revision->kind == svn_opt_revision_unspecified
- || target_revision->kind == svn_opt_revision_working);
+ || target_revision->kind == svn_opt_revision_working
+ || target_revision->kind == svn_opt_revision_base);
SVN_ERR(svn_client_get_merging_summary(
&is_reintegration,
&yca_url, &yca_rev,
@@ -238,6 +261,77 @@ mergeinfo_summary(
return SVN_NO_ERROR;
}
+static svn_error_t *
+mergeinfo_log(svn_boolean_t finding_merged,
+ const char *target,
+ const svn_opt_revision_t *tgt_peg_revision,
+ const char *source,
+ const svn_opt_revision_t *src_peg_revision,
+ const svn_opt_revision_t *src_start_revision,
+ const svn_opt_revision_t *src_end_revision,
+ svn_depth_t depth,
+ svn_boolean_t include_log_details,
+ svn_boolean_t quiet,
+ svn_boolean_t verbose,
+ svn_boolean_t incremental,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ apr_array_header_t *revprops;
+ svn_log_entry_receiver_t log_receiver;
+ void *log_receiver_baton;
+
+ if (include_log_details)
+ {
+ svn_cl__log_receiver_baton *baton;
+
+ revprops = apr_array_make(pool, 3, sizeof(const char *));
+ APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_AUTHOR;
+ APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_DATE;
+ if (!quiet)
+ APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_LOG;
+
+ if (verbose)
+ log_receiver = svn_cl__log_entry_receiver;
+ else
+ log_receiver = print_log_details;
+
+ baton = apr_palloc(pool, sizeof(svn_cl__log_receiver_baton));
+ baton->ctx = ctx;
+ baton->target_path_or_url = target;
+ baton->target_peg_revision = *tgt_peg_revision;
+ baton->omit_log_message = quiet;
+ baton->show_diff = FALSE;
+ baton->depth = depth;
+ baton->diff_extensions = NULL;
+ baton->merge_stack = NULL;
+ baton->search_patterns = NULL;
+ baton->pool = pool;
+ log_receiver_baton = baton;
+ }
+ else
+ {
+ /* We need only revisions number, not revision properties. */
+ revprops = apr_array_make(pool, 0, sizeof(const char *));
+ log_receiver = print_log_rev;
+ log_receiver_baton = NULL;
+ }
+
+ SVN_ERR(svn_client_mergeinfo_log2(finding_merged, target,
+ tgt_peg_revision,
+ source, src_peg_revision,
+ src_start_revision,
+ src_end_revision,
+ log_receiver, log_receiver_baton,
+ TRUE, depth, revprops, ctx,
+ pool));
+
+ if (include_log_details && !incremental)
+ SVN_ERR(svn_cmdline_printf(pool, SVN_CL__LOG_SEP_STRING));
+
+ return SVN_NO_ERROR;
+}
+
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
svn_cl__mergeinfo(apr_getopt_t *os,
@@ -303,36 +397,44 @@ svn_cl__mergeinfo(apr_getopt_t *os,
else
src_end_revision = &(opt_state->end_revision);
- /* Do the real work, depending on the requested data flavor. */
- if (opt_state->show_revs == svn_cl__show_revs_merged)
+ if (!opt_state->mergeinfo_log)
{
- apr_array_header_t *revprops;
+ if (opt_state->quiet)
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--quiet (-q) option valid only with --log "
+ "option"));
- /* We need only revisions number, not revision properties. */
- revprops = apr_array_make(pool, 0, sizeof(const char *));
+ if (opt_state->verbose)
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--verbose (-v) option valid only with "
+ "--log option"));
- SVN_ERR(svn_client_mergeinfo_log2(TRUE, target, &tgt_peg_revision,
- source, &src_peg_revision,
- src_start_revision,
- src_end_revision,
- print_log_rev, NULL,
- TRUE, depth, revprops, ctx,
- pool));
+ if (opt_state->incremental)
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--incremental option valid only with "
+ "--log option"));
+ }
+
+ /* Do the real work, depending on the requested data flavor. */
+ if (opt_state->show_revs == svn_cl__show_revs_merged)
+ {
+ SVN_ERR(mergeinfo_log(TRUE, target, &tgt_peg_revision,
+ source, &src_peg_revision,
+ src_start_revision,
+ src_end_revision,
+ depth, opt_state->mergeinfo_log,
+ opt_state->quiet, opt_state->verbose,
+ opt_state->incremental, ctx, pool));
}
else if (opt_state->show_revs == svn_cl__show_revs_eligible)
{
- apr_array_header_t *revprops;
-
- /* We need only revisions number, not revision properties. */
- revprops = apr_array_make(pool, 0, sizeof(const char *));
-
- SVN_ERR(svn_client_mergeinfo_log2(FALSE, target, &tgt_peg_revision,
- source, &src_peg_revision,
- src_start_revision,
- src_end_revision,
- print_log_rev, NULL,
- TRUE, depth, revprops, ctx,
- pool));
+ SVN_ERR(mergeinfo_log(FALSE, target, &tgt_peg_revision,
+ source, &src_peg_revision,
+ src_start_revision,
+ src_end_revision,
+ depth, opt_state->mergeinfo_log,
+ opt_state->quiet, opt_state->verbose,
+ opt_state->incremental, ctx, pool));
}
else
{
@@ -345,6 +447,11 @@ svn_cl__mergeinfo(apr_getopt_t *os,
return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("Depth specification options valid only "
"with --show-revs option"));
+ if (opt_state->mergeinfo_log)
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--log option valid only with "
+ "--show-revs option"));
+
SVN_ERR(mergeinfo_summary(source, &src_peg_revision,
target, &tgt_peg_revision,