2 * ctx.c: initialization function for client context
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
24 /* ==================================================================== */
30 #include <apr_pools.h>
32 #include "svn_client.h"
33 #include "svn_error.h"
35 #include "private/svn_wc_private.h"
40 /* Call the notify_func of the context provided by BATON, if non-NULL. */
42 call_notify_func(void *baton, const svn_wc_notify_t *n, apr_pool_t *pool)
44 const svn_client_ctx_t *ctx = baton;
47 ctx->notify_func(ctx->notify_baton, n->path, n->action, n->kind,
48 n->mime_type, n->content_state, n->prop_state,
53 call_conflict_func(svn_wc_conflict_result_t **result,
54 const svn_wc_conflict_description2_t *conflict,
56 apr_pool_t *result_pool,
57 apr_pool_t *scratch_pool)
59 svn_client_ctx_t *ctx = baton;
61 if (ctx->conflict_func)
63 const svn_wc_conflict_description_t *cd;
65 cd = svn_wc__cd2_to_cd(conflict, scratch_pool);
66 SVN_ERR(ctx->conflict_func(result, cd, ctx->conflict_baton,
71 /* We have to set a result; so we postpone */
72 *result = svn_wc_create_conflict_result(svn_wc_conflict_choose_postpone,
80 svn_client_create_context2(svn_client_ctx_t **ctx,
84 svn_config_t *cfg_config;
86 *ctx = apr_pcalloc(pool, sizeof(svn_client_ctx_t));
88 (*ctx)->notify_func2 = call_notify_func;
89 (*ctx)->notify_baton2 = *ctx;
91 (*ctx)->conflict_func2 = call_conflict_func;
92 (*ctx)->conflict_baton2 = *ctx;
94 (*ctx)->config = cfg_hash;
97 cfg_config = svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG);
101 SVN_ERR(svn_wc_context_create(&(*ctx)->wc_ctx, cfg_config, pool,
108 svn_client_create_context(svn_client_ctx_t **ctx,
111 return svn_client_create_context2(ctx, NULL, pool);