Followup to r29625: fix getopt tests.
[svn.git] / subversion / svn / update-cmd.c
blob56bf6bc51654a98923e919e65247b5969ca5be7f
1 /*
2 * update-cmd.c -- Bring work tree in sync with repository
4 * ====================================================================
5 * Copyright (c) 2000-2007 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. ***/
25 #include "svn_pools.h"
26 #include "svn_client.h"
27 #include "svn_path.h"
28 #include "svn_error_codes.h"
29 #include "svn_error.h"
30 #include "cl.h"
32 #include "svn_private_config.h"
35 /*** Code. ***/
37 /* This implements the `svn_opt_subcommand_t' interface. */
38 svn_error_t *
39 svn_cl__update(apr_getopt_t *os,
40 void *baton,
41 apr_pool_t *pool)
43 svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
44 svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
45 apr_array_header_t *targets;
46 svn_depth_t depth;
47 svn_boolean_t depth_is_sticky;
49 SVN_ERR(svn_opt_args_to_target_array3(&targets, os,
50 opt_state->targets, pool));
52 /* Add "." if user passed 0 arguments */
53 svn_opt_push_implicit_dot_target(targets, pool);
55 /* If using changelists, convert targets into a set of paths that
56 match the specified changelist(s). */
57 if (opt_state->changelists)
59 svn_depth_t cl_depth = opt_state->depth;
60 if (cl_depth == svn_depth_unknown)
61 cl_depth = svn_depth_infinity;
62 SVN_ERR(svn_cl__changelist_paths(&targets,
63 opt_state->changelists, targets,
64 cl_depth, ctx, pool));
67 if (! opt_state->quiet)
68 svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2,
69 FALSE, FALSE, FALSE, pool);
71 /* Deal with depthstuffs. */
72 if (opt_state->set_depth != svn_depth_unknown)
74 depth = opt_state->set_depth;
75 depth_is_sticky = TRUE;
77 else
79 depth = opt_state->depth;
80 depth_is_sticky = FALSE;
83 SVN_ERR(svn_client_update3(NULL, targets,
84 &(opt_state->start_revision),
85 depth, depth_is_sticky,
86 opt_state->ignore_externals,
87 opt_state->force,
88 ctx, pool));
90 return SVN_NO_ERROR;