]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/include/private/svn_client_mtcc.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / include / private / svn_client_mtcc.h
1 /**
2  * @copyright
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
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
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
19  *    under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file svn_client_mtcc.h
24  * @brief Subversion multicommand client support
25  *
26  * Requires:  The working copy library and client library.
27  * Provides:  High level multicommand api.
28  * Used By:   Client programs, svnmucc.
29  */
30
31 #ifndef SVN_CLIENT_MTCC_H
32 #define SVN_CLIENT_MTCC_H
33
34 #include "svn_client.h"
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40
41 /**
42  *
43  * @defgroup clnt_mtcc Multi Command Context related functions
44  *
45  * @{
46  *
47  */
48
49 /** This is a structure which stores a list of repository commands
50  * that can be played to a repository as a single operation
51  *
52  * Use svn_client__mtcc_create() to create instances
53  *
54  * @since New in 1.9.
55  */
56 typedef struct svn_client__mtcc_t svn_client__mtcc_t;
57
58 /** Creates a new multicommand context for an operation on @a anchor_url and
59  * its descendants.
60  *
61  * Allocate the context in @a result_pool and perform temporary allocations in
62  * @a scratch_pool.
63  *
64  * @since New in 1.9.
65  */
66 svn_error_t *
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);
73
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.
77  *
78  * Perform temporary allocations in @a scratch_pool.
79  *
80  * @note The current implementation keeps @a src_stream open until @a mtcc
81  * is committed.
82  *
83  * @since New in 1.9.
84  */
85 svn_error_t *
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);
91
92 /** Adds a copy operation of the node @a src_relpath at revision @a revision
93  * to @a dst_relpath to @a mtcc.
94  *
95  * Perform temporary allocations in @a scratch_pool.
96  *
97  * @since New in 1.9.
98  */
99 svn_error_t *
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);
105
106 /** Adds a delete of @a relpath to @a mtcc.
107  *
108  * Perform temporary allocations in @a scratch_pool.
109  *
110  * @since New in 1.9.
111  */
112 svn_error_t *
113 svn_client__mtcc_add_delete(const char *relpath,
114                             svn_client__mtcc_t *mtcc,
115                             apr_pool_t *scratch_pool);
116
117 /** Adds an mkdir operation of @a relpath to @a mtcc.
118  *
119  * Perform temporary allocations in @a scratch_pool.
120  *
121  * @since New in 1.9.
122  */
123 svn_error_t *
124 svn_client__mtcc_add_mkdir(const char *relpath,
125                            svn_client__mtcc_t *mtcc,
126                            apr_pool_t *scratch_pool);
127
128
129 /** Adds a move operation of the node @a src_relpath to @a dst_relpath to
130  * @a mtcc.
131  *
132  * Perform temporary allocations in @a scratch_pool.
133  *
134  * @since New in 1.9.
135  */
136 svn_error_t *
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);
141
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.
144  *
145  * If @a skip_checks is not FALSE Subversion defined properties are verified
146  * for correctness like svn_client_propset_remote()
147  *
148  * Perform temporary allocations in @a scratch_pool.
149  *
150  * @since New in 1.9.
151  */
152 svn_error_t *
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);
159
160
161 /** Adds an update file operation for @a relpath to @a mtcc.
162  *
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
165  * the final result.
166  *
167  * If @a base_checksum is provided it will be used by the repository to verify
168  * if the base file matches this checksum.
169  *
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.
172  *
173  * Perform temporary allocations in @a scratch_pool.
174  *
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.
177  *
178  * @since New in 1.9.
179  */
180 svn_error_t *
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);
188
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.
192  *
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.
195  *
196  * When a node does not exist this functions sets @a *kind to @c svn_node_node.
197  *
198  * @since New in 1.9.
199  */
200 svn_error_t *
201 svn_client__mtcc_check_path(svn_node_kind_t *kind,
202                             const char *relpath,
203                             svn_boolean_t check_repository,
204                             svn_client__mtcc_t *mtcc,
205                             apr_pool_t *scratch_pool);
206
207 /** Commits all operations stored in @a mtcc as a new revision and destroys
208  * @a mtcc.
209  *
210  * @since New in 1.9.
211  */
212 svn_error_t *
213 svn_client__mtcc_commit(apr_hash_t *revprop_table,
214                         svn_commit_callback2_t commit_callback,
215                         void *commit_baton,
216                         svn_client__mtcc_t *mtcc,
217                         apr_pool_t *scratch_pool);
218
219
220 /** @} end group: Multi Command Context related functions */
221
222 #ifdef __cplusplus
223 }
224 #endif /* __cplusplus */
225
226 #endif  /* SVN_CLIENT_MTCC_H */