3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
23 * @file svn_client_mtcc.h
24 * @brief Subversion multicommand client support
26 * Requires: The working copy library and client library.
27 * Provides: High level multicommand api.
28 * Used By: Client programs, svnmucc.
31 #ifndef SVN_CLIENT_MTCC_H
32 #define SVN_CLIENT_MTCC_H
34 #include "svn_client.h"
38 #endif /* __cplusplus */
43 * @defgroup clnt_mtcc Multi Command Context related functions
49 /** This is a structure which stores a list of repository commands
50 * that can be played to a repository as a single operation
52 * Use svn_client__mtcc_create() to create instances
56 typedef struct svn_client__mtcc_t svn_client__mtcc_t;
58 /** Creates a new multicommand context for an operation on @a anchor_url and
61 * Allocate the context in @a result_pool and perform temporary allocations in
67 svn_client__mtcc_create(svn_client__mtcc_t **mtcc,
68 const char *anchor_url,
69 svn_revnum_t base_revision,
70 svn_client_ctx_t *ctx,
71 apr_pool_t *result_pool,
72 apr_pool_t *scratch_pool);
74 /** Adds a file add operation of @a relpath to @a mtcc. If @a src_checksum
75 * is not null it will be provided to the repository to verify if the file
76 * was transferred successfully.
78 * Perform temporary allocations in @a scratch_pool.
80 * @note The current implementation keeps @a src_stream open until @a mtcc
86 svn_client__mtcc_add_add_file(const char *relpath,
87 svn_stream_t *src_stream,
88 const svn_checksum_t *src_checksum,
89 svn_client__mtcc_t *mtcc,
90 apr_pool_t *scratch_pool);
92 /** Adds a copy operation of the node @a src_relpath at revision @a revision
93 * to @a dst_relpath to @a mtcc.
95 * Perform temporary allocations in @a scratch_pool.
100 svn_client__mtcc_add_copy(const char *src_relpath,
101 svn_revnum_t revision,
102 const char *dst_relpath,
103 svn_client__mtcc_t *mtcc,
104 apr_pool_t *scratch_pool);
106 /** Adds a delete of @a relpath to @a mtcc.
108 * Perform temporary allocations in @a scratch_pool.
113 svn_client__mtcc_add_delete(const char *relpath,
114 svn_client__mtcc_t *mtcc,
115 apr_pool_t *scratch_pool);
117 /** Adds an mkdir operation of @a relpath to @a mtcc.
119 * Perform temporary allocations in @a scratch_pool.
124 svn_client__mtcc_add_mkdir(const char *relpath,
125 svn_client__mtcc_t *mtcc,
126 apr_pool_t *scratch_pool);
129 /** Adds a move operation of the node @a src_relpath to @a dst_relpath to
132 * Perform temporary allocations in @a scratch_pool.
137 svn_client__mtcc_add_move(const char *src_relpath,
138 const char *dst_relpath,
139 svn_client__mtcc_t *mtcc,
140 apr_pool_t *scratch_pool);
142 /** Adds a propset operation for the property @a propname to @a propval
143 * (which can be NULL for a delete) on @a relpath to @a mtcc.
145 * If @a skip_checks is not FALSE Subversion defined properties are verified
146 * for correctness like svn_client_propset_remote()
148 * Perform temporary allocations in @a scratch_pool.
153 svn_client__mtcc_add_propset(const char *relpath,
154 const char *propname,
155 const svn_string_t *propval,
156 svn_boolean_t skip_checks,
157 svn_client__mtcc_t *mtcc,
158 apr_pool_t *scratch_pool);
161 /** Adds an update file operation for @a relpath to @a mtcc.
163 * The final version of the file is provided with @a src_stream. If @a
164 * src_checksum is provided it will be provided to the repository to verify
167 * If @a base_checksum is provided it will be used by the repository to verify
168 * if the base file matches this checksum.
170 * If @a base_stream is not NULL only the binary diff from @a base_stream to
171 * @a src_stream is written to the repository.
173 * Perform temporary allocations in @a scratch_pool.
175 * @note Callers should assume that the mtcc requires @a src_stream and @a
176 * base_stream to be valid until @a mtcc is committed.
181 svn_client__mtcc_add_update_file(const char *relpath,
182 svn_stream_t *src_stream,
183 const svn_checksum_t *src_checksum,
184 svn_stream_t *base_stream,
185 const svn_checksum_t *base_checksum,
186 svn_client__mtcc_t *mtcc,
187 apr_pool_t *scratch_pool);
189 /** Obtains the kind of node at @a relpath in the current state of @a mtcc.
190 * This value might be from the cache (in case of modifications, copies)
191 * or fetched from the repository.
193 * If @a check_repository is TRUE, verify the node type with the repository at
194 * least once and cache the result for further checks.
196 * When a node does not exist this functions sets @a *kind to @c svn_node_node.
201 svn_client__mtcc_check_path(svn_node_kind_t *kind,
203 svn_boolean_t check_repository,
204 svn_client__mtcc_t *mtcc,
205 apr_pool_t *scratch_pool);
207 /** Commits all operations stored in @a mtcc as a new revision and destroys
213 svn_client__mtcc_commit(apr_hash_t *revprop_table,
214 svn_commit_callback2_t commit_callback,
216 svn_client__mtcc_t *mtcc,
217 apr_pool_t *scratch_pool);
220 /** @} end group: Multi Command Context related functions */
224 #endif /* __cplusplus */
226 #endif /* SVN_CLIENT_MTCC_H */