50
50
#define OPT_VERSION SVN_OPT_FIRST_LONGOPT_ID
52
/** A statement macro, similar to @c SVN_INT_ERR, but issues a
53
* message saying "svnraisetreeconflict:" instead of "svn:".
55
* Evaluate @a expr. If it yields an error, handle that error and
56
* return @c EXIT_FAILURE.
58
#define SVNRAISETC_INT_ERR(expr) \
60
svn_error_t *svn_err__temp = (expr); \
61
if (svn_err__temp) { \
62
svn_handle_error2(svn_err__temp, stderr, FALSE, \
63
"svnraisetreeconflict: "); \
64
svn_error_clear(svn_err__temp); \
65
return EXIT_FAILURE; } \
68
52
static svn_error_t *
69
53
version(apr_pool_t *pool)
224
207
right = svn_wc_conflict_version_create2(repos_url2, NULL, path_in_repos2,
225
208
peg_rev2, kind2, pool);
226
209
c = svn_wc_conflict_description_create_tree2(wc_abspath, kind,
227
operation, left, right, pool);
210
operation, left, right, pool);
228
211
c->action = (svn_wc_conflict_action_t)action;
229
212
c->reason = (svn_wc_conflict_reason_t)reason;
312
294
SVN_VERSION_DEFINE(my_version);
314
return svn_ver_check_list(&my_version, checklist);
296
return svn_ver_check_list2(&my_version, checklist, svn_ver_equal);
318
main(int argc, const char *argv[])
300
* On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
301
* either return an error to be displayed, or set *EXIT_CODE to non-zero and
302
* return SVN_NO_ERROR.
305
sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
322
307
apr_getopt_t *os;
323
308
const apr_getopt_option_t options[] =
330
315
apr_array_header_t *remaining_argv;
332
/* Initialize the app. */
333
if (svn_cmdline_init("svnraisetreeconflict", stderr) != EXIT_SUCCESS)
336
/* Create our top-level pool. Use a separate mutexless allocator,
337
* given this application is single threaded.
339
pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
341
317
/* Check library versions */
342
err = check_lib_versions();
344
return svn_cmdline_handle_exit_error(err, pool, "svnraisetreeconflict: ");
318
SVN_ERR(check_lib_versions());
346
320
#if defined(WIN32) || defined(__CYGWIN__)
347
321
/* Set the working copy administrative directory name. */
348
322
if (getenv("SVN_ASP_DOT_NET_HACK"))
350
err = svn_wc_set_adm_dir("_svn", pool);
352
return svn_cmdline_handle_exit_error(err, pool, "svnraisetreeconflict: ");
324
SVN_ERR(svn_wc_set_adm_dir("_svn", pool));
356
err = svn_cmdline__getopt_init(&os, argc, argv, pool);
358
return svn_cmdline_handle_exit_error(err, pool, "svnraisetreeconflict: ");
328
SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
360
330
os->interleave = 1;
366
336
if (APR_STATUS_IS_EOF(status))
368
338
if (status != APR_SUCCESS)
369
usage(pool); /* this will exit() */
341
*exit_code = EXIT_FAILURE;
374
348
help(options, pool);
376
350
case OPT_VERSION:
377
SVNRAISETC_INT_ERR(version(pool));
351
SVN_ERR(version(pool));
381
usage(pool); /* this will exit() */
355
*exit_code = EXIT_FAILURE;
391
SVNRAISETC_INT_ERR(svn_utf_cstring_to_utf8(&s, os->argv[os->ind++],
366
SVN_ERR(svn_utf_cstring_to_utf8(&s, os->argv[os->ind++], pool));
393
367
APR_ARRAY_PUSH(remaining_argv, const char *) = s;
396
370
if (remaining_argv->nelts < 1)
397
usage(pool); /* this will exit() */
373
*exit_code = EXIT_FAILURE;
399
377
/* Do the main task */
400
SVNRAISETC_INT_ERR(raise_tree_conflict(remaining_argv->nelts,
401
(const char **)remaining_argv->elts,
378
SVN_ERR(raise_tree_conflict(remaining_argv->nelts,
379
(const char **)remaining_argv->elts,
386
main(int argc, const char *argv[])
389
int exit_code = EXIT_SUCCESS;
392
/* Initialize the app. */
393
if (svn_cmdline_init("svnraisetreeconflict", stderr) != EXIT_SUCCESS)
396
/* Create our top-level pool. Use a separate mutexless allocator,
397
* given this application is single threaded.
399
pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
401
err = sub_main(&exit_code, argc, argv, pool);
403
/* Flush stdout and report if it fails. It would be flushed on exit anyway
404
but this makes sure that output is not silently lost if it fails. */
405
err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
409
exit_code = EXIT_FAILURE;
410
svn_cmdline_handle_exit_error(err, NULL, "svnraisetreeconflict: ");
404
413
svn_pool_destroy(pool);
406
/* Flush stdout to make sure that the user will see any printing errors. */
407
SVNRAISETC_INT_ERR(svn_cmdline_fflush(stdout));