44
52
*has_changes = svn_diff_contains_diffs(diff);
46
SVN_ERR(svn_diff_file_output_merge2(ostream, diff,
54
SVN_ERR(svn_diff_file_output_merge3(ostream, diff,
47
55
original, modified, latest,
48
NULL, NULL, NULL, NULL,
49
svn_diff_conflict_display_modified_latest,
61
NULL, NULL, /* cancel */
55
int main(int argc, char *argv[])
67
int main(int argc, const char *argv[])
58
70
svn_stream_t *ostream;
72
svn_error_t *svn_err = SVN_NO_ERROR;
74
svn_boolean_t help = FALSE;
77
conflict_style_opt = SVN_OPT_FIRST_LONGOPT_ID
79
static const apr_getopt_option_t options[] = {
80
{"conflict-style", conflict_style_opt, 1, ""},
81
{"label", 'L', 1, ""},
82
{"show-overlap", 'E', 0, ""},
83
{"merge", 'm', 0, ""},
88
svn_diff_conflict_display_style_t conflict_style
89
= svn_diff_conflict_display_modified_latest;
90
const svn_token_map_t style_map[] = {
92
svn_diff_conflict_display_modified_latest },
93
{ "resolved-modified-latest",
94
svn_diff_conflict_display_resolved_modified_latest },
95
{ "modified-original-latest",
96
svn_diff_conflict_display_modified_original_latest },
98
svn_diff_conflict_display_modified },
100
svn_diff_conflict_display_latest },
102
svn_diff_conflict_display_only_conflicts },
105
const char *conflict_original = NULL;
106
const char *conflict_modified = NULL;
107
const char *conflict_latest = NULL;
64
111
pool = svn_pool_create(NULL);
66
svn_err = svn_stream_for_stdout(&ostream, pool);
113
apr_getopt_init(&opts, pool, argc, argv);
114
opts->interleave = 1;
119
apr_status_t status = apr_getopt_long(opts, options, &opt, &arg);
121
if (APR_STATUS_IS_EOF(status))
123
if (status != APR_SUCCESS)
125
svn_err = svn_error_wrap_apr(status, "getopt failure");
130
case conflict_style_opt:
133
svn_err = svn_token__from_word_err(&val, style_map, arg);
134
conflict_style = val;
138
if (!conflict_modified)
139
conflict_modified = apr_pstrcat(pool, "<<<<<<< ", arg, SVN_VA_NULL);
140
else if (!conflict_original)
141
conflict_original = apr_pstrcat(pool, "||||||| ", arg, SVN_VA_NULL);
142
else if (!conflict_latest)
143
conflict_latest = apr_pstrcat(pool, ">>>>>>> ", arg, SVN_VA_NULL);
145
svn_err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
150
/* These are allowed and ignored so that all the options
151
passed when invoking --diff3-cmd are accepted as that
152
makes it easier to use this as an external diff3
163
svn_err = svn_stream_for_stdout(&ostream, pool);
69
166
svn_handle_error2(svn_err, stdout, FALSE, "diff3: ");
167
svn_error_clear(svn_err);
170
else if (argc - opts->ind == 3 && !help)
74
172
svn_boolean_t has_changes;
76
svn_err = do_diff3(ostream, argv[2], argv[1], argv[3],
174
svn_err = do_diff3(ostream, argv[argc-2], argv[argc-3], argv[argc-1],
175
conflict_original, conflict_modified, conflict_latest,
176
conflict_style, &has_changes, pool);
78
177
if (svn_err == NULL)
80
179
rc = has_changes ? 1 : 0;
90
189
svn_error_clear(svn_stream_printf(ostream, pool,
91
"Usage: %s <mine> <older> <yours>\n",
190
"Usage: %s [options] <mine> <older> <yours>\n"
192
" --conflict-style STYLE\n"
193
" where STYLE can be:\n"
201
" --label [-L] LABEL\n"
202
" can be repeated up to three times\n"
205
" ignored (present for compatibility)\n"
207
" --show-overlap [-E]\n"
208
" ignored (present for compatibility)\n",
210
svn_token__to_word(style_map,
211
svn_diff_conflict_display_modified_latest),
212
svn_token__to_word(style_map,
213
svn_diff_conflict_display_resolved_modified_latest),
214
svn_token__to_word(style_map,
215
svn_diff_conflict_display_modified_original_latest),
216
svn_token__to_word(style_map,
217
svn_diff_conflict_display_modified),
218
svn_token__to_word(style_map,
219
svn_diff_conflict_display_latest),
220
svn_token__to_word(style_map,
221
svn_diff_conflict_display_only_conflicts)));