source: valtobtest/subversion-1.6.2/subversion/svn/add-cmd.c @ 3

Last change on this file since 3 was 3, checked in by valtob, 15 years ago

subversion source 1.6.2 as test

File size: 2.6 KB
Line 
1/*
2 * add-cmd.c -- Subversion add/unadd commands
3 *
4 * ====================================================================
5 * Copyright (c) 2000-2004 CollabNet.  All rights reserved.
6 *
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.
12 *
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 * ====================================================================
17 */
18
19/* ==================================================================== */
20
21
22
23/*** Includes. ***/
24#define APR_WANT_STDIO
25#include <apr_want.h>
26
27#include "svn_client.h"
28#include "svn_error.h"
29#include "svn_pools.h"
30#include "cl.h"
31
32
33
34/*** Code. ***/
35
36/* This implements the `svn_opt_subcommand_t' interface. */
37svn_error_t *
38svn_cl__add(apr_getopt_t *os,
39            void *baton,
40            apr_pool_t *pool)
41{
42  svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
43  svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
44  apr_array_header_t *targets;
45  int i;
46  apr_pool_t *subpool;
47
48  SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
49                                                      opt_state->targets,
50                                                      ctx, pool));
51
52  if (! targets->nelts)
53    return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL);
54
55  if (! opt_state->quiet)
56    svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2, FALSE,
57                         FALSE, FALSE, pool);
58
59  if (opt_state->depth == svn_depth_unknown)
60    opt_state->depth = svn_depth_infinity;
61
62  subpool = svn_pool_create(pool);
63  for (i = 0; i < targets->nelts; i++)
64    {
65      const char *target = APR_ARRAY_IDX(targets, i, const char *);
66
67      svn_pool_clear(subpool);
68      SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
69      SVN_ERR(svn_cl__try
70              (svn_client_add4(target,
71                               opt_state->depth,
72                               opt_state->force, opt_state->no_ignore,
73                               opt_state->parents, ctx, subpool),
74               NULL, opt_state->quiet,
75               SVN_ERR_ENTRY_EXISTS,
76               SVN_ERR_WC_PATH_NOT_FOUND,
77               SVN_NO_ERROR));
78    }
79
80  svn_pool_destroy(subpool);
81  return SVN_NO_ERROR;
82}
Note: See TracBrowser for help on using the repository browser.