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 /* ==================================================================== */
31 /* We define this here to remove any further warnings about the usage of
32 deprecated functions in this file. */
33 #define SVN_DEPRECATED
36 #include "svn_client.h"
38 #include "svn_compat.h"
40 #include "svn_props.h"
42 #include "svn_string.h"
43 #include "svn_pools.h"
46 #include "mergeinfo.h"
48 #include "private/svn_opt_private.h"
49 #include "private/svn_wc_private.h"
50 #include "svn_private_config.h"
58 /* Baton for capture_commit_info() */
59 struct capture_baton_t {
60 svn_commit_info_t **info;
65 /* Callback which implements svn_commit_callback2_t for use with some
66 backward compat functions. */
68 capture_commit_info(const svn_commit_info_t *commit_info,
72 struct capture_baton_t *cb = baton;
74 *(cb->info) = svn_commit_info_dup(commit_info, cb->pool);
82 svn_client_add4(const char *path,
85 svn_boolean_t no_ignore,
86 svn_boolean_t add_parents,
87 svn_client_ctx_t *ctx,
90 return svn_client_add5(path, depth, force, no_ignore, FALSE, add_parents,
95 svn_client_add3(const char *path,
96 svn_boolean_t recursive,
98 svn_boolean_t no_ignore,
99 svn_client_ctx_t *ctx,
102 return svn_client_add4(path, SVN_DEPTH_INFINITY_OR_EMPTY(recursive),
103 force, no_ignore, FALSE, ctx,
108 svn_client_add2(const char *path,
109 svn_boolean_t recursive,
111 svn_client_ctx_t *ctx,
114 return svn_client_add3(path, recursive, force, FALSE, ctx, pool);
118 svn_client_add(const char *path,
119 svn_boolean_t recursive,
120 svn_client_ctx_t *ctx,
123 return svn_client_add3(path, recursive, FALSE, FALSE, ctx, pool);
127 svn_client_mkdir3(svn_commit_info_t **commit_info_p,
128 const apr_array_header_t *paths,
129 svn_boolean_t make_parents,
130 const apr_hash_t *revprop_table,
131 svn_client_ctx_t *ctx,
134 struct capture_baton_t cb;
136 cb.info = commit_info_p;
139 return svn_client_mkdir4(paths, make_parents, revprop_table,
140 capture_commit_info, &cb, ctx, pool);
144 svn_client_mkdir2(svn_commit_info_t **commit_info_p,
145 const apr_array_header_t *paths,
146 svn_client_ctx_t *ctx,
149 return svn_client_mkdir3(commit_info_p, paths, FALSE, NULL, ctx, pool);
154 svn_client_mkdir(svn_client_commit_info_t **commit_info_p,
155 const apr_array_header_t *paths,
156 svn_client_ctx_t *ctx,
159 svn_commit_info_t *commit_info = NULL;
162 err = svn_client_mkdir2(&commit_info, paths, ctx, pool);
163 /* These structs have the same layout for the common fields. */
164 *commit_info_p = (svn_client_commit_info_t *) commit_info;
165 return svn_error_trace(err);
168 /*** From blame.c ***/
170 struct blame_receiver_wrapper_baton2 {
172 svn_client_blame_receiver2_t receiver;
176 blame_wrapper_receiver2(void *baton,
177 svn_revnum_t start_revnum,
178 svn_revnum_t end_revnum,
180 svn_revnum_t revision,
181 apr_hash_t *rev_props,
182 svn_revnum_t merged_revision,
183 apr_hash_t *merged_rev_props,
184 const char *merged_path,
186 svn_boolean_t local_change,
189 struct blame_receiver_wrapper_baton2 *brwb = baton;
190 const char *author = NULL;
191 const char *date = NULL;
192 const char *merged_author = NULL;
193 const char *merged_date = NULL;
195 if (rev_props != NULL)
197 author = svn_prop_get_value(rev_props, SVN_PROP_REVISION_AUTHOR);
198 date = svn_prop_get_value(rev_props, SVN_PROP_REVISION_DATE);
200 if (merged_rev_props != NULL)
202 merged_author = svn_prop_get_value(merged_rev_props,
203 SVN_PROP_REVISION_AUTHOR);
204 merged_date = svn_prop_get_value(merged_rev_props,
205 SVN_PROP_REVISION_DATE);
209 return brwb->receiver(brwb->baton, line_no, revision, author, date,
210 merged_revision, merged_author, merged_date,
211 merged_path, line, pool);
217 svn_client_blame4(const char *target,
218 const svn_opt_revision_t *peg_revision,
219 const svn_opt_revision_t *start,
220 const svn_opt_revision_t *end,
221 const svn_diff_file_options_t *diff_options,
222 svn_boolean_t ignore_mime_type,
223 svn_boolean_t include_merged_revisions,
224 svn_client_blame_receiver2_t receiver,
225 void *receiver_baton,
226 svn_client_ctx_t *ctx,
229 struct blame_receiver_wrapper_baton2 baton;
231 baton.receiver = receiver;
232 baton.baton = receiver_baton;
234 return svn_client_blame5(target, peg_revision, start, end, diff_options,
235 ignore_mime_type, include_merged_revisions,
236 blame_wrapper_receiver2, &baton, ctx, pool);
240 /* Baton for use with wrap_blame_receiver */
241 struct blame_receiver_wrapper_baton {
243 svn_client_blame_receiver_t receiver;
246 /* This implements svn_client_blame_receiver2_t */
248 blame_wrapper_receiver(void *baton,
250 svn_revnum_t revision,
253 svn_revnum_t merged_revision,
254 const char *merged_author,
255 const char *merged_date,
256 const char *merged_path,
260 struct blame_receiver_wrapper_baton *brwb = baton;
263 return brwb->receiver(brwb->baton,
264 line_no, revision, author, date, line, pool);
270 wrap_blame_receiver(svn_client_blame_receiver2_t *receiver2,
271 void **receiver2_baton,
272 svn_client_blame_receiver_t receiver,
273 void *receiver_baton,
276 struct blame_receiver_wrapper_baton *brwb = apr_palloc(pool, sizeof(*brwb));
278 /* Set the user provided old format callback in the baton. */
279 brwb->baton = receiver_baton;
280 brwb->receiver = receiver;
282 *receiver2_baton = brwb;
283 *receiver2 = blame_wrapper_receiver;
287 svn_client_blame3(const char *target,
288 const svn_opt_revision_t *peg_revision,
289 const svn_opt_revision_t *start,
290 const svn_opt_revision_t *end,
291 const svn_diff_file_options_t *diff_options,
292 svn_boolean_t ignore_mime_type,
293 svn_client_blame_receiver_t receiver,
294 void *receiver_baton,
295 svn_client_ctx_t *ctx,
298 svn_client_blame_receiver2_t receiver2;
299 void *receiver2_baton;
301 wrap_blame_receiver(&receiver2, &receiver2_baton, receiver, receiver_baton,
304 return svn_client_blame4(target, peg_revision, start, end, diff_options,
305 ignore_mime_type, FALSE, receiver2, receiver2_baton,
309 /* svn_client_blame3 guarantees 'no EOL chars' as part of the receiver
310 LINE argument. Older versions depend on the fact that if a CR is
311 required, that CR is already part of the LINE data.
313 Because of this difference, we need to trap old receivers and append
314 a CR to LINE before passing it on to the actual receiver on platforms
315 which want CRLF line termination.
319 struct wrapped_receiver_baton_s
321 svn_client_blame_receiver_t orig_receiver;
326 wrapped_receiver(void *baton,
328 svn_revnum_t revision,
334 struct wrapped_receiver_baton_s *b = baton;
335 svn_stringbuf_t *expanded_line = svn_stringbuf_create(line, pool);
337 svn_stringbuf_appendbyte(expanded_line, '\r');
339 return b->orig_receiver(b->orig_baton, line_no, revision, author,
340 date, expanded_line->data, pool);
344 wrap_pre_blame3_receiver(svn_client_blame_receiver_t *receiver,
345 void **receiver_baton,
348 if (sizeof(APR_EOL_STR) == 3)
350 struct wrapped_receiver_baton_s *b = apr_palloc(pool,sizeof(*b));
352 b->orig_receiver = *receiver;
353 b->orig_baton = *receiver_baton;
356 *receiver = wrapped_receiver;
361 svn_client_blame2(const char *target,
362 const svn_opt_revision_t *peg_revision,
363 const svn_opt_revision_t *start,
364 const svn_opt_revision_t *end,
365 svn_client_blame_receiver_t receiver,
366 void *receiver_baton,
367 svn_client_ctx_t *ctx,
370 wrap_pre_blame3_receiver(&receiver, &receiver_baton, pool);
371 return svn_client_blame3(target, peg_revision, start, end,
372 svn_diff_file_options_create(pool), FALSE,
373 receiver, receiver_baton, ctx, pool);
376 svn_client_blame(const char *target,
377 const svn_opt_revision_t *start,
378 const svn_opt_revision_t *end,
379 svn_client_blame_receiver_t receiver,
380 void *receiver_baton,
381 svn_client_ctx_t *ctx,
384 wrap_pre_blame3_receiver(&receiver, &receiver_baton, pool);
385 return svn_client_blame2(target, end, start, end,
386 receiver, receiver_baton, ctx, pool);
389 /*** From cmdline.c ***/
391 svn_client_args_to_target_array(apr_array_header_t **targets_p,
393 const apr_array_header_t *known_targets,
394 svn_client_ctx_t *ctx,
397 return svn_client_args_to_target_array2(targets_p, os, known_targets, ctx,
401 /*** From commit.c ***/
403 svn_client_import4(const char *path,
406 svn_boolean_t no_ignore,
407 svn_boolean_t ignore_unknown_node_types,
408 const apr_hash_t *revprop_table,
409 svn_commit_callback2_t commit_callback,
411 svn_client_ctx_t *ctx,
414 return svn_error_trace(svn_client_import5(path, url, depth, no_ignore,
415 FALSE, ignore_unknown_node_types,
418 commit_callback, commit_baton,
424 svn_client_import3(svn_commit_info_t **commit_info_p,
428 svn_boolean_t no_ignore,
429 svn_boolean_t ignore_unknown_node_types,
430 const apr_hash_t *revprop_table,
431 svn_client_ctx_t *ctx,
434 struct capture_baton_t cb;
436 cb.info = commit_info_p;
439 return svn_client_import4(path, url, depth, no_ignore,
440 ignore_unknown_node_types, revprop_table,
441 capture_commit_info, &cb, ctx, pool);
445 svn_client_import2(svn_commit_info_t **commit_info_p,
448 svn_boolean_t nonrecursive,
449 svn_boolean_t no_ignore,
450 svn_client_ctx_t *ctx,
453 return svn_client_import3(commit_info_p,
455 SVN_DEPTH_INFINITY_OR_FILES(! nonrecursive),
456 no_ignore, FALSE, NULL, ctx, pool);
460 svn_client_import(svn_client_commit_info_t **commit_info_p,
463 svn_boolean_t nonrecursive,
464 svn_client_ctx_t *ctx,
467 svn_commit_info_t *commit_info = NULL;
470 err = svn_client_import2(&commit_info,
471 path, url, nonrecursive,
473 /* These structs have the same layout for the common fields. */
474 *commit_info_p = (svn_client_commit_info_t *) commit_info;
475 return svn_error_trace(err);
479 /* Wrapper notify_func2 function and baton for downgrading
480 svn_wc_notify_commit_copied and svn_wc_notify_commit_copied_replaced
481 to svn_wc_notify_commit_added and svn_wc_notify_commit_replaced,
483 struct downgrade_commit_copied_notify_baton
485 svn_wc_notify_func2_t orig_notify_func2;
486 void *orig_notify_baton2;
490 downgrade_commit_copied_notify_func(void *baton,
491 const svn_wc_notify_t *notify,
494 struct downgrade_commit_copied_notify_baton *b = baton;
496 if (notify->action == svn_wc_notify_commit_copied)
498 svn_wc_notify_t *my_notify = svn_wc_dup_notify(notify, pool);
499 my_notify->action = svn_wc_notify_commit_added;
502 else if (notify->action == svn_wc_notify_commit_copied_replaced)
504 svn_wc_notify_t *my_notify = svn_wc_dup_notify(notify, pool);
505 my_notify->action = svn_wc_notify_commit_replaced;
509 /* Call the wrapped notification system (if any) with MY_NOTIFY,
510 which is either the original NOTIFY object, or a tweaked deep
512 if (b->orig_notify_func2)
513 b->orig_notify_func2(b->orig_notify_baton2, notify, pool);
517 svn_client_commit5(const apr_array_header_t *targets,
519 svn_boolean_t keep_locks,
520 svn_boolean_t keep_changelists,
521 svn_boolean_t commit_as_operations,
522 const apr_array_header_t *changelists,
523 const apr_hash_t *revprop_table,
524 svn_commit_callback2_t commit_callback,
526 svn_client_ctx_t *ctx,
529 return svn_client_commit6(targets, depth, keep_locks, keep_changelists,
530 commit_as_operations,
531 FALSE, /* include_file_externals */
532 FALSE, /* include_dir_externals */
533 changelists, revprop_table, commit_callback,
534 commit_baton, ctx, pool);
538 svn_client_commit4(svn_commit_info_t **commit_info_p,
539 const apr_array_header_t *targets,
541 svn_boolean_t keep_locks,
542 svn_boolean_t keep_changelists,
543 const apr_array_header_t *changelists,
544 const apr_hash_t *revprop_table,
545 svn_client_ctx_t *ctx,
548 struct capture_baton_t cb;
549 struct downgrade_commit_copied_notify_baton notify_baton;
552 notify_baton.orig_notify_func2 = ctx->notify_func2;
553 notify_baton.orig_notify_baton2 = ctx->notify_baton2;
555 *commit_info_p = NULL;
556 cb.info = commit_info_p;
559 /* Swap out the notification system (if any) with a thin filtering
561 if (ctx->notify_func2)
563 ctx->notify_func2 = downgrade_commit_copied_notify_func;
564 ctx->notify_baton2 = ¬ify_baton;
567 err = svn_client_commit5(targets, depth, keep_locks, keep_changelists, FALSE,
568 changelists, revprop_table,
569 capture_commit_info, &cb, ctx, pool);
571 /* Ensure that the original notification system is in place. */
572 ctx->notify_func2 = notify_baton.orig_notify_func2;
573 ctx->notify_baton2 = notify_baton.orig_notify_baton2;
577 if (! *commit_info_p)
578 *commit_info_p = svn_create_commit_info(pool);
584 svn_client_commit3(svn_commit_info_t **commit_info_p,
585 const apr_array_header_t *targets,
586 svn_boolean_t recurse,
587 svn_boolean_t keep_locks,
588 svn_client_ctx_t *ctx,
591 svn_depth_t depth = SVN_DEPTH_INFINITY_OR_EMPTY(recurse);
593 return svn_client_commit4(commit_info_p, targets, depth, keep_locks,
594 FALSE, NULL, NULL, ctx, pool);
598 svn_client_commit2(svn_client_commit_info_t **commit_info_p,
599 const apr_array_header_t *targets,
600 svn_boolean_t recurse,
601 svn_boolean_t keep_locks,
602 svn_client_ctx_t *ctx,
605 svn_commit_info_t *commit_info = NULL;
608 err = svn_client_commit3(&commit_info, targets, recurse, keep_locks,
610 /* These structs have the same layout for the common fields. */
611 *commit_info_p = (svn_client_commit_info_t *) commit_info;
612 return svn_error_trace(err);
616 svn_client_commit(svn_client_commit_info_t **commit_info_p,
617 const apr_array_header_t *targets,
618 svn_boolean_t nonrecursive,
619 svn_client_ctx_t *ctx,
622 return svn_client_commit2(commit_info_p, targets,
628 /*** From copy.c ***/
630 svn_client_copy5(svn_commit_info_t **commit_info_p,
631 const apr_array_header_t *sources,
632 const char *dst_path,
633 svn_boolean_t copy_as_child,
634 svn_boolean_t make_parents,
635 svn_boolean_t ignore_externals,
636 const apr_hash_t *revprop_table,
637 svn_client_ctx_t *ctx,
640 struct capture_baton_t cb;
642 cb.info = commit_info_p;
645 return svn_client_copy6(sources, dst_path, copy_as_child, make_parents,
646 ignore_externals, revprop_table,
647 capture_commit_info, &cb, ctx, pool);
651 svn_client_copy4(svn_commit_info_t **commit_info_p,
652 const apr_array_header_t *sources,
653 const char *dst_path,
654 svn_boolean_t copy_as_child,
655 svn_boolean_t make_parents,
656 const apr_hash_t *revprop_table,
657 svn_client_ctx_t *ctx,
660 return svn_client_copy5(commit_info_p, sources, dst_path, copy_as_child,
661 make_parents, FALSE, revprop_table, ctx, pool);
665 svn_client_copy3(svn_commit_info_t **commit_info_p,
666 const char *src_path,
667 const svn_opt_revision_t *src_revision,
668 const char *dst_path,
669 svn_client_ctx_t *ctx,
672 apr_array_header_t *sources = apr_array_make(pool, 1,
673 sizeof(const svn_client_copy_source_t *));
674 svn_client_copy_source_t copy_source;
676 copy_source.path = src_path;
677 copy_source.revision = src_revision;
678 copy_source.peg_revision = src_revision;
680 APR_ARRAY_PUSH(sources, const svn_client_copy_source_t *) = ©_source;
682 return svn_client_copy4(commit_info_p, sources, dst_path, FALSE, FALSE,
687 svn_client_copy2(svn_commit_info_t **commit_info_p,
688 const char *src_path,
689 const svn_opt_revision_t *src_revision,
690 const char *dst_path,
691 svn_client_ctx_t *ctx,
696 err = svn_client_copy3(commit_info_p, src_path, src_revision,
697 dst_path, ctx, pool);
699 /* If the target exists, try to copy the source as a child of the target.
700 This will obviously fail if target is not a directory, but that's exactly
702 if (err && (err->apr_err == SVN_ERR_ENTRY_EXISTS
703 || err->apr_err == SVN_ERR_FS_ALREADY_EXISTS))
705 const char *src_basename = svn_path_basename(src_path, pool);
707 svn_error_clear(err);
709 return svn_client_copy3(commit_info_p, src_path, src_revision,
710 svn_path_join(dst_path, src_basename, pool),
714 return svn_error_trace(err);
718 svn_client_copy(svn_client_commit_info_t **commit_info_p,
719 const char *src_path,
720 const svn_opt_revision_t *src_revision,
721 const char *dst_path,
722 svn_client_ctx_t *ctx,
725 svn_commit_info_t *commit_info = NULL;
728 err = svn_client_copy2(&commit_info, src_path, src_revision, dst_path,
730 /* These structs have the same layout for the common fields. */
731 *commit_info_p = (svn_client_commit_info_t *) commit_info;
732 return svn_error_trace(err);
736 svn_client_move6(const apr_array_header_t *src_paths,
737 const char *dst_path,
738 svn_boolean_t move_as_child,
739 svn_boolean_t make_parents,
740 const apr_hash_t *revprop_table,
741 svn_commit_callback2_t commit_callback,
743 svn_client_ctx_t *ctx,
746 return svn_error_trace(svn_client_move7(src_paths, dst_path,
747 move_as_child, make_parents,
748 TRUE /* allow_mixed_revisions */,
749 FALSE /* metadata_only */,
751 commit_callback, commit_baton,
756 svn_client_move5(svn_commit_info_t **commit_info_p,
757 const apr_array_header_t *src_paths,
758 const char *dst_path,
760 svn_boolean_t move_as_child,
761 svn_boolean_t make_parents,
762 const apr_hash_t *revprop_table,
763 svn_client_ctx_t *ctx,
766 struct capture_baton_t cb;
768 cb.info = commit_info_p;
771 return svn_client_move6(src_paths, dst_path, move_as_child,
772 make_parents, revprop_table,
773 capture_commit_info, &cb, ctx, pool);
777 svn_client_move4(svn_commit_info_t **commit_info_p,
778 const char *src_path,
779 const char *dst_path,
781 svn_client_ctx_t *ctx,
784 apr_array_header_t *src_paths =
785 apr_array_make(pool, 1, sizeof(const char *));
786 APR_ARRAY_PUSH(src_paths, const char *) = src_path;
789 return svn_client_move5(commit_info_p, src_paths, dst_path, force, FALSE,
790 FALSE, NULL, ctx, pool);
794 svn_client_move3(svn_commit_info_t **commit_info_p,
795 const char *src_path,
796 const char *dst_path,
798 svn_client_ctx_t *ctx,
803 err = svn_client_move4(commit_info_p, src_path, dst_path, force, ctx, pool);
805 /* If the target exists, try to move the source as a child of the target.
806 This will obviously fail if target is not a directory, but that's exactly
808 if (err && (err->apr_err == SVN_ERR_ENTRY_EXISTS
809 || err->apr_err == SVN_ERR_FS_ALREADY_EXISTS))
811 const char *src_basename = svn_path_basename(src_path, pool);
813 svn_error_clear(err);
815 return svn_client_move4(commit_info_p, src_path,
816 svn_path_join(dst_path, src_basename, pool),
820 return svn_error_trace(err);
824 svn_client_move2(svn_client_commit_info_t **commit_info_p,
825 const char *src_path,
826 const char *dst_path,
828 svn_client_ctx_t *ctx,
831 svn_commit_info_t *commit_info = NULL;
834 err = svn_client_move3(&commit_info, src_path, dst_path, force, ctx, pool);
835 /* These structs have the same layout for the common fields. */
836 *commit_info_p = (svn_client_commit_info_t *) commit_info;
837 return svn_error_trace(err);
842 svn_client_move(svn_client_commit_info_t **commit_info_p,
843 const char *src_path,
844 const svn_opt_revision_t *src_revision,
845 const char *dst_path,
847 svn_client_ctx_t *ctx,
850 /* It doesn't make sense to specify revisions in a move. */
852 /* ### todo: this check could fail wrongly. For example,
853 someone could pass in an svn_opt_revision_number that just
854 happens to be the HEAD. It's fair enough to punt then, IMHO,
855 and just demand that the user not specify a revision at all;
856 beats mucking up this function with RA calls and such. */
857 if (src_revision->kind != svn_opt_revision_unspecified
858 && src_revision->kind != svn_opt_revision_head)
860 return svn_error_create
861 (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
862 _("Cannot specify revisions (except HEAD) with move operations"));
865 return svn_client_move2(commit_info_p, src_path, dst_path, force, ctx, pool);
868 /*** From delete.c ***/
870 svn_client_delete3(svn_commit_info_t **commit_info_p,
871 const apr_array_header_t *paths,
873 svn_boolean_t keep_local,
874 const apr_hash_t *revprop_table,
875 svn_client_ctx_t *ctx,
878 struct capture_baton_t cb;
880 cb.info = commit_info_p;
883 return svn_client_delete4(paths, force, keep_local, revprop_table,
884 capture_commit_info, &cb, ctx, pool);
888 svn_client_delete2(svn_commit_info_t **commit_info_p,
889 const apr_array_header_t *paths,
891 svn_client_ctx_t *ctx,
894 return svn_client_delete3(commit_info_p, paths, force, FALSE, NULL,
899 svn_client_delete(svn_client_commit_info_t **commit_info_p,
900 const apr_array_header_t *paths,
902 svn_client_ctx_t *ctx,
905 svn_commit_info_t *commit_info = NULL;
906 svn_error_t *err = NULL;
908 err = svn_client_delete2(&commit_info, paths, force, ctx, pool);
909 /* These structs have the same layout for the common fields. */
910 *commit_info_p = (svn_client_commit_info_t *) commit_info;
911 return svn_error_trace(err);
914 /*** From diff.c ***/
917 svn_client_diff5(const apr_array_header_t *diff_options,
919 const svn_opt_revision_t *revision1,
921 const svn_opt_revision_t *revision2,
922 const char *relative_to_dir,
924 svn_boolean_t ignore_ancestry,
925 svn_boolean_t no_diff_deleted,
926 svn_boolean_t show_copies_as_adds,
927 svn_boolean_t ignore_content_type,
928 svn_boolean_t use_git_diff_format,
929 const char *header_encoding,
932 const apr_array_header_t *changelists,
933 svn_client_ctx_t *ctx,
936 svn_stream_t *outstream = svn_stream_from_aprfile2(outfile, TRUE, pool);
937 svn_stream_t *errstream = svn_stream_from_aprfile2(errfile, TRUE, pool);
939 return svn_client_diff6(diff_options, path1, revision1, path2,
940 revision2, relative_to_dir, depth,
941 ignore_ancestry, FALSE /* no_diff_added */,
942 no_diff_deleted, show_copies_as_adds,
943 ignore_content_type, FALSE /* ignore_properties */,
944 FALSE /* properties_only */, use_git_diff_format,
946 outstream, errstream, changelists, ctx, pool);
950 svn_client_diff4(const apr_array_header_t *options,
952 const svn_opt_revision_t *revision1,
954 const svn_opt_revision_t *revision2,
955 const char *relative_to_dir,
957 svn_boolean_t ignore_ancestry,
958 svn_boolean_t no_diff_deleted,
959 svn_boolean_t ignore_content_type,
960 const char *header_encoding,
963 const apr_array_header_t *changelists,
964 svn_client_ctx_t *ctx,
967 return svn_client_diff5(options, path1, revision1, path2,
968 revision2, relative_to_dir, depth,
969 ignore_ancestry, no_diff_deleted, FALSE,
970 ignore_content_type, FALSE, header_encoding,
971 outfile, errfile, changelists, ctx, pool);
975 svn_client_diff3(const apr_array_header_t *options,
977 const svn_opt_revision_t *revision1,
979 const svn_opt_revision_t *revision2,
980 svn_boolean_t recurse,
981 svn_boolean_t ignore_ancestry,
982 svn_boolean_t no_diff_deleted,
983 svn_boolean_t ignore_content_type,
984 const char *header_encoding,
987 svn_client_ctx_t *ctx,
990 return svn_client_diff4(options, path1, revision1, path2,
992 SVN_DEPTH_INFINITY_OR_FILES(recurse),
993 ignore_ancestry, no_diff_deleted,
994 ignore_content_type, header_encoding,
995 outfile, errfile, NULL, ctx, pool);
999 svn_client_diff2(const apr_array_header_t *options,
1001 const svn_opt_revision_t *revision1,
1003 const svn_opt_revision_t *revision2,
1004 svn_boolean_t recurse,
1005 svn_boolean_t ignore_ancestry,
1006 svn_boolean_t no_diff_deleted,
1007 svn_boolean_t ignore_content_type,
1008 apr_file_t *outfile,
1009 apr_file_t *errfile,
1010 svn_client_ctx_t *ctx,
1013 return svn_client_diff3(options, path1, revision1, path2, revision2,
1014 recurse, ignore_ancestry, no_diff_deleted,
1015 ignore_content_type, SVN_APR_LOCALE_CHARSET,
1016 outfile, errfile, ctx, pool);
1020 svn_client_diff(const apr_array_header_t *options,
1022 const svn_opt_revision_t *revision1,
1024 const svn_opt_revision_t *revision2,
1025 svn_boolean_t recurse,
1026 svn_boolean_t ignore_ancestry,
1027 svn_boolean_t no_diff_deleted,
1028 apr_file_t *outfile,
1029 apr_file_t *errfile,
1030 svn_client_ctx_t *ctx,
1033 return svn_client_diff2(options, path1, revision1, path2, revision2,
1034 recurse, ignore_ancestry, no_diff_deleted, FALSE,
1035 outfile, errfile, ctx, pool);
1039 svn_client_diff_peg5(const apr_array_header_t *diff_options,
1041 const svn_opt_revision_t *peg_revision,
1042 const svn_opt_revision_t *start_revision,
1043 const svn_opt_revision_t *end_revision,
1044 const char *relative_to_dir,
1046 svn_boolean_t ignore_ancestry,
1047 svn_boolean_t no_diff_deleted,
1048 svn_boolean_t show_copies_as_adds,
1049 svn_boolean_t ignore_content_type,
1050 svn_boolean_t use_git_diff_format,
1051 const char *header_encoding,
1052 apr_file_t *outfile,
1053 apr_file_t *errfile,
1054 const apr_array_header_t *changelists,
1055 svn_client_ctx_t *ctx,
1058 svn_stream_t *outstream = svn_stream_from_aprfile2(outfile, TRUE, pool);
1059 svn_stream_t *errstream = svn_stream_from_aprfile2(errfile, TRUE, pool);
1061 return svn_client_diff_peg6(diff_options,
1069 FALSE /* no_diff_added */,
1071 show_copies_as_adds,
1072 ignore_content_type,
1073 FALSE /* ignore_properties */,
1074 FALSE /* properties_only */,
1075 use_git_diff_format,
1085 svn_client_diff_peg4(const apr_array_header_t *options,
1087 const svn_opt_revision_t *peg_revision,
1088 const svn_opt_revision_t *start_revision,
1089 const svn_opt_revision_t *end_revision,
1090 const char *relative_to_dir,
1092 svn_boolean_t ignore_ancestry,
1093 svn_boolean_t no_diff_deleted,
1094 svn_boolean_t ignore_content_type,
1095 const char *header_encoding,
1096 apr_file_t *outfile,
1097 apr_file_t *errfile,
1098 const apr_array_header_t *changelists,
1099 svn_client_ctx_t *ctx,
1102 return svn_client_diff_peg5(options,
1112 ignore_content_type,
1123 svn_client_diff_peg3(const apr_array_header_t *options,
1125 const svn_opt_revision_t *peg_revision,
1126 const svn_opt_revision_t *start_revision,
1127 const svn_opt_revision_t *end_revision,
1128 svn_boolean_t recurse,
1129 svn_boolean_t ignore_ancestry,
1130 svn_boolean_t no_diff_deleted,
1131 svn_boolean_t ignore_content_type,
1132 const char *header_encoding,
1133 apr_file_t *outfile,
1134 apr_file_t *errfile,
1135 svn_client_ctx_t *ctx,
1138 return svn_client_diff_peg4(options,
1144 SVN_DEPTH_INFINITY_OR_FILES(recurse),
1147 ignore_content_type,
1157 svn_client_diff_peg2(const apr_array_header_t *options,
1159 const svn_opt_revision_t *peg_revision,
1160 const svn_opt_revision_t *start_revision,
1161 const svn_opt_revision_t *end_revision,
1162 svn_boolean_t recurse,
1163 svn_boolean_t ignore_ancestry,
1164 svn_boolean_t no_diff_deleted,
1165 svn_boolean_t ignore_content_type,
1166 apr_file_t *outfile,
1167 apr_file_t *errfile,
1168 svn_client_ctx_t *ctx,
1171 return svn_client_diff_peg3(options, path, peg_revision, start_revision,
1173 SVN_DEPTH_INFINITY_OR_FILES(recurse),
1174 ignore_ancestry, no_diff_deleted,
1175 ignore_content_type, SVN_APR_LOCALE_CHARSET,
1176 outfile, errfile, ctx, pool);
1180 svn_client_diff_peg(const apr_array_header_t *options,
1182 const svn_opt_revision_t *peg_revision,
1183 const svn_opt_revision_t *start_revision,
1184 const svn_opt_revision_t *end_revision,
1185 svn_boolean_t recurse,
1186 svn_boolean_t ignore_ancestry,
1187 svn_boolean_t no_diff_deleted,
1188 apr_file_t *outfile,
1189 apr_file_t *errfile,
1190 svn_client_ctx_t *ctx,
1193 return svn_client_diff_peg2(options, path, peg_revision,
1194 start_revision, end_revision, recurse,
1195 ignore_ancestry, no_diff_deleted, FALSE,
1196 outfile, errfile, ctx, pool);
1200 svn_client_diff_summarize(const char *path1,
1201 const svn_opt_revision_t *revision1,
1203 const svn_opt_revision_t *revision2,
1204 svn_boolean_t recurse,
1205 svn_boolean_t ignore_ancestry,
1206 svn_client_diff_summarize_func_t summarize_func,
1207 void *summarize_baton,
1208 svn_client_ctx_t *ctx,
1211 return svn_client_diff_summarize2(path1, revision1, path2,
1213 SVN_DEPTH_INFINITY_OR_FILES(recurse),
1214 ignore_ancestry, NULL, summarize_func,
1215 summarize_baton, ctx, pool);
1219 svn_client_diff_summarize_peg(const char *path,
1220 const svn_opt_revision_t *peg_revision,
1221 const svn_opt_revision_t *start_revision,
1222 const svn_opt_revision_t *end_revision,
1223 svn_boolean_t recurse,
1224 svn_boolean_t ignore_ancestry,
1225 svn_client_diff_summarize_func_t summarize_func,
1226 void *summarize_baton,
1227 svn_client_ctx_t *ctx,
1230 return svn_client_diff_summarize_peg2(path, peg_revision,
1231 start_revision, end_revision,
1232 SVN_DEPTH_INFINITY_OR_FILES(recurse),
1233 ignore_ancestry, NULL,
1234 summarize_func, summarize_baton,
1238 /*** From export.c ***/
1240 svn_client_export4(svn_revnum_t *result_rev,
1241 const char *from_path_or_url,
1242 const char *to_path,
1243 const svn_opt_revision_t *peg_revision,
1244 const svn_opt_revision_t *revision,
1245 svn_boolean_t overwrite,
1246 svn_boolean_t ignore_externals,
1248 const char *native_eol,
1249 svn_client_ctx_t *ctx,
1252 return svn_client_export5(result_rev, from_path_or_url, to_path,
1253 peg_revision, revision, overwrite, ignore_externals,
1254 FALSE, depth, native_eol, ctx, pool);
1258 svn_client_export3(svn_revnum_t *result_rev,
1259 const char *from_path_or_url,
1260 const char *to_path,
1261 const svn_opt_revision_t *peg_revision,
1262 const svn_opt_revision_t *revision,
1263 svn_boolean_t overwrite,
1264 svn_boolean_t ignore_externals,
1265 svn_boolean_t recurse,
1266 const char *native_eol,
1267 svn_client_ctx_t *ctx,
1270 return svn_client_export4(result_rev, from_path_or_url, to_path,
1271 peg_revision, revision, overwrite, ignore_externals,
1272 SVN_DEPTH_INFINITY_OR_FILES(recurse),
1273 native_eol, ctx, pool);
1277 svn_client_export2(svn_revnum_t *result_rev,
1278 const char *from_path_or_url,
1279 const char *to_path,
1280 svn_opt_revision_t *revision,
1281 svn_boolean_t force,
1282 const char *native_eol,
1283 svn_client_ctx_t *ctx,
1286 svn_opt_revision_t peg_revision;
1288 peg_revision.kind = svn_opt_revision_unspecified;
1290 return svn_client_export3(result_rev, from_path_or_url, to_path,
1291 &peg_revision, revision, force, FALSE, TRUE,
1292 native_eol, ctx, pool);
1297 svn_client_export(svn_revnum_t *result_rev,
1298 const char *from_path_or_url,
1299 const char *to_path,
1300 svn_opt_revision_t *revision,
1301 svn_boolean_t force,
1302 svn_client_ctx_t *ctx,
1305 return svn_client_export2(result_rev, from_path_or_url, to_path, revision,
1306 force, NULL, ctx, pool);
1309 /*** From list.c ***/
1311 /* Baton for use with wrap_list_func */
1312 struct list_func_wrapper_baton {
1313 void *list_func1_baton;
1314 svn_client_list_func_t list_func1;
1317 /* This implements svn_client_list_func2_t */
1318 static svn_error_t *
1319 list_func_wrapper(void *baton,
1321 const svn_dirent_t *dirent,
1322 const svn_lock_t *lock,
1323 const char *abs_path,
1324 const char *external_parent_url,
1325 const char *external_target,
1326 apr_pool_t *scratch_pool)
1328 struct list_func_wrapper_baton *lfwb = baton;
1330 if (lfwb->list_func1)
1331 return lfwb->list_func1(lfwb->list_func1_baton, path, dirent,
1332 lock, abs_path, scratch_pool);
1334 return SVN_NO_ERROR;
1337 /* Helper function for svn_client_list2(). It wraps old format baton
1338 and callback function in list_func_wrapper_baton and
1339 returns new baton and callback to use with svn_client_list3(). */
1341 wrap_list_func(svn_client_list_func2_t *list_func2,
1342 void **list_func2_baton,
1343 svn_client_list_func_t list_func,
1345 apr_pool_t *result_pool)
1347 struct list_func_wrapper_baton *lfwb = apr_palloc(result_pool,
1350 /* Set the user provided old format callback in the baton. */
1351 lfwb->list_func1_baton = baton;
1352 lfwb->list_func1 = list_func;
1354 *list_func2_baton = lfwb;
1355 *list_func2 = list_func_wrapper;
1359 svn_client_list2(const char *path_or_url,
1360 const svn_opt_revision_t *peg_revision,
1361 const svn_opt_revision_t *revision,
1363 apr_uint32_t dirent_fields,
1364 svn_boolean_t fetch_locks,
1365 svn_client_list_func_t list_func,
1367 svn_client_ctx_t *ctx,
1370 svn_client_list_func2_t list_func2;
1371 void *list_func2_baton;
1373 wrap_list_func(&list_func2, &list_func2_baton, list_func, baton, pool);
1375 return svn_client_list3(path_or_url, peg_revision, revision, depth,
1376 dirent_fields, fetch_locks,
1377 FALSE /* include externals */,
1378 list_func2, list_func2_baton, ctx, pool);
1382 svn_client_list(const char *path_or_url,
1383 const svn_opt_revision_t *peg_revision,
1384 const svn_opt_revision_t *revision,
1385 svn_boolean_t recurse,
1386 apr_uint32_t dirent_fields,
1387 svn_boolean_t fetch_locks,
1388 svn_client_list_func_t list_func,
1390 svn_client_ctx_t *ctx,
1393 return svn_client_list2(path_or_url,
1396 SVN_DEPTH_INFINITY_OR_IMMEDIATES(recurse),
1405 /* Baton used by compatibility wrapper svn_client_ls3. */
1407 apr_hash_t *dirents;
1412 /* This implements svn_client_list_func_t. */
1413 static svn_error_t *
1414 store_dirent(void *baton, const char *path, const svn_dirent_t *dirent,
1415 const svn_lock_t *lock, const char *abs_path, apr_pool_t *pool)
1417 struct ls_baton *lb = baton;
1419 /* The dirent is allocated in a temporary pool, so duplicate it into the
1420 correct pool. Note, however, that the locks are stored in the correct
1422 dirent = svn_dirent_dup(dirent, lb->pool);
1424 /* An empty path means we are called for the target of the operation.
1425 For compatibility, we only store the target if it is a file, and we
1426 store it under the basename of the URL. Note that this makes it
1427 impossible to differentiate between the target being a directory with a
1428 child with the same basename as the target and the target being a file,
1429 but that's how it was implemented. */
1430 if (path[0] == '\0')
1432 if (dirent->kind == svn_node_file)
1434 const char *base_name = svn_path_basename(abs_path, lb->pool);
1435 svn_hash_sets(lb->dirents, base_name, dirent);
1437 svn_hash_sets(lb->locks, base_name, lock);
1442 path = apr_pstrdup(lb->pool, path);
1443 svn_hash_sets(lb->dirents, path, dirent);
1445 svn_hash_sets(lb->locks, path, lock);
1448 return SVN_NO_ERROR;
1452 svn_client_ls3(apr_hash_t **dirents,
1454 const char *path_or_url,
1455 const svn_opt_revision_t *peg_revision,
1456 const svn_opt_revision_t *revision,
1457 svn_boolean_t recurse,
1458 svn_client_ctx_t *ctx,
1463 *dirents = lb.dirents = apr_hash_make(pool);
1465 *locks = lb.locks = apr_hash_make(pool);
1468 return svn_client_list(path_or_url, peg_revision, revision, recurse,
1469 SVN_DIRENT_ALL, locks != NULL,
1470 store_dirent, &lb, ctx, pool);
1474 svn_client_ls2(apr_hash_t **dirents,
1475 const char *path_or_url,
1476 const svn_opt_revision_t *peg_revision,
1477 const svn_opt_revision_t *revision,
1478 svn_boolean_t recurse,
1479 svn_client_ctx_t *ctx,
1483 return svn_client_ls3(dirents, NULL, path_or_url, peg_revision,
1484 revision, recurse, ctx, pool);
1489 svn_client_ls(apr_hash_t **dirents,
1490 const char *path_or_url,
1491 svn_opt_revision_t *revision,
1492 svn_boolean_t recurse,
1493 svn_client_ctx_t *ctx,
1496 return svn_client_ls2(dirents, path_or_url, revision,
1497 revision, recurse, ctx, pool);
1500 /*** From log.c ***/
1502 svn_client_log4(const apr_array_header_t *targets,
1503 const svn_opt_revision_t *peg_revision,
1504 const svn_opt_revision_t *start,
1505 const svn_opt_revision_t *end,
1507 svn_boolean_t discover_changed_paths,
1508 svn_boolean_t strict_node_history,
1509 svn_boolean_t include_merged_revisions,
1510 const apr_array_header_t *revprops,
1511 svn_log_entry_receiver_t receiver,
1512 void *receiver_baton,
1513 svn_client_ctx_t *ctx,
1516 apr_array_header_t *revision_ranges;
1518 revision_ranges = apr_array_make(pool, 1,
1519 sizeof(svn_opt_revision_range_t *));
1520 APR_ARRAY_PUSH(revision_ranges, svn_opt_revision_range_t *)
1521 = svn_opt__revision_range_create(start, end, pool);
1523 return svn_client_log5(targets, peg_revision, revision_ranges, limit,
1524 discover_changed_paths, strict_node_history,
1525 include_merged_revisions, revprops, receiver,
1526 receiver_baton, ctx, pool);
1531 svn_client_log3(const apr_array_header_t *targets,
1532 const svn_opt_revision_t *peg_revision,
1533 const svn_opt_revision_t *start,
1534 const svn_opt_revision_t *end,
1536 svn_boolean_t discover_changed_paths,
1537 svn_boolean_t strict_node_history,
1538 svn_log_message_receiver_t receiver,
1539 void *receiver_baton,
1540 svn_client_ctx_t *ctx,
1543 svn_log_entry_receiver_t receiver2;
1544 void *receiver2_baton;
1546 svn_compat_wrap_log_receiver(&receiver2, &receiver2_baton,
1547 receiver, receiver_baton,
1550 return svn_client_log4(targets, peg_revision, start, end, limit,
1551 discover_changed_paths, strict_node_history, FALSE,
1552 svn_compat_log_revprops_in(pool),
1553 receiver2, receiver2_baton, ctx, pool);
1557 svn_client_log2(const apr_array_header_t *targets,
1558 const svn_opt_revision_t *start,
1559 const svn_opt_revision_t *end,
1561 svn_boolean_t discover_changed_paths,
1562 svn_boolean_t strict_node_history,
1563 svn_log_message_receiver_t receiver,
1564 void *receiver_baton,
1565 svn_client_ctx_t *ctx,
1568 svn_opt_revision_t peg_revision;
1569 peg_revision.kind = svn_opt_revision_unspecified;
1570 return svn_client_log3(targets, &peg_revision, start, end, limit,
1571 discover_changed_paths, strict_node_history,
1572 receiver, receiver_baton, ctx, pool);
1576 svn_client_log(const apr_array_header_t *targets,
1577 const svn_opt_revision_t *start,
1578 const svn_opt_revision_t *end,
1579 svn_boolean_t discover_changed_paths,
1580 svn_boolean_t strict_node_history,
1581 svn_log_message_receiver_t receiver,
1582 void *receiver_baton,
1583 svn_client_ctx_t *ctx,
1586 svn_error_t *err = SVN_NO_ERROR;
1588 err = svn_client_log2(targets, start, end, 0, discover_changed_paths,
1589 strict_node_history, receiver, receiver_baton, ctx,
1592 /* Special case: If there have been no commits, we'll get an error
1593 * for requesting log of a revision higher than 0. But the
1594 * default behavior of "svn log" is to give revisions HEAD through
1595 * 1, on the assumption that HEAD >= 1.
1597 * So if we got that error for that reason, and it looks like the
1598 * user was just depending on the defaults (rather than explicitly
1599 * requesting the log for revision 1), then we don't error. Instead
1600 * we just invoke the receiver manually on a hand-constructed log
1601 * message for revision 0.
1603 * See also http://subversion.tigris.org/issues/show_bug.cgi?id=692.
1605 if (err && (err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION)
1606 && (start->kind == svn_opt_revision_head)
1607 && ((end->kind == svn_opt_revision_number)
1608 && (end->value.number == 1)))
1611 /* We don't need to check if HEAD is 0, because that must be the case,
1612 * by logical deduction: The revision range specified is HEAD:1.
1613 * HEAD cannot not exist, so the revision to which "no such revision"
1614 * applies is 1. If revision 1 does not exist, then HEAD is 0.
1615 * Hence, we deduce the repository is empty without needing access
1616 * to further information. */
1618 svn_error_clear(err);
1621 /* Log receivers are free to handle revision 0 specially... But
1622 just in case some don't, we make up a message here. */
1623 SVN_ERR(receiver(receiver_baton,
1624 NULL, 0, "", "", _("No commits in repository"),
1628 return svn_error_trace(err);
1631 /*** From merge.c ***/
1634 svn_client_merge4(const char *source1,
1635 const svn_opt_revision_t *revision1,
1636 const char *source2,
1637 const svn_opt_revision_t *revision2,
1638 const char *target_wcpath,
1640 svn_boolean_t ignore_ancestry,
1641 svn_boolean_t force_delete,
1642 svn_boolean_t record_only,
1643 svn_boolean_t dry_run,
1644 svn_boolean_t allow_mixed_rev,
1645 const apr_array_header_t *merge_options,
1646 svn_client_ctx_t *ctx,
1649 SVN_ERR(svn_client_merge5(source1, revision1,
1653 ignore_ancestry /*ignore_mergeinfo*/,
1654 ignore_ancestry /*diff_ignore_ancestry*/,
1655 force_delete, record_only,
1656 dry_run, allow_mixed_rev,
1657 merge_options, ctx, pool));
1658 return SVN_NO_ERROR;
1662 svn_client_merge3(const char *source1,
1663 const svn_opt_revision_t *revision1,
1664 const char *source2,
1665 const svn_opt_revision_t *revision2,
1666 const char *target_wcpath,
1668 svn_boolean_t ignore_ancestry,
1669 svn_boolean_t force,
1670 svn_boolean_t record_only,
1671 svn_boolean_t dry_run,
1672 const apr_array_header_t *merge_options,
1673 svn_client_ctx_t *ctx,
1676 return svn_client_merge4(source1, revision1, source2, revision2,
1677 target_wcpath, depth, ignore_ancestry, force,
1678 record_only, dry_run, TRUE, merge_options,
1683 svn_client_merge2(const char *source1,
1684 const svn_opt_revision_t *revision1,
1685 const char *source2,
1686 const svn_opt_revision_t *revision2,
1687 const char *target_wcpath,
1688 svn_boolean_t recurse,
1689 svn_boolean_t ignore_ancestry,
1690 svn_boolean_t force,
1691 svn_boolean_t dry_run,
1692 const apr_array_header_t *merge_options,
1693 svn_client_ctx_t *ctx,
1696 return svn_client_merge3(source1, revision1, source2, revision2,
1698 SVN_DEPTH_INFINITY_OR_FILES(recurse),
1699 ignore_ancestry, force, FALSE, dry_run,
1700 merge_options, ctx, pool);
1704 svn_client_merge(const char *source1,
1705 const svn_opt_revision_t *revision1,
1706 const char *source2,
1707 const svn_opt_revision_t *revision2,
1708 const char *target_wcpath,
1709 svn_boolean_t recurse,
1710 svn_boolean_t ignore_ancestry,
1711 svn_boolean_t force,
1712 svn_boolean_t dry_run,
1713 svn_client_ctx_t *ctx,
1716 return svn_client_merge2(source1, revision1, source2, revision2,
1717 target_wcpath, recurse, ignore_ancestry, force,
1718 dry_run, NULL, ctx, pool);
1722 svn_client_merge_peg4(const char *source_path_or_url,
1723 const apr_array_header_t *ranges_to_merge,
1724 const svn_opt_revision_t *source_peg_revision,
1725 const char *target_wcpath,
1727 svn_boolean_t ignore_ancestry,
1728 svn_boolean_t force_delete,
1729 svn_boolean_t record_only,
1730 svn_boolean_t dry_run,
1731 svn_boolean_t allow_mixed_rev,
1732 const apr_array_header_t *merge_options,
1733 svn_client_ctx_t *ctx,
1736 SVN_ERR(svn_client_merge_peg5(source_path_or_url,
1738 source_peg_revision,
1741 ignore_ancestry /*ignore_mergeinfo*/,
1742 ignore_ancestry /*diff_ignore_ancestry*/,
1743 force_delete, record_only,
1744 dry_run, allow_mixed_rev,
1745 merge_options, ctx, pool));
1746 return SVN_NO_ERROR;
1750 svn_client_merge_peg3(const char *source,
1751 const apr_array_header_t *ranges_to_merge,
1752 const svn_opt_revision_t *peg_revision,
1753 const char *target_wcpath,
1755 svn_boolean_t ignore_ancestry,
1756 svn_boolean_t force,
1757 svn_boolean_t record_only,
1758 svn_boolean_t dry_run,
1759 const apr_array_header_t *merge_options,
1760 svn_client_ctx_t *ctx,
1763 return svn_client_merge_peg4(source, ranges_to_merge, peg_revision,
1764 target_wcpath, depth, ignore_ancestry, force,
1765 record_only, dry_run, TRUE, merge_options,
1770 svn_client_merge_peg2(const char *source,
1771 const svn_opt_revision_t *revision1,
1772 const svn_opt_revision_t *revision2,
1773 const svn_opt_revision_t *peg_revision,
1774 const char *target_wcpath,
1775 svn_boolean_t recurse,
1776 svn_boolean_t ignore_ancestry,
1777 svn_boolean_t force,
1778 svn_boolean_t dry_run,
1779 const apr_array_header_t *merge_options,
1780 svn_client_ctx_t *ctx,
1783 apr_array_header_t *ranges_to_merge =
1784 apr_array_make(pool, 1, sizeof(svn_opt_revision_range_t *));
1786 APR_ARRAY_PUSH(ranges_to_merge, svn_opt_revision_range_t *)
1787 = svn_opt__revision_range_create(revision1, revision2, pool);
1788 return svn_client_merge_peg3(source, ranges_to_merge,
1791 SVN_DEPTH_INFINITY_OR_FILES(recurse),
1792 ignore_ancestry, force, FALSE, dry_run,
1793 merge_options, ctx, pool);
1797 svn_client_merge_peg(const char *source,
1798 const svn_opt_revision_t *revision1,
1799 const svn_opt_revision_t *revision2,
1800 const svn_opt_revision_t *peg_revision,
1801 const char *target_wcpath,
1802 svn_boolean_t recurse,
1803 svn_boolean_t ignore_ancestry,
1804 svn_boolean_t force,
1805 svn_boolean_t dry_run,
1806 svn_client_ctx_t *ctx,
1809 return svn_client_merge_peg2(source, revision1, revision2, peg_revision,
1810 target_wcpath, recurse, ignore_ancestry, force,
1811 dry_run, NULL, ctx, pool);
1814 /*** From prop_commands.c ***/
1816 svn_client_propset3(svn_commit_info_t **commit_info_p,
1817 const char *propname,
1818 const svn_string_t *propval,
1821 svn_boolean_t skip_checks,
1822 svn_revnum_t base_revision_for_url,
1823 const apr_array_header_t *changelists,
1824 const apr_hash_t *revprop_table,
1825 svn_client_ctx_t *ctx,
1828 if (svn_path_is_url(target))
1830 struct capture_baton_t cb;
1832 cb.info = commit_info_p;
1835 SVN_ERR(svn_client_propset_remote(propname, propval, target, skip_checks,
1836 base_revision_for_url, revprop_table,
1837 capture_commit_info, &cb, ctx, pool));
1841 apr_array_header_t *targets = apr_array_make(pool, 1,
1842 sizeof(const char *));
1844 APR_ARRAY_PUSH(targets, const char *) = target;
1845 SVN_ERR(svn_client_propset_local(propname, propval, targets, depth,
1846 skip_checks, changelists, ctx, pool));
1849 return SVN_NO_ERROR;
1853 svn_client_propset2(const char *propname,
1854 const svn_string_t *propval,
1856 svn_boolean_t recurse,
1857 svn_boolean_t skip_checks,
1858 svn_client_ctx_t *ctx,
1861 return svn_client_propset3(NULL, propname, propval, target,
1862 SVN_DEPTH_INFINITY_OR_EMPTY(recurse),
1863 skip_checks, SVN_INVALID_REVNUM,
1864 NULL, NULL, ctx, pool);
1869 svn_client_propset(const char *propname,
1870 const svn_string_t *propval,
1872 svn_boolean_t recurse,
1875 svn_client_ctx_t *ctx;
1877 SVN_ERR(svn_client_create_context(&ctx, pool));
1879 return svn_client_propset2(propname, propval, target, recurse, FALSE,
1884 svn_client_revprop_set(const char *propname,
1885 const svn_string_t *propval,
1887 const svn_opt_revision_t *revision,
1888 svn_revnum_t *set_rev,
1889 svn_boolean_t force,
1890 svn_client_ctx_t *ctx,
1893 return svn_client_revprop_set2(propname, propval, NULL, URL,
1894 revision, set_rev, force, ctx, pool);
1899 svn_client_propget4(apr_hash_t **props,
1900 const char *propname,
1902 const svn_opt_revision_t *peg_revision,
1903 const svn_opt_revision_t *revision,
1904 svn_revnum_t *actual_revnum,
1906 const apr_array_header_t *changelists,
1907 svn_client_ctx_t *ctx,
1908 apr_pool_t *result_pool,
1909 apr_pool_t *scratch_pool)
1911 return svn_error_trace(svn_client_propget5(props, NULL, propname, target,
1912 peg_revision, revision,
1913 actual_revnum, depth,
1915 result_pool, scratch_pool));
1919 svn_client_propget3(apr_hash_t **props,
1920 const char *propname,
1921 const char *path_or_url,
1922 const svn_opt_revision_t *peg_revision,
1923 const svn_opt_revision_t *revision,
1924 svn_revnum_t *actual_revnum,
1926 const apr_array_header_t *changelists,
1927 svn_client_ctx_t *ctx,
1931 apr_hash_t *temp_props;
1934 if (svn_path_is_url(path_or_url))
1935 target = path_or_url;
1937 SVN_ERR(svn_dirent_get_absolute(&target, path_or_url, pool));
1939 err = svn_client_propget4(&temp_props, propname, target,
1940 peg_revision, revision, actual_revnum,
1941 depth, changelists, ctx, pool, pool);
1943 if (err && err->apr_err == SVN_ERR_UNVERSIONED_RESOURCE)
1945 err->apr_err = SVN_ERR_ENTRY_NOT_FOUND;
1946 return svn_error_trace(err);
1952 && !svn_path_is_url(path_or_url)
1953 && !SVN_IS_VALID_REVNUM(*actual_revnum))
1955 /* Get the actual_revnum; added nodes have no revision yet, and old
1956 * callers expected the mock-up revision of 0. */
1957 svn_boolean_t added;
1959 SVN_ERR(svn_wc__node_is_added(&added, ctx->wc_ctx, target, pool));
1964 /* We may need to fix up our hash keys for legacy callers. */
1965 if (!svn_path_is_url(path_or_url) && strcmp(target, path_or_url) != 0)
1967 apr_hash_index_t *hi;
1969 *props = apr_hash_make(pool);
1970 for (hi = apr_hash_first(pool, temp_props); hi;
1971 hi = apr_hash_next(hi))
1973 const char *abspath = svn__apr_hash_index_key(hi);
1974 svn_string_t *value = svn__apr_hash_index_val(hi);
1975 const char *relpath = svn_dirent_join(path_or_url,
1976 svn_dirent_skip_ancestor(target, abspath),
1979 svn_hash_sets(*props, relpath, value);
1983 *props = temp_props;
1985 return SVN_NO_ERROR;
1989 svn_client_propget2(apr_hash_t **props,
1990 const char *propname,
1992 const svn_opt_revision_t *peg_revision,
1993 const svn_opt_revision_t *revision,
1994 svn_boolean_t recurse,
1995 svn_client_ctx_t *ctx,
1998 return svn_client_propget3(props,
2004 SVN_DEPTH_INFINITY_OR_EMPTY(recurse),
2011 svn_client_propget(apr_hash_t **props,
2012 const char *propname,
2014 const svn_opt_revision_t *revision,
2015 svn_boolean_t recurse,
2016 svn_client_ctx_t *ctx,
2019 return svn_client_propget2(props, propname, target, revision, revision,
2020 recurse, ctx, pool);
2024 /* Duplicate a HASH containing (char * -> svn_string_t *) key/value
2025 pairs using POOL. */
2027 string_hash_dup(apr_hash_t *hash, apr_pool_t *pool)
2029 apr_hash_index_t *hi;
2030 apr_hash_t *new_hash = apr_hash_make(pool);
2032 for (hi = apr_hash_first(pool, hash); hi; hi = apr_hash_next(hi))
2034 const char *key = apr_pstrdup(pool, svn__apr_hash_index_key(hi));
2035 apr_ssize_t klen = svn__apr_hash_index_klen(hi);
2036 svn_string_t *val = svn_string_dup(svn__apr_hash_index_val(hi), pool);
2038 apr_hash_set(new_hash, key, klen, val);
2043 svn_client_proplist_item_t *
2044 svn_client_proplist_item_dup(const svn_client_proplist_item_t *item,
2047 svn_client_proplist_item_t *new_item = apr_pcalloc(pool, sizeof(*new_item));
2049 if (item->node_name)
2050 new_item->node_name = svn_stringbuf_dup(item->node_name, pool);
2052 if (item->prop_hash)
2053 new_item->prop_hash = string_hash_dup(item->prop_hash, pool);
2058 /* Baton for use with wrap_proplist_receiver */
2059 struct proplist_receiver_wrapper_baton {
2061 svn_proplist_receiver_t receiver;
2064 /* This implements svn_client_proplist_receiver2_t */
2065 static svn_error_t *
2066 proplist_wrapper_receiver(void *baton,
2068 apr_hash_t *prop_hash,
2069 apr_array_header_t *inherited_props,
2072 struct proplist_receiver_wrapper_baton *plrwb = baton;
2074 if (plrwb->receiver)
2075 return plrwb->receiver(plrwb->baton, path, prop_hash, pool);
2077 return SVN_NO_ERROR;
2081 wrap_proplist_receiver(svn_proplist_receiver2_t *receiver2,
2082 void **receiver2_baton,
2083 svn_proplist_receiver_t receiver,
2084 void *receiver_baton,
2087 struct proplist_receiver_wrapper_baton *plrwb = apr_palloc(pool,
2090 /* Set the user provided old format callback in the baton. */
2091 plrwb->baton = receiver_baton;
2092 plrwb->receiver = receiver;
2094 *receiver2_baton = plrwb;
2095 *receiver2 = proplist_wrapper_receiver;
2099 svn_client_proplist3(const char *target,
2100 const svn_opt_revision_t *peg_revision,
2101 const svn_opt_revision_t *revision,
2103 const apr_array_header_t *changelists,
2104 svn_proplist_receiver_t receiver,
2105 void *receiver_baton,
2106 svn_client_ctx_t *ctx,
2110 svn_proplist_receiver2_t receiver2;
2111 void *receiver2_baton;
2113 wrap_proplist_receiver(&receiver2, &receiver2_baton, receiver, receiver_baton,
2116 return svn_error_trace(svn_client_proplist4(target, peg_revision, revision,
2117 depth, changelists, FALSE,
2118 receiver2, receiver2_baton,
2122 /* Receiver baton used by proplist2() */
2123 struct proplist_receiver_baton {
2124 apr_array_header_t *props;
2128 /* Receiver function used by proplist2(). */
2129 static svn_error_t *
2130 proplist_receiver_cb(void *baton,
2132 apr_hash_t *prop_hash,
2135 struct proplist_receiver_baton *pl_baton =
2136 (struct proplist_receiver_baton *) baton;
2137 svn_client_proplist_item_t *tmp_item = apr_palloc(pool, sizeof(*tmp_item));
2138 svn_client_proplist_item_t *item;
2140 /* Because the pool passed to the receiver function is likely to be a
2141 temporary pool of some kind, we need to make copies of *path and
2142 *prop_hash in the pool provided by the baton. */
2143 tmp_item->node_name = svn_stringbuf_create(path, pl_baton->pool);
2144 tmp_item->prop_hash = prop_hash;
2146 item = svn_client_proplist_item_dup(tmp_item, pl_baton->pool);
2148 APR_ARRAY_PUSH(pl_baton->props, const svn_client_proplist_item_t *) = item;
2150 return SVN_NO_ERROR;
2154 svn_client_proplist2(apr_array_header_t **props,
2156 const svn_opt_revision_t *peg_revision,
2157 const svn_opt_revision_t *revision,
2158 svn_boolean_t recurse,
2159 svn_client_ctx_t *ctx,
2162 struct proplist_receiver_baton pl_baton;
2164 *props = apr_array_make(pool, 5, sizeof(svn_client_proplist_item_t *));
2165 pl_baton.props = *props;
2166 pl_baton.pool = pool;
2168 return svn_client_proplist3(target, peg_revision, revision,
2169 SVN_DEPTH_INFINITY_OR_EMPTY(recurse), NULL,
2170 proplist_receiver_cb, &pl_baton, ctx, pool);
2175 svn_client_proplist(apr_array_header_t **props,
2177 const svn_opt_revision_t *revision,
2178 svn_boolean_t recurse,
2179 svn_client_ctx_t *ctx,
2182 return svn_client_proplist2(props, target, revision, revision,
2183 recurse, ctx, pool);
2186 /*** From status.c ***/
2188 struct status4_wrapper_baton
2190 svn_wc_context_t *wc_ctx;
2191 svn_wc_status_func3_t old_func;
2195 /* Implements svn_client_status_func_t */
2196 static svn_error_t *
2197 status4_wrapper_func(void *baton,
2199 const svn_client_status_t *status,
2200 apr_pool_t *scratch_pool)
2202 struct status4_wrapper_baton *swb = baton;
2203 svn_wc_status2_t *dup;
2204 const char *local_abspath;
2205 const svn_wc_status3_t *wc_status = status->backwards_compatibility_baton;
2207 SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
2208 SVN_ERR(svn_wc__status2_from_3(&dup, wc_status, swb->wc_ctx,
2209 local_abspath, scratch_pool,
2212 return (*swb->old_func)(swb->old_baton, path, dup, scratch_pool);
2216 svn_client_status4(svn_revnum_t *result_rev,
2218 const svn_opt_revision_t *revision,
2219 svn_wc_status_func3_t status_func,
2222 svn_boolean_t get_all,
2223 svn_boolean_t update,
2224 svn_boolean_t no_ignore,
2225 svn_boolean_t ignore_externals,
2226 const apr_array_header_t *changelists,
2227 svn_client_ctx_t *ctx,
2230 struct status4_wrapper_baton swb;
2232 swb.wc_ctx = ctx->wc_ctx;
2233 swb.old_func = status_func;
2234 swb.old_baton = status_baton;
2236 return svn_client_status5(result_rev, ctx, path, revision, depth, get_all,
2237 update, no_ignore, ignore_externals, TRUE,
2238 changelists, status4_wrapper_func, &swb, pool);
2241 struct status3_wrapper_baton
2243 svn_wc_status_func2_t old_func;
2247 static svn_error_t *
2248 status3_wrapper_func(void *baton,
2250 svn_wc_status2_t *status,
2253 struct status3_wrapper_baton *swb = baton;
2255 swb->old_func(swb->old_baton, path, status);
2256 return SVN_NO_ERROR;
2260 svn_client_status3(svn_revnum_t *result_rev,
2262 const svn_opt_revision_t *revision,
2263 svn_wc_status_func2_t status_func,
2266 svn_boolean_t get_all,
2267 svn_boolean_t update,
2268 svn_boolean_t no_ignore,
2269 svn_boolean_t ignore_externals,
2270 const apr_array_header_t *changelists,
2271 svn_client_ctx_t *ctx,
2274 struct status3_wrapper_baton swb = { 0 };
2275 swb.old_func = status_func;
2276 swb.old_baton = status_baton;
2277 return svn_client_status4(result_rev, path, revision, status3_wrapper_func,
2278 &swb, depth, get_all, update, no_ignore,
2279 ignore_externals, changelists, ctx, pool);
2283 svn_client_status2(svn_revnum_t *result_rev,
2285 const svn_opt_revision_t *revision,
2286 svn_wc_status_func2_t status_func,
2288 svn_boolean_t recurse,
2289 svn_boolean_t get_all,
2290 svn_boolean_t update,
2291 svn_boolean_t no_ignore,
2292 svn_boolean_t ignore_externals,
2293 svn_client_ctx_t *ctx,
2296 return svn_client_status3(result_rev, path, revision,
2297 status_func, status_baton,
2298 SVN_DEPTH_INFINITY_OR_IMMEDIATES(recurse),
2299 get_all, update, no_ignore, ignore_externals, NULL,
2304 /* Baton for old_status_func_cb; does what you think it does. */
2305 struct old_status_func_cb_baton
2307 svn_wc_status_func_t original_func;
2308 void *original_baton;
2311 /* Help svn_client_status() accept an old-style status func and baton,
2312 by wrapping them before passing along to svn_client_status2().
2314 This implements the 'svn_wc_status_func2_t' function type. */
2315 static void old_status_func_cb(void *baton,
2317 svn_wc_status2_t *status)
2319 struct old_status_func_cb_baton *b = baton;
2320 svn_wc_status_t *stat = (svn_wc_status_t *) status;
2322 b->original_func(b->original_baton, path, stat);
2327 svn_client_status(svn_revnum_t *result_rev,
2329 svn_opt_revision_t *revision,
2330 svn_wc_status_func_t status_func,
2332 svn_boolean_t recurse,
2333 svn_boolean_t get_all,
2334 svn_boolean_t update,
2335 svn_boolean_t no_ignore,
2336 svn_client_ctx_t *ctx,
2339 struct old_status_func_cb_baton *b = apr_pcalloc(pool, sizeof(*b));
2340 b->original_func = status_func;
2341 b->original_baton = status_baton;
2343 return svn_client_status2(result_rev, path, revision,
2344 old_status_func_cb, b,
2345 recurse, get_all, update, no_ignore, FALSE,
2349 /*** From update.c ***/
2351 svn_client_update3(apr_array_header_t **result_revs,
2352 const apr_array_header_t *paths,
2353 const svn_opt_revision_t *revision,
2355 svn_boolean_t depth_is_sticky,
2356 svn_boolean_t ignore_externals,
2357 svn_boolean_t allow_unver_obstructions,
2358 svn_client_ctx_t *ctx,
2361 return svn_client_update4(result_revs, paths, revision,
2362 depth, depth_is_sticky, ignore_externals,
2363 allow_unver_obstructions, TRUE, FALSE,
2368 svn_client_update2(apr_array_header_t **result_revs,
2369 const apr_array_header_t *paths,
2370 const svn_opt_revision_t *revision,
2371 svn_boolean_t recurse,
2372 svn_boolean_t ignore_externals,
2373 svn_client_ctx_t *ctx,
2376 return svn_client_update3(result_revs, paths, revision,
2377 SVN_DEPTH_INFINITY_OR_FILES(recurse), FALSE,
2378 ignore_externals, FALSE, ctx, pool);
2382 svn_client_update(svn_revnum_t *result_rev,
2384 const svn_opt_revision_t *revision,
2385 svn_boolean_t recurse,
2386 svn_client_ctx_t *ctx,
2389 apr_array_header_t *paths = apr_array_make(pool, 1, sizeof(const char *));
2390 apr_array_header_t *result_revs;
2392 APR_ARRAY_PUSH(paths, const char *) = path;
2394 SVN_ERR(svn_client_update2(&result_revs, paths, revision, recurse, FALSE,
2397 *result_rev = APR_ARRAY_IDX(result_revs, 0, svn_revnum_t);
2399 return SVN_NO_ERROR;
2402 /*** From switch.c ***/
2404 svn_client_switch2(svn_revnum_t *result_rev,
2406 const char *switch_url,
2407 const svn_opt_revision_t *peg_revision,
2408 const svn_opt_revision_t *revision,
2410 svn_boolean_t depth_is_sticky,
2411 svn_boolean_t ignore_externals,
2412 svn_boolean_t allow_unver_obstructions,
2413 svn_client_ctx_t *ctx,
2416 return svn_client_switch3(result_rev, path, switch_url, peg_revision,
2417 revision, depth, depth_is_sticky, ignore_externals,
2418 allow_unver_obstructions,
2419 TRUE /* ignore_ancestry */,
2424 svn_client_switch(svn_revnum_t *result_rev,
2426 const char *switch_url,
2427 const svn_opt_revision_t *revision,
2428 svn_boolean_t recurse,
2429 svn_client_ctx_t *ctx,
2432 svn_opt_revision_t peg_revision;
2433 peg_revision.kind = svn_opt_revision_unspecified;
2434 return svn_client_switch2(result_rev, path, switch_url,
2435 &peg_revision, revision,
2436 SVN_DEPTH_INFINITY_OR_FILES(recurse),
2437 FALSE, FALSE, FALSE, ctx, pool);
2440 /*** From cat.c ***/
2442 svn_client_cat(svn_stream_t *out,
2443 const char *path_or_url,
2444 const svn_opt_revision_t *revision,
2445 svn_client_ctx_t *ctx,
2448 return svn_client_cat2(out, path_or_url, revision, revision,
2452 /*** From checkout.c ***/
2454 svn_client_checkout2(svn_revnum_t *result_rev,
2457 const svn_opt_revision_t *peg_revision,
2458 const svn_opt_revision_t *revision,
2459 svn_boolean_t recurse,
2460 svn_boolean_t ignore_externals,
2461 svn_client_ctx_t *ctx,
2464 return svn_error_trace(svn_client_checkout3(result_rev, URL, path,
2465 peg_revision, revision,
2466 SVN_DEPTH_INFINITY_OR_FILES(recurse),
2467 ignore_externals, FALSE, ctx, pool));
2471 svn_client_checkout(svn_revnum_t *result_rev,
2474 const svn_opt_revision_t *revision,
2475 svn_boolean_t recurse,
2476 svn_client_ctx_t *ctx,
2479 svn_opt_revision_t peg_revision;
2481 peg_revision.kind = svn_opt_revision_unspecified;
2483 return svn_error_trace(svn_client_checkout2(result_rev, URL, path,
2484 &peg_revision, revision, recurse,
2488 /*** From info.c ***/
2491 svn_info_dup(const svn_info_t *info, apr_pool_t *pool)
2493 svn_info_t *dupinfo = apr_palloc(pool, sizeof(*dupinfo));
2495 /* Perform a trivial copy ... */
2498 /* ...and then re-copy stuff that needs to be duped into our pool. */
2500 dupinfo->URL = apr_pstrdup(pool, info->URL);
2501 if (info->repos_root_URL)
2502 dupinfo->repos_root_URL = apr_pstrdup(pool, info->repos_root_URL);
2503 if (info->repos_UUID)
2504 dupinfo->repos_UUID = apr_pstrdup(pool, info->repos_UUID);
2505 if (info->last_changed_author)
2506 dupinfo->last_changed_author = apr_pstrdup(pool,
2507 info->last_changed_author);
2509 dupinfo->lock = svn_lock_dup(info->lock, pool);
2510 if (info->copyfrom_url)
2511 dupinfo->copyfrom_url = apr_pstrdup(pool, info->copyfrom_url);
2513 dupinfo->checksum = apr_pstrdup(pool, info->checksum);
2514 if (info->conflict_old)
2515 dupinfo->conflict_old = apr_pstrdup(pool, info->conflict_old);
2516 if (info->conflict_new)
2517 dupinfo->conflict_new = apr_pstrdup(pool, info->conflict_new);
2518 if (info->conflict_wrk)
2519 dupinfo->conflict_wrk = apr_pstrdup(pool, info->conflict_wrk);
2521 dupinfo->prejfile = apr_pstrdup(pool, info->prejfile);
2526 /* Convert an svn_client_info2_t to an svn_info_t, doing shallow copies. */
2527 static svn_error_t *
2528 info_from_info2(svn_info_t **new_info,
2529 svn_wc_context_t *wc_ctx,
2530 const svn_client_info2_t *info2,
2533 svn_info_t *info = apr_pcalloc(pool, sizeof(*info));
2535 info->URL = info2->URL;
2536 /* Goofy backward compat handling for added nodes. */
2537 if (SVN_IS_VALID_REVNUM(info2->rev))
2538 info->rev = info2->rev;
2542 info->kind = info2->kind;
2543 info->repos_root_URL = info2->repos_root_URL;
2544 info->repos_UUID = info2->repos_UUID;
2545 info->last_changed_rev = info2->last_changed_rev;
2546 info->last_changed_date = info2->last_changed_date;
2547 info->last_changed_author = info2->last_changed_author;
2549 /* Stupid old structure has a non-const LOCK member. Sigh. */
2550 info->lock = (svn_lock_t *)info2->lock;
2552 info->size64 = info2->size;
2553 if (info2->size == SVN_INVALID_FILESIZE)
2554 info->size = SVN_INFO_SIZE_UNKNOWN;
2555 else if (((svn_filesize_t)(apr_size_t)info->size64) == info->size64)
2556 info->size = (apr_size_t)info->size64;
2558 info->size = SVN_INFO_SIZE_UNKNOWN;
2562 info->has_wc_info = TRUE;
2563 info->schedule = info2->wc_info->schedule;
2564 info->copyfrom_url = info2->wc_info->copyfrom_url;
2565 info->copyfrom_rev = info2->wc_info->copyfrom_rev;
2566 info->text_time = info2->wc_info->recorded_time;
2567 info->prop_time = 0;
2568 if (info2->wc_info->checksum
2569 && info2->wc_info->checksum->kind == svn_checksum_md5)
2570 info->checksum = svn_checksum_to_cstring(
2571 info2->wc_info->checksum, pool);
2573 info->checksum = NULL;
2574 info->changelist = info2->wc_info->changelist;
2575 info->depth = info2->wc_info->depth;
2577 if (info->depth == svn_depth_unknown && info->kind == svn_node_file)
2578 info->depth = svn_depth_infinity;
2580 info->working_size64 = info2->wc_info->recorded_size;
2581 if (((svn_filesize_t)(apr_size_t)info->working_size64) == info->working_size64)
2582 info->working_size = (apr_size_t)info->working_size64;
2584 info->working_size = SVN_INFO_SIZE_UNKNOWN;
2588 info->has_wc_info = FALSE;
2589 info->working_size = SVN_INFO_SIZE_UNKNOWN;
2590 info->working_size64 = SVN_INVALID_FILESIZE;
2591 info->depth = svn_depth_unknown;
2594 /* Populate conflict fields. */
2595 if (info2->wc_info && info2->wc_info->conflicts)
2599 for (i = 0; i < info2->wc_info->conflicts->nelts; i++)
2601 const svn_wc_conflict_description2_t *conflict
2602 = APR_ARRAY_IDX(info2->wc_info->conflicts, i,
2603 const svn_wc_conflict_description2_t *);
2605 /* ### Not really sure what we should do if we get multiple
2606 ### conflicts of the same type. */
2607 switch (conflict->kind)
2609 case svn_wc_conflict_kind_tree:
2610 info->tree_conflict = svn_wc__cd2_to_cd(conflict, pool);
2613 case svn_wc_conflict_kind_text:
2614 info->conflict_old = conflict->base_abspath;
2615 info->conflict_new = conflict->my_abspath;
2616 info->conflict_wrk = conflict->their_abspath;
2619 case svn_wc_conflict_kind_property:
2620 info->prejfile = conflict->their_abspath;
2626 if (info2->wc_info && info2->wc_info->checksum)
2628 const svn_checksum_t *md5_checksum;
2630 SVN_ERR(svn_wc__node_get_md5_from_sha1(&md5_checksum,
2632 info2->wc_info->wcroot_abspath,
2633 info2->wc_info->checksum,
2636 info->checksum = svn_checksum_to_cstring(md5_checksum, pool);
2640 return SVN_NO_ERROR;
2643 struct info_to_relpath_baton
2645 const char *anchor_abspath;
2646 const char *anchor_relpath;
2647 svn_info_receiver_t info_receiver;
2649 svn_wc_context_t *wc_ctx;
2652 static svn_error_t *
2653 info_receiver_relpath_wrapper(void *baton,
2654 const char *abspath_or_url,
2655 const svn_client_info2_t *info2,
2656 apr_pool_t *scratch_pool)
2658 struct info_to_relpath_baton *rb = baton;
2659 const char *path = abspath_or_url;
2662 if (rb->anchor_relpath &&
2663 svn_dirent_is_ancestor(rb->anchor_abspath, abspath_or_url))
2665 path = svn_dirent_join(rb->anchor_relpath,
2666 svn_dirent_skip_ancestor(rb->anchor_abspath,
2671 SVN_ERR(info_from_info2(&info, rb->wc_ctx, info2, scratch_pool));
2673 SVN_ERR(rb->info_receiver(rb->info_baton,
2678 return SVN_NO_ERROR;
2682 svn_client_info2(const char *path_or_url,
2683 const svn_opt_revision_t *peg_revision,
2684 const svn_opt_revision_t *revision,
2685 svn_info_receiver_t receiver,
2686 void *receiver_baton,
2688 const apr_array_header_t *changelists,
2689 svn_client_ctx_t *ctx,
2692 struct info_to_relpath_baton rb;
2693 const char *abspath_or_url = path_or_url;
2695 rb.anchor_relpath = NULL;
2696 rb.info_receiver = receiver;
2697 rb.info_baton = receiver_baton;
2698 rb.wc_ctx = ctx->wc_ctx;
2700 if (!svn_path_is_url(path_or_url))
2702 SVN_ERR(svn_dirent_get_absolute(&abspath_or_url, path_or_url, pool));
2703 rb.anchor_abspath = abspath_or_url;
2704 rb.anchor_relpath = path_or_url;
2707 SVN_ERR(svn_client_info3(abspath_or_url,
2713 info_receiver_relpath_wrapper,
2718 return SVN_NO_ERROR;
2722 svn_client_info(const char *path_or_url,
2723 const svn_opt_revision_t *peg_revision,
2724 const svn_opt_revision_t *revision,
2725 svn_info_receiver_t receiver,
2726 void *receiver_baton,
2727 svn_boolean_t recurse,
2728 svn_client_ctx_t *ctx,
2731 return svn_client_info2(path_or_url, peg_revision, revision,
2732 receiver, receiver_baton,
2733 SVN_DEPTH_INFINITY_OR_EMPTY(recurse),
2737 /*** From resolved.c ***/
2739 svn_client_resolved(const char *path,
2740 svn_boolean_t recursive,
2741 svn_client_ctx_t *ctx,
2744 svn_depth_t depth = SVN_DEPTH_INFINITY_OR_EMPTY(recursive);
2745 return svn_client_resolve(path, depth,
2746 svn_wc_conflict_choose_merged, ctx, pool);
2748 /*** From revert.c ***/
2750 svn_client_revert(const apr_array_header_t *paths,
2751 svn_boolean_t recursive,
2752 svn_client_ctx_t *ctx,
2755 return svn_client_revert2(paths, SVN_DEPTH_INFINITY_OR_EMPTY(recursive),
2761 svn_client_open_ra_session(svn_ra_session_t **session,
2763 svn_client_ctx_t *ctx,
2766 return svn_error_trace(
2767 svn_client_open_ra_session2(session, url,
2773 svn_client_uuid_from_url(const char **uuid,
2775 svn_client_ctx_t *ctx,
2779 apr_pool_t *subpool = svn_pool_create(pool);
2781 err = svn_client_get_repos_root(NULL, uuid, url,
2782 ctx, pool, subpool);
2783 /* destroy the RA session */
2784 svn_pool_destroy(subpool);
2786 return svn_error_trace(err);;
2790 svn_client_uuid_from_path2(const char **uuid,
2791 const char *local_abspath,
2792 svn_client_ctx_t *ctx,
2793 apr_pool_t *result_pool,
2794 apr_pool_t *scratch_pool)
2796 return svn_error_trace(
2797 svn_client_get_repos_root(NULL, uuid,
2799 result_pool, scratch_pool));
2803 svn_client_uuid_from_path(const char **uuid,
2805 svn_wc_adm_access_t *adm_access,
2806 svn_client_ctx_t *ctx,
2809 const char *local_abspath;
2811 SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
2812 return svn_error_trace(
2813 svn_client_uuid_from_path2(uuid, local_abspath, ctx, pool, pool));
2816 /*** From url.c ***/
2818 svn_client_root_url_from_path(const char **url,
2819 const char *path_or_url,
2820 svn_client_ctx_t *ctx,
2823 apr_pool_t *subpool = svn_pool_create(pool);
2825 if (!svn_path_is_url(path_or_url))
2826 SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url, pool));
2828 err = svn_client_get_repos_root(url, NULL, path_or_url,
2829 ctx, pool, subpool);
2831 /* close ra session */
2832 svn_pool_destroy(subpool);
2833 return svn_error_trace(err);
2837 svn_client_url_from_path(const char **url,
2838 const char *path_or_url,
2841 svn_client_ctx_t *ctx;
2843 SVN_ERR(svn_client_create_context(&ctx, pool));
2845 return svn_client_url_from_path2(url, path_or_url, ctx, pool, pool);
2848 /*** From mergeinfo.c ***/
2850 svn_client_mergeinfo_log(svn_boolean_t finding_merged,
2851 const char *target_path_or_url,
2852 const svn_opt_revision_t *target_peg_revision,
2853 const char *source_path_or_url,
2854 const svn_opt_revision_t *source_peg_revision,
2855 svn_log_entry_receiver_t receiver,
2856 void *receiver_baton,
2857 svn_boolean_t discover_changed_paths,
2859 const apr_array_header_t *revprops,
2860 svn_client_ctx_t *ctx,
2861 apr_pool_t *scratch_pool)
2863 svn_opt_revision_t start_revision, end_revision;
2865 start_revision.kind = svn_opt_revision_unspecified;
2866 end_revision.kind = svn_opt_revision_unspecified;
2868 return svn_client_mergeinfo_log2(finding_merged,
2869 target_path_or_url, target_peg_revision,
2870 source_path_or_url, source_peg_revision,
2871 &start_revision, &end_revision,
2872 receiver, receiver_baton,
2873 discover_changed_paths, depth, revprops,
2878 svn_client_mergeinfo_log_merged(const char *path_or_url,
2879 const svn_opt_revision_t *peg_revision,
2880 const char *merge_source_path_or_url,
2881 const svn_opt_revision_t *src_peg_revision,
2882 svn_log_entry_receiver_t log_receiver,
2883 void *log_receiver_baton,
2884 svn_boolean_t discover_changed_paths,
2885 const apr_array_header_t *revprops,
2886 svn_client_ctx_t *ctx,
2889 return svn_client_mergeinfo_log(TRUE, path_or_url, peg_revision,
2890 merge_source_path_or_url,
2892 log_receiver, log_receiver_baton,
2893 discover_changed_paths,
2894 svn_depth_empty, revprops, ctx,
2899 svn_client_mergeinfo_log_eligible(const char *path_or_url,
2900 const svn_opt_revision_t *peg_revision,
2901 const char *merge_source_path_or_url,
2902 const svn_opt_revision_t *src_peg_revision,
2903 svn_log_entry_receiver_t log_receiver,
2904 void *log_receiver_baton,
2905 svn_boolean_t discover_changed_paths,
2906 const apr_array_header_t *revprops,
2907 svn_client_ctx_t *ctx,
2910 return svn_client_mergeinfo_log(FALSE, path_or_url, peg_revision,
2911 merge_source_path_or_url,
2913 log_receiver, log_receiver_baton,
2914 discover_changed_paths,
2915 svn_depth_empty, revprops, ctx,
2919 /*** From relocate.c ***/
2921 svn_client_relocate(const char *path,
2922 const char *from_prefix,
2923 const char *to_prefix,
2924 svn_boolean_t recurse,
2925 svn_client_ctx_t *ctx,
2929 SVN_ERR(svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
2930 _("Non-recursive relocation not supported")));
2931 return svn_client_relocate2(path, from_prefix, to_prefix, TRUE, ctx, pool);
2934 /*** From util.c ***/
2936 svn_client_commit_item_create(const svn_client_commit_item3_t **item,
2939 *item = svn_client_commit_item3_create(pool);
2940 return SVN_NO_ERROR;
2943 svn_client_commit_item2_t *
2944 svn_client_commit_item2_dup(const svn_client_commit_item2_t *item,
2947 svn_client_commit_item2_t *new_item = apr_palloc(pool, sizeof(*new_item));
2952 new_item->path = apr_pstrdup(pool, new_item->path);
2955 new_item->url = apr_pstrdup(pool, new_item->url);
2957 if (new_item->copyfrom_url)
2958 new_item->copyfrom_url = apr_pstrdup(pool, new_item->copyfrom_url);
2960 if (new_item->wcprop_changes)
2961 new_item->wcprop_changes = svn_prop_array_dup(new_item->wcprop_changes,