Followup to r29625: fix getopt tests.
[svn.git] / subversion / svn / resolved-cmd.c
blob0d53d6c23958db506dee86e09a55f0bd746c76b9
1 /*
2 * resolved-cmd.c -- Subversion resolved subcommand
4 * ====================================================================
5 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
19 /* ==================================================================== */
23 /*** Includes. ***/
24 #define APR_WANT_STDIO
25 #include <apr_want.h>
27 #include "svn_client.h"
28 #include "svn_error.h"
29 #include "svn_pools.h"
30 #include "cl.h"
32 #include "svn_private_config.h"
36 /*** Code. ***/
38 /* This implements the `svn_opt_subcommand_t' interface. */
39 svn_error_t *
40 svn_cl__resolved(apr_getopt_t *os,
41 void *baton,
42 apr_pool_t *pool)
44 svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
45 svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
46 svn_wc_conflict_choice_t conflict_choice;
47 svn_error_t *err;
48 apr_array_header_t *targets;
49 int i;
50 apr_pool_t *subpool;
52 switch (opt_state->accept_which)
54 case svn_cl__accept_invalid:
55 conflict_choice = svn_wc_conflict_choose_merged;
56 break;
57 case svn_cl__accept_base:
58 conflict_choice = svn_wc_conflict_choose_base;
59 break;
60 case svn_cl__accept_theirs_conflict:
61 conflict_choice = svn_wc_conflict_choose_theirs_conflict;
62 break;
63 case svn_cl__accept_mine_conflict:
64 conflict_choice = svn_wc_conflict_choose_mine_conflict;
65 break;
66 case svn_cl__accept_theirs_full:
67 conflict_choice = svn_wc_conflict_choose_theirs_full;
68 break;
69 case svn_cl__accept_mine_full:
70 conflict_choice = svn_wc_conflict_choose_mine_full;
71 break;
72 default:
73 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
74 _("invalid 'accept' ARG"));
77 SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
78 opt_state->targets,
79 pool));
80 if (! targets->nelts)
81 return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL);
83 subpool = svn_pool_create(pool);
84 if (! opt_state->quiet)
85 svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2, FALSE,
86 FALSE, FALSE, pool);
88 if (opt_state->depth == svn_depth_unknown)
89 opt_state->depth = svn_depth_empty;
91 for (i = 0; i < targets->nelts; i++)
93 const char *target = APR_ARRAY_IDX(targets, i, const char *);
94 svn_pool_clear(subpool);
95 SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
96 err = svn_client_resolved2(target,
97 opt_state->depth, conflict_choice,
98 ctx,
99 subpool);
100 if (err)
102 svn_handle_warning(stderr, err);
103 svn_error_clear(err);
107 svn_pool_destroy(subpool);
108 return SVN_NO_ERROR;