2 * deprecated.c: holding file for all deprecated APIs.
3 * "we can't lose 'em, but we can shun 'em!"
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
14 * http://www.apache.org/licenses/LICENSE-2.0
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
22 * ====================================================================
25 /* We define this here to remove any further warnings about the usage of
26 deprecated functions in this file. */
27 #define SVN_DEPRECATED
32 #include "svn_compat.h"
33 #include "svn_props.h"
34 #include "svn_pools.h"
36 #include "ra_loader.h"
37 #include "deprecated.h"
39 #include "svn_private_config.h"
44 /*** From ra_loader.c ***/
45 /*** Compatibility Wrappers ***/
47 /* Wrap @c svn_ra_reporter3_t in an interface that looks like
48 @c svn_ra_reporter2_t, for compatibility with functions that take
49 the latter. This shields the ra-specific implementations from
50 worrying about what kind of reporter they're dealing with.
52 This code does not live in wrapper_template.h because that file is
53 about the big changeover from a vtable-style to function-style
54 interface, and does not contain the post-changeover interfaces
55 that we are compatiblizing here.
57 This code looks like it duplicates code in libsvn_wc/adm_crawler.c,
58 but in fact it does not. That code makes old things look like new
59 things; this code makes a new thing look like an old thing. */
61 /* Baton for abovementioned wrapping. */
62 struct reporter_3in2_baton {
63 const svn_ra_reporter3_t *reporter3;
64 void *reporter3_baton;
67 /* Wrap the corresponding svn_ra_reporter3_t field in an
68 svn_ra_reporter2_t interface. @a report_baton is a
69 @c reporter_3in2_baton_t *. */
71 set_path(void *report_baton,
73 svn_revnum_t revision,
74 svn_boolean_t start_empty,
75 const char *lock_token,
78 struct reporter_3in2_baton *b = report_baton;
79 return b->reporter3->set_path(b->reporter3_baton,
80 path, revision, svn_depth_infinity,
81 start_empty, lock_token, pool);
84 /* Wrap the corresponding svn_ra_reporter3_t field in an
85 svn_ra_reporter2_t interface. @a report_baton is a
86 @c reporter_3in2_baton_t *. */
88 delete_path(void *report_baton,
92 struct reporter_3in2_baton *b = report_baton;
93 return b->reporter3->delete_path(b->reporter3_baton, path, pool);
96 /* Wrap the corresponding svn_ra_reporter3_t field in an
97 svn_ra_reporter2_t interface. @a report_baton is a
98 @c reporter_3in2_baton_t *. */
100 link_path(void *report_baton,
103 svn_revnum_t revision,
104 svn_boolean_t start_empty,
105 const char *lock_token,
108 struct reporter_3in2_baton *b = report_baton;
109 return b->reporter3->link_path(b->reporter3_baton,
110 path, url, revision, svn_depth_infinity,
111 start_empty, lock_token, pool);
115 /* Wrap the corresponding svn_ra_reporter3_t field in an
116 svn_ra_reporter2_t interface. @a report_baton is a
117 @c reporter_3in2_baton_t *. */
119 finish_report(void *report_baton,
122 struct reporter_3in2_baton *b = report_baton;
123 return b->reporter3->finish_report(b->reporter3_baton, pool);
126 /* Wrap the corresponding svn_ra_reporter3_t field in an
127 svn_ra_reporter2_t interface. @a report_baton is a
128 @c reporter_3in2_baton_t *. */
130 abort_report(void *report_baton,
133 struct reporter_3in2_baton *b = report_baton;
134 return b->reporter3->abort_report(b->reporter3_baton, pool);
137 /* Wrap svn_ra_reporter3_t calls in an svn_ra_reporter2_t interface.
139 Note: For calls where the prototypes are exactly the same, we could
140 avoid the pass-through overhead by using the function in the
141 reporter returned from session->vtable->do_foo. But the code would
142 get a lot less readable, and the only benefit would be to shave a
143 few instructions in a network-bound operation anyway. So in
144 delete_path(), finish_report(), and abort_report(), we cheerfully
145 pass through to identical functions. */
146 static svn_ra_reporter2_t reporter_3in2_wrapper = {
154 svn_error_t *svn_ra_open3(svn_ra_session_t **session_p,
155 const char *repos_URL,
157 const svn_ra_callbacks2_t *callbacks,
158 void *callback_baton,
162 return svn_ra_open4(session_p, NULL, repos_URL, uuid,
163 callbacks, callback_baton, config, pool);
166 svn_error_t *svn_ra_open2(svn_ra_session_t **session_p,
167 const char *repos_URL,
168 const svn_ra_callbacks2_t *callbacks,
169 void *callback_baton,
173 return svn_ra_open3(session_p, repos_URL, NULL,
174 callbacks, callback_baton, config, pool);
177 svn_error_t *svn_ra_open(svn_ra_session_t **session_p,
178 const char *repos_URL,
179 const svn_ra_callbacks_t *callbacks,
180 void *callback_baton,
184 /* Deprecated function. Copy the contents of the svn_ra_callbacks_t
185 to a new svn_ra_callbacks2_t and call svn_ra_open2(). */
186 svn_ra_callbacks2_t *callbacks2;
187 SVN_ERR(svn_ra_create_callbacks(&callbacks2, pool));
188 callbacks2->open_tmp_file = callbacks->open_tmp_file;
189 callbacks2->auth_baton = callbacks->auth_baton;
190 callbacks2->get_wc_prop = callbacks->get_wc_prop;
191 callbacks2->set_wc_prop = callbacks->set_wc_prop;
192 callbacks2->push_wc_prop = callbacks->push_wc_prop;
193 callbacks2->invalidate_wc_props = callbacks->invalidate_wc_props;
194 callbacks2->progress_func = NULL;
195 callbacks2->progress_baton = NULL;
196 return svn_ra_open2(session_p, repos_URL,
197 callbacks2, callback_baton,
201 svn_error_t *svn_ra_change_rev_prop(svn_ra_session_t *session,
204 const svn_string_t *value,
207 return svn_ra_change_rev_prop2(session, rev, name, NULL, value, pool);
210 svn_error_t *svn_ra_get_commit_editor2(svn_ra_session_t *session,
211 const svn_delta_editor_t **editor,
214 svn_commit_callback2_t commit_callback,
216 apr_hash_t *lock_tokens,
217 svn_boolean_t keep_locks,
220 apr_hash_t *revprop_table = apr_hash_make(pool);
222 svn_hash_sets(revprop_table, SVN_PROP_REVISION_LOG,
223 svn_string_create(log_msg, pool));
224 return svn_ra_get_commit_editor3(session, editor, edit_baton, revprop_table,
225 commit_callback, commit_baton,
226 lock_tokens, keep_locks, pool);
229 svn_error_t *svn_ra_get_commit_editor(svn_ra_session_t *session,
230 const svn_delta_editor_t **editor,
233 svn_commit_callback_t callback,
234 void *callback_baton,
235 apr_hash_t *lock_tokens,
236 svn_boolean_t keep_locks,
239 svn_commit_callback2_t callback2;
240 void *callback2_baton;
242 svn_compat_wrap_commit_callback(&callback2, &callback2_baton,
243 callback, callback_baton,
246 return svn_ra_get_commit_editor2(session, editor, edit_baton,
248 callback2_baton, lock_tokens,
252 svn_error_t *svn_ra_do_diff2(svn_ra_session_t *session,
253 const svn_ra_reporter2_t **reporter,
255 svn_revnum_t revision,
256 const char *diff_target,
257 svn_boolean_t recurse,
258 svn_boolean_t ignore_ancestry,
259 svn_boolean_t text_deltas,
260 const char *versus_url,
261 const svn_delta_editor_t *diff_editor,
265 struct reporter_3in2_baton *b = apr_palloc(pool, sizeof(*b));
266 SVN_ERR_ASSERT(svn_path_is_empty(diff_target)
267 || svn_path_is_single_path_component(diff_target));
268 *reporter = &reporter_3in2_wrapper;
270 return session->vtable->do_diff(session,
271 &(b->reporter3), &(b->reporter3_baton),
272 revision, diff_target,
273 SVN_DEPTH_INFINITY_OR_FILES(recurse),
274 ignore_ancestry, text_deltas, versus_url,
275 diff_editor, diff_baton, pool);
278 svn_error_t *svn_ra_do_diff(svn_ra_session_t *session,
279 const svn_ra_reporter2_t **reporter,
281 svn_revnum_t revision,
282 const char *diff_target,
283 svn_boolean_t recurse,
284 svn_boolean_t ignore_ancestry,
285 const char *versus_url,
286 const svn_delta_editor_t *diff_editor,
290 SVN_ERR_ASSERT(svn_path_is_empty(diff_target)
291 || svn_path_is_single_path_component(diff_target));
292 return svn_ra_do_diff2(session, reporter, report_baton, revision,
293 diff_target, recurse, ignore_ancestry, TRUE,
294 versus_url, diff_editor, diff_baton, pool);
297 svn_error_t *svn_ra_get_log(svn_ra_session_t *session,
298 const apr_array_header_t *paths,
302 svn_boolean_t discover_changed_paths,
303 svn_boolean_t strict_node_history,
304 svn_log_message_receiver_t receiver,
305 void *receiver_baton,
308 svn_log_entry_receiver_t receiver2;
309 void *receiver2_baton;
314 for (i = 0; i < paths->nelts; i++)
316 const char *path = APR_ARRAY_IDX(paths, i, const char *);
317 SVN_ERR_ASSERT(*path != '/');
321 svn_compat_wrap_log_receiver(&receiver2, &receiver2_baton,
322 receiver, receiver_baton,
325 return svn_ra_get_log2(session, paths, start, end, limit,
326 discover_changed_paths, strict_node_history,
327 FALSE, svn_compat_log_revprops_in(pool),
328 receiver2, receiver2_baton, pool);
331 svn_error_t *svn_ra_get_file_revs(svn_ra_session_t *session,
335 svn_ra_file_rev_handler_t handler,
339 svn_file_rev_handler_t handler2;
340 void *handler2_baton;
342 SVN_ERR_ASSERT(*path != '/');
344 svn_compat_wrap_file_rev_handler(&handler2, &handler2_baton,
345 handler, handler_baton,
348 return svn_ra_get_file_revs2(session, path, start, end, FALSE, handler2,
349 handler2_baton, pool);
353 svn_ra_do_update2(svn_ra_session_t *session,
354 const svn_ra_reporter3_t **reporter,
356 svn_revnum_t revision_to_update_to,
357 const char *update_target,
359 svn_boolean_t send_copyfrom_args,
360 const svn_delta_editor_t *update_editor,
364 return svn_error_trace(
365 svn_ra_do_update3(session,
366 reporter, report_baton,
367 revision_to_update_to, update_target,
370 FALSE /* ignore_ancestry */,
371 update_editor, update_baton,
375 svn_error_t *svn_ra_do_update(svn_ra_session_t *session,
376 const svn_ra_reporter2_t **reporter,
378 svn_revnum_t revision_to_update_to,
379 const char *update_target,
380 svn_boolean_t recurse,
381 const svn_delta_editor_t *update_editor,
385 struct reporter_3in2_baton *b = apr_palloc(pool, sizeof(*b));
386 SVN_ERR_ASSERT(svn_path_is_empty(update_target)
387 || svn_path_is_single_path_component(update_target));
388 *reporter = &reporter_3in2_wrapper;
390 return session->vtable->do_update(session,
391 &(b->reporter3), &(b->reporter3_baton),
392 revision_to_update_to, update_target,
393 SVN_DEPTH_INFINITY_OR_FILES(recurse),
394 FALSE, /* no copyfrom args */
395 FALSE /* ignore_ancestry */,
396 update_editor, update_baton,
402 svn_ra_do_switch2(svn_ra_session_t *session,
403 const svn_ra_reporter3_t **reporter,
405 svn_revnum_t revision_to_switch_to,
406 const char *switch_target,
408 const char *switch_url,
409 const svn_delta_editor_t *switch_editor,
413 return svn_error_trace(
414 svn_ra_do_switch3(session,
415 reporter, report_baton,
416 revision_to_switch_to, switch_target,
419 FALSE /* send_copyfrom_args */,
420 TRUE /* ignore_ancestry */,
421 switch_editor, switch_baton,
425 svn_error_t *svn_ra_do_switch(svn_ra_session_t *session,
426 const svn_ra_reporter2_t **reporter,
428 svn_revnum_t revision_to_switch_to,
429 const char *switch_target,
430 svn_boolean_t recurse,
431 const char *switch_url,
432 const svn_delta_editor_t *switch_editor,
436 struct reporter_3in2_baton *b = apr_palloc(pool, sizeof(*b));
437 SVN_ERR_ASSERT(svn_path_is_empty(switch_target)
438 || svn_path_is_single_path_component(switch_target));
439 *reporter = &reporter_3in2_wrapper;
441 return session->vtable->do_switch(session,
442 &(b->reporter3), &(b->reporter3_baton),
443 revision_to_switch_to, switch_target,
444 SVN_DEPTH_INFINITY_OR_FILES(recurse),
446 FALSE /* send_copyfrom_args */,
447 TRUE /* ignore_ancestry */,
448 switch_editor, switch_baton,
452 svn_error_t *svn_ra_do_status(svn_ra_session_t *session,
453 const svn_ra_reporter2_t **reporter,
455 const char *status_target,
456 svn_revnum_t revision,
457 svn_boolean_t recurse,
458 const svn_delta_editor_t *status_editor,
462 struct reporter_3in2_baton *b = apr_palloc(pool, sizeof(*b));
463 SVN_ERR_ASSERT(svn_path_is_empty(status_target)
464 || svn_path_is_single_path_component(status_target));
465 *reporter = &reporter_3in2_wrapper;
467 return session->vtable->do_status(session,
468 &(b->reporter3), &(b->reporter3_baton),
469 status_target, revision,
470 SVN_DEPTH_INFINITY_OR_IMMEDIATES(recurse),
471 status_editor, status_baton, pool);
474 svn_error_t *svn_ra_get_dir(svn_ra_session_t *session,
476 svn_revnum_t revision,
477 apr_hash_t **dirents,
478 svn_revnum_t *fetched_rev,
482 SVN_ERR_ASSERT(*path != '/');
483 return session->vtable->get_dir(session, dirents, fetched_rev, props,
484 path, revision, SVN_DIRENT_ALL, pool);
488 svn_ra_local__deprecated_init(int abi_version,
492 return svn_error_trace(svn_ra_local_init(abi_version, pool, hash));
496 svn_ra_svn__deprecated_init(int abi_version,
500 return svn_error_trace(svn_ra_svn_init(abi_version, pool, hash));
504 svn_ra_serf__deprecated_init(int abi_version,
508 return svn_error_trace(svn_ra_serf_init(abi_version, pool, hash));