svn_error_t * svn_client_add3(const char *path, svn_boolean_t recursive, svn_boolean_t force, svn_boolean_t no_ignore, svn_client_ctx_t *ctx, apr_pool_t *pool) { return svn_client_add4(path, SVN_DEPTH_INFINITY_OR_EMPTY(recursive), force, no_ignore, FALSE, ctx, pool); }
QSvnError QSvn::add(const QStringList &items, svn_depth_t depth, bool force, bool no_ignore, bool addparents) { foreach(const QString &item, items) { QSvnPool localpool(pool); QSvnError err = svn_client_add4(item.toUtf8().constData(), depth, force, no_ignore, addparents, ctx, localpool); if (err.isError()) { return err; } }
/* This implements the `svn_opt_subcommand_t' interface. */ svn_error_t * svn_cl__add(apr_getopt_t *os, void *baton, apr_pool_t *pool) { svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state; svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx; apr_array_header_t *targets; int i; apr_pool_t *subpool; SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os, opt_state->targets, pool)); if (! targets->nelts) return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL); if (! opt_state->quiet) svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2, FALSE, FALSE, FALSE, pool); if (opt_state->depth == svn_depth_unknown) opt_state->depth = svn_depth_infinity; subpool = svn_pool_create(pool); for (i = 0; i < targets->nelts; i++) { const char *target = APR_ARRAY_IDX(targets, i, const char *); svn_pool_clear(subpool); SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton)); SVN_ERR(svn_cl__try (svn_client_add4(target, opt_state->depth, opt_state->force, opt_state->no_ignore, opt_state->parents, ctx, subpool), NULL, opt_state->quiet, SVN_ERR_ENTRY_EXISTS, SVN_ERR_WC_PATH_NOT_FOUND, SVN_NO_ERROR)); } svn_pool_destroy(subpool); return SVN_NO_ERROR; }
int a_svn_add (char *device_name, char *temp_working_dir, apr_pool_t *apr_pool, apr_pool_t *svn_pool) /* * add a new file to SVN repository * */ { svn_error_t* svn_err; char temp_svn_path[MAXPATH]; svn_client_ctx_t* context; temp_svn_path[0] = 0x0; svn_err = svn_client_create_context( &context, svn_pool ); if(svn_err) { a_debug_info2(DEBUGLVL3,"a_svn_add: svn error: %s",svn_err->message); return -1; } snprintf(temp_svn_path,MAXPATH,"%s/%s",temp_working_dir,device_name); svn_err = svn_client_add4(temp_svn_path, svn_depth_empty, FALSE, FALSE, FALSE, context, svn_pool); if(svn_err){ a_logmsg("%s: svn error: %s",device_name,svn_err->message); a_debug_info2(DEBUGLVL5,"a_svn_add: svn error: %s",svn_err->message); return -1; } return 1; }
/* This implements the `svn_opt_subcommand_t' interface. */ svn_error_t * svn_cl__add(apr_getopt_t *os, void *baton, apr_pool_t *pool) { svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state; svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx; apr_array_header_t *targets; int i; apr_pool_t *iterpool; apr_array_header_t *errors = apr_array_make(pool, 0, sizeof(apr_status_t)); SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os, opt_state->targets, ctx, FALSE, pool)); if (! targets->nelts) return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, 0, NULL); if (opt_state->depth == svn_depth_unknown) opt_state->depth = svn_depth_infinity; SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool)); SVN_ERR(svn_cl__check_targets_are_local_paths(targets)); iterpool = svn_pool_create(pool); for (i = 0; i < targets->nelts; i++) { const char *target = APR_ARRAY_IDX(targets, i, const char *); svn_pool_clear(iterpool); SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton)); SVN_ERR(svn_cl__try (svn_client_add4(target, opt_state->depth, opt_state->force, opt_state->no_ignore, opt_state->parents, ctx, iterpool), errors, opt_state->quiet, SVN_ERR_ENTRY_EXISTS, SVN_ERR_WC_PATH_NOT_FOUND, SVN_NO_ERROR)); } svn_pool_destroy(iterpool); if (errors->nelts > 0) { svn_error_t *err; err = svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL, NULL); for (i = 0; i < errors->nelts; i++) { apr_status_t status = APR_ARRAY_IDX(errors, i, apr_status_t); if (status == SVN_ERR_WC_PATH_NOT_FOUND) err = svn_error_quick_wrap(err, _("Could not add all targets because " "some targets don't exist")); else if (status == SVN_ERR_ENTRY_EXISTS) err = svn_error_quick_wrap(err, _("Could not add all targets because " "some targets are already versioned")); } return svn_error_trace(err); } return SVN_NO_ERROR; }