]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - subversion/libsvn_fs/deprecated.c
Import Subversion-1.10.0
[FreeBSD/FreeBSD.git] / subversion / libsvn_fs / deprecated.c
1 /*
2  * deprecated.c:  holding file for all deprecated APIs.
3  *                "we can't lose 'em, but we can shun 'em!"
4  *
5  * ====================================================================
6  *    Licensed to the Apache Software Foundation (ASF) under one
7  *    or more contributor license agreements.  See the NOTICE file
8  *    distributed with this work for additional information
9  *    regarding copyright ownership.  The ASF licenses this file
10  *    to you under the Apache License, Version 2.0 (the
11  *    "License"); you may not use this file except in compliance
12  *    with the License.  You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  *    Unless required by applicable law or agreed to in writing,
17  *    software distributed under the License is distributed on an
18  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  *    KIND, either express or implied.  See the License for the
20  *    specific language governing permissions and limitations
21  *    under the License.
22  * ====================================================================
23  */
24
25 /* We define this here to remove any further warnings about the usage of
26    deprecated functions in this file. */
27 #define SVN_DEPRECATED
28
29 #include <apr_md5.h>
30 #include "svn_fs.h"
31 #include "private/svn_subr_private.h"
32
33 \f
34 /*** From fs-loader.c ***/
35 svn_error_t *
36 svn_fs_upgrade(const char *path, apr_pool_t *pool)
37 {
38   return svn_error_trace(svn_fs_upgrade2(path, NULL, NULL, NULL, NULL, pool));
39 }
40
41 svn_error_t *
42 svn_fs_hotcopy2(const char *src_path, const char *dest_path,
43                 svn_boolean_t clean, svn_boolean_t incremental,
44                 svn_cancel_func_t cancel_func, void *cancel_baton,
45                 apr_pool_t *scratch_pool)
46 {
47   return svn_error_trace(svn_fs_hotcopy3(src_path, dest_path, clean,
48                                          incremental, NULL, NULL,
49                                          cancel_func, cancel_baton,
50                                          scratch_pool));
51 }
52
53 svn_error_t *
54 svn_fs_hotcopy(const char *src_path, const char *dest_path,
55                svn_boolean_t clean, apr_pool_t *pool)
56 {
57   return svn_error_trace(svn_fs_hotcopy2(src_path, dest_path, clean,
58                                          FALSE, NULL, NULL, pool));
59 }
60
61 svn_error_t *
62 svn_fs_begin_txn(svn_fs_txn_t **txn_p, svn_fs_t *fs, svn_revnum_t rev,
63                  apr_pool_t *pool)
64 {
65   return svn_error_trace(svn_fs_begin_txn2(txn_p, fs, rev, 0, pool));
66 }
67
68 svn_error_t *
69 svn_fs_revision_prop(svn_string_t **value_p,
70                      svn_fs_t *fs,
71                      svn_revnum_t rev,
72                      const char *propname,
73                      apr_pool_t *pool)
74 {
75   return svn_error_trace(
76            svn_fs_revision_prop2(value_p, fs, rev, propname, TRUE, pool,
77                                  pool));
78 }
79
80 svn_error_t *
81 svn_fs_revision_proplist(apr_hash_t **table_p,
82                          svn_fs_t *fs,
83                          svn_revnum_t rev,
84                          apr_pool_t *pool)
85 {
86   return svn_error_trace(
87            svn_fs_revision_proplist2(table_p, fs, rev, TRUE, pool, pool));
88 }
89
90 svn_error_t *
91 svn_fs_change_rev_prop(svn_fs_t *fs, svn_revnum_t rev, const char *name,
92                        const svn_string_t *value, apr_pool_t *pool)
93 {
94   return svn_error_trace(
95            svn_fs_change_rev_prop2(fs, rev, name, NULL, value, pool));
96 }
97
98 svn_error_t *
99 svn_fs_get_locks(svn_fs_t *fs, const char *path,
100                  svn_fs_get_locks_callback_t get_locks_func,
101                  void *get_locks_baton, apr_pool_t *pool)
102 {
103   return svn_error_trace(svn_fs_get_locks2(fs, path, svn_depth_infinity,
104                                            get_locks_func, get_locks_baton,
105                                            pool));
106 }
107
108 svn_error_t *
109 svn_fs_create(svn_fs_t **fs_p,
110               const char *path,
111               apr_hash_t *fs_config,
112               apr_pool_t *pool)
113 {
114   return svn_fs_create2(fs_p, path, fs_config, pool, pool);
115 }
116
117 svn_error_t *
118 svn_fs_open(svn_fs_t **fs_p,
119             const char *path,
120             apr_hash_t *fs_config,
121             apr_pool_t *pool)
122 {
123   return svn_fs_open2(fs_p, path, fs_config, pool, pool);
124 }
125
126 svn_error_t *
127 svn_fs_node_history(svn_fs_history_t **history_p, svn_fs_root_t *root,
128                     const char *path, apr_pool_t *pool)
129 {
130   return svn_error_trace(svn_fs_node_history2(history_p, root, path,
131                                               pool, pool));
132 }
133
134 static svn_error_t *
135 mergeinfo_receiver(const char *path,
136                    svn_mergeinfo_t mergeinfo,
137                    void *baton,
138                    apr_pool_t *scratch_pool)
139 {
140   svn_mergeinfo_catalog_t catalog = baton;
141   apr_pool_t *result_pool = apr_hash_pool_get(catalog);
142   apr_size_t len = strlen(path);
143
144   apr_hash_set(catalog,
145                apr_pstrmemdup(result_pool, path, len),
146                len,
147                svn_mergeinfo_dup(mergeinfo, result_pool));
148
149   return SVN_NO_ERROR;
150 }
151
152 svn_error_t *
153 svn_fs_get_mergeinfo2(svn_mergeinfo_catalog_t *catalog,
154                       svn_fs_root_t *root,
155                       const apr_array_header_t *paths,
156                       svn_mergeinfo_inheritance_t inherit,
157                       svn_boolean_t include_descendants,
158                       svn_boolean_t adjust_inherited_mergeinfo,
159                       apr_pool_t *result_pool,
160                       apr_pool_t *scratch_pool)
161 {
162   svn_mergeinfo_catalog_t result_catalog = svn_hash__make(result_pool);
163   SVN_ERR(svn_fs_get_mergeinfo3(root, paths, inherit,
164                                 include_descendants,
165                                 adjust_inherited_mergeinfo,
166                                 mergeinfo_receiver, result_catalog,
167                                 scratch_pool));
168   *catalog = result_catalog;
169
170   return SVN_NO_ERROR;
171 }
172
173 svn_error_t *
174 svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
175                      svn_fs_root_t *root,
176                      const apr_array_header_t *paths,
177                      svn_mergeinfo_inheritance_t inherit,
178                      svn_boolean_t include_descendants,
179                      apr_pool_t *pool)
180 {
181   return svn_error_trace(svn_fs_get_mergeinfo2(catalog, root, paths,
182                                                inherit,
183                                                include_descendants,
184                                                TRUE, pool, pool));
185 }
186
187 svn_error_t *
188 svn_fs_paths_changed(apr_hash_t **changed_paths_p, svn_fs_root_t *root,
189                      apr_pool_t *pool)
190 {
191   apr_hash_t *changed_paths_new_structs;
192   apr_hash_index_t *hi;
193
194   SVN_ERR(svn_fs_paths_changed2(&changed_paths_new_structs, root, pool));
195   *changed_paths_p = apr_hash_make(pool);
196   for (hi = apr_hash_first(pool, changed_paths_new_structs);
197        hi;
198        hi = apr_hash_next(hi))
199     {
200       const void *vkey;
201       apr_ssize_t klen;
202       void *vval;
203       svn_fs_path_change2_t *val;
204       svn_fs_path_change_t *change;
205       apr_hash_this(hi, &vkey, &klen, &vval);
206       val = vval;
207       change = apr_palloc(pool, sizeof(*change));
208       change->node_rev_id = val->node_rev_id;
209       change->change_kind = val->change_kind;
210       change->text_mod = val->text_mod;
211       change->prop_mod = val->prop_mod;
212       apr_hash_set(*changed_paths_p, vkey, klen, change);
213     }
214   return SVN_NO_ERROR;
215 }
216
217 svn_error_t *
218 svn_fs_file_md5_checksum(unsigned char digest[],
219                          svn_fs_root_t *root,
220                          const char *path,
221                          apr_pool_t *pool)
222 {
223   svn_checksum_t *md5sum;
224
225   SVN_ERR(svn_fs_file_checksum(&md5sum, svn_checksum_md5, root, path, TRUE,
226                                pool));
227   memcpy(digest, md5sum->digest, APR_MD5_DIGESTSIZE);
228
229   return SVN_NO_ERROR;
230 }
231
232 svn_error_t *
233 svn_fs_history_prev(svn_fs_history_t **prev_history_p,
234                     svn_fs_history_t *history, svn_boolean_t cross_copies,
235                     apr_pool_t *pool)
236 {
237   return svn_error_trace(svn_fs_history_prev2(prev_history_p, history,
238                                               cross_copies, pool, pool));
239 }
240
241 /*** From access.c ***/
242 svn_error_t *
243 svn_fs_access_add_lock_token(svn_fs_access_t *access_ctx,
244                              const char *token)
245 {
246   return svn_fs_access_add_lock_token2(access_ctx, (const char *) 1, token);
247 }