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 /* ==================================================================== */
33 /* We define this here to remove any further warnings about the usage of
34 deprecated functions in this file. */
35 #define SVN_DEPRECATED
38 #include "svn_subst.h"
41 #include "svn_cmdline.h"
42 #include "svn_version.h"
43 #include "svn_pools.h"
45 #include "svn_mergeinfo.h"
52 #include "private/svn_opt_private.h"
53 #include "private/svn_mergeinfo_private.h"
55 #include "svn_private_config.h"
62 /*** From subst.c ***/
63 /* Convert an old-style svn_subst_keywords_t struct * into a new-style
64 * keywords hash. Keyword values are shallow copies, so the produced
65 * hash must not be assumed to have lifetime longer than the struct it
66 * is based on. A NULL input causes a NULL output. */
68 kwstruct_to_kwhash(const svn_subst_keywords_t *kwstruct,
76 kwhash = apr_hash_make(pool);
78 if (kwstruct->revision)
80 svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_LONG, kwstruct->revision);
81 svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_MEDIUM, kwstruct->revision);
82 svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_SHORT, kwstruct->revision);
86 svn_hash_sets(kwhash, SVN_KEYWORD_DATE_LONG, kwstruct->date);
87 svn_hash_sets(kwhash, SVN_KEYWORD_DATE_SHORT, kwstruct->date);
91 svn_hash_sets(kwhash, SVN_KEYWORD_AUTHOR_LONG, kwstruct->author);
92 svn_hash_sets(kwhash, SVN_KEYWORD_AUTHOR_SHORT, kwstruct->author);
96 svn_hash_sets(kwhash, SVN_KEYWORD_URL_LONG, kwstruct->url);
97 svn_hash_sets(kwhash, SVN_KEYWORD_URL_SHORT, kwstruct->url);
101 svn_hash_sets(kwhash, SVN_KEYWORD_ID, kwstruct->id);
109 svn_subst_translate_stream3(svn_stream_t *src_stream,
110 svn_stream_t *dst_stream,
112 svn_boolean_t repair,
113 apr_hash_t *keywords,
114 svn_boolean_t expand,
117 /* The docstring requires that *some* translation be requested. */
118 SVN_ERR_ASSERT(eol_str || keywords);
120 /* We don't want the copy3 to close the provided streams. */
121 src_stream = svn_stream_disown(src_stream, pool);
122 dst_stream = svn_stream_disown(dst_stream, pool);
124 /* Wrap the destination stream with our translation stream. It is more
125 efficient than wrapping the source stream. */
126 dst_stream = svn_subst_stream_translated(dst_stream, eol_str, repair,
127 keywords, expand, pool);
129 return svn_error_trace(svn_stream_copy3(src_stream, dst_stream,
134 svn_subst_translate_stream2(svn_stream_t *s, /* src stream */
135 svn_stream_t *d, /* dst stream */
137 svn_boolean_t repair,
138 const svn_subst_keywords_t *keywords,
139 svn_boolean_t expand,
142 apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
144 return svn_error_trace(svn_subst_translate_stream3(s, d, eol_str, repair,
149 svn_subst_translate_stream(svn_stream_t *s, /* src stream */
150 svn_stream_t *d, /* dst stream */
152 svn_boolean_t repair,
153 const svn_subst_keywords_t *keywords,
154 svn_boolean_t expand)
156 apr_pool_t *pool = svn_pool_create(NULL);
157 svn_error_t *err = svn_subst_translate_stream2(s, d, eol_str, repair,
158 keywords, expand, pool);
159 svn_pool_destroy(pool);
160 return svn_error_trace(err);
164 svn_subst_translate_cstring(const char *src,
167 svn_boolean_t repair,
168 const svn_subst_keywords_t *keywords,
169 svn_boolean_t expand,
172 apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
174 return svn_error_trace(svn_subst_translate_cstring2(src, dst, eol_str,
180 svn_subst_copy_and_translate(const char *src,
183 svn_boolean_t repair,
184 const svn_subst_keywords_t *keywords,
185 svn_boolean_t expand,
188 return svn_error_trace(svn_subst_copy_and_translate2(src, dst, eol_str,
190 expand, FALSE, pool));
194 svn_subst_copy_and_translate2(const char *src,
197 svn_boolean_t repair,
198 const svn_subst_keywords_t *keywords,
199 svn_boolean_t expand,
200 svn_boolean_t special,
203 apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
205 return svn_error_trace(svn_subst_copy_and_translate3(src, dst, eol_str,
211 svn_subst_copy_and_translate3(const char *src,
214 svn_boolean_t repair,
215 apr_hash_t *keywords,
216 svn_boolean_t expand,
217 svn_boolean_t special,
220 return svn_error_trace(svn_subst_copy_and_translate4(src, dst, eol_str,
229 svn_subst_stream_translated_to_normal_form(svn_stream_t **stream,
230 svn_stream_t *source,
231 svn_subst_eol_style_t eol_style,
233 svn_boolean_t always_repair_eols,
234 apr_hash_t *keywords,
237 if (eol_style == svn_subst_eol_style_native)
238 eol_str = SVN_SUBST_NATIVE_EOL_STR;
239 else if (! (eol_style == svn_subst_eol_style_fixed
240 || eol_style == svn_subst_eol_style_none))
241 return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
243 *stream = svn_subst_stream_translated(source, eol_str,
244 eol_style == svn_subst_eol_style_fixed
245 || always_repair_eols,
246 keywords, FALSE, pool);
252 svn_subst_translate_string(svn_string_t **new_value,
253 const svn_string_t *value,
254 const char *encoding,
257 return svn_subst_translate_string2(new_value, NULL, NULL, value,
258 encoding, FALSE, pool, pool);
262 svn_subst_stream_detranslated(svn_stream_t **stream_p,
264 svn_subst_eol_style_t eol_style,
266 svn_boolean_t always_repair_eols,
267 apr_hash_t *keywords,
268 svn_boolean_t special,
271 svn_stream_t *src_stream;
274 return svn_subst_read_specialfile(stream_p, src, pool, pool);
276 /* This will be closed by svn_subst_stream_translated_to_normal_form
277 when the returned stream is closed. */
278 SVN_ERR(svn_stream_open_readonly(&src_stream, src, pool, pool));
280 return svn_error_trace(svn_subst_stream_translated_to_normal_form(
281 stream_p, src_stream,
288 svn_subst_translate_to_normal_form(const char *src,
290 svn_subst_eol_style_t eol_style,
292 svn_boolean_t always_repair_eols,
293 apr_hash_t *keywords,
294 svn_boolean_t special,
298 if (eol_style == svn_subst_eol_style_native)
299 eol_str = SVN_SUBST_NATIVE_EOL_STR;
300 else if (! (eol_style == svn_subst_eol_style_fixed
301 || eol_style == svn_subst_eol_style_none))
302 return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
304 return svn_error_trace(svn_subst_copy_and_translate3(
306 eol_style == svn_subst_eol_style_fixed
307 || always_repair_eols,
309 FALSE /* contract keywords */,
316 /* Same as print_command_info2(), but with deprecated struct revision. */
318 print_command_info(const svn_opt_subcommand_desc_t *cmd,
319 const apr_getopt_option_t *options_table,
324 svn_boolean_t first_time;
327 /* Print the canonical command name. */
328 SVN_ERR(svn_cmdline_fputs(cmd->name, stream, pool));
330 /* Print the list of aliases. */
332 for (i = 0; i < SVN_OPT_MAX_ALIASES; i++)
334 if (cmd->aliases[i] == NULL)
338 SVN_ERR(svn_cmdline_fputs(" (", stream, pool));
342 SVN_ERR(svn_cmdline_fputs(", ", stream, pool));
344 SVN_ERR(svn_cmdline_fputs(cmd->aliases[i], stream, pool));
348 SVN_ERR(svn_cmdline_fputs(")", stream, pool));
352 const apr_getopt_option_t *option;
353 svn_boolean_t have_options = FALSE;
355 SVN_ERR(svn_cmdline_fprintf(stream, pool, ": %s", _(cmd->help)));
357 /* Loop over all valid option codes attached to the subcommand */
358 for (i = 0; i < SVN_OPT_MAX_OPTIONS; i++)
360 if (cmd->valid_options[i])
364 SVN_ERR(svn_cmdline_fputs(_("\nValid options:\n"),
369 /* convert each option code into an option */
371 svn_opt_get_option_from_code2(cmd->valid_options[i],
372 options_table, NULL, pool);
374 /* print the option's docstring */
375 if (option && option->description)
378 svn_opt_format_option(&optstr, option, TRUE, pool);
379 SVN_ERR(svn_cmdline_fprintf(stream, pool, " %s\n",
386 SVN_ERR(svn_cmdline_fprintf(stream, pool, "\n"));
392 const svn_opt_subcommand_desc_t *
393 svn_opt_get_canonical_subcommand(const svn_opt_subcommand_desc_t *table,
394 const char *cmd_name)
398 if (cmd_name == NULL)
401 while (table[i].name) {
403 if (strcmp(cmd_name, table[i].name) == 0)
405 for (j = 0; (j < SVN_OPT_MAX_ALIASES) && table[i].aliases[j]; j++)
406 if (strcmp(cmd_name, table[i].aliases[j]) == 0)
412 /* If we get here, there was no matching subcommand name or alias. */
417 svn_opt_subcommand_help2(const char *subcommand,
418 const svn_opt_subcommand_desc2_t *table,
419 const apr_getopt_option_t *options_table,
422 svn_opt_subcommand_help3(subcommand, table, options_table,
427 svn_opt_subcommand_help(const char *subcommand,
428 const svn_opt_subcommand_desc_t *table,
429 const apr_getopt_option_t *options_table,
432 const svn_opt_subcommand_desc_t *cmd =
433 svn_opt_get_canonical_subcommand(table, subcommand);
437 err = print_command_info(cmd, options_table, TRUE, pool, stdout);
439 err = svn_cmdline_fprintf(stderr, pool,
440 _("\"%s\": unknown command.\n\n"), subcommand);
443 svn_handle_error2(err, stderr, FALSE, "svn: ");
444 svn_error_clear(err);
449 svn_opt_args_to_target_array3(apr_array_header_t **targets_p,
451 const apr_array_header_t *known_targets,
454 return svn_error_trace(svn_opt__args_to_target_array(targets_p, os,
455 known_targets, pool));
459 svn_opt_args_to_target_array2(apr_array_header_t **targets_p,
461 const apr_array_header_t *known_targets,
464 svn_error_t *err = svn_opt_args_to_target_array3(targets_p, os,
465 known_targets, pool);
467 if (err && err->apr_err == SVN_ERR_RESERVED_FILENAME_SPECIFIED)
469 svn_error_clear(err);
477 svn_opt_args_to_target_array(apr_array_header_t **targets_p,
479 const apr_array_header_t *known_targets,
480 svn_opt_revision_t *start_revision,
481 svn_opt_revision_t *end_revision,
482 svn_boolean_t extract_revisions,
485 apr_array_header_t *output_targets;
487 SVN_ERR(svn_opt_args_to_target_array2(&output_targets, os,
488 known_targets, pool));
490 if (extract_revisions)
492 svn_opt_revision_t temprev;
495 if (output_targets->nelts > 0)
497 path = APR_ARRAY_IDX(output_targets, 0, const char *);
498 SVN_ERR(svn_opt_parse_path(&temprev, &path, path, pool));
499 if (temprev.kind != svn_opt_revision_unspecified)
501 APR_ARRAY_IDX(output_targets, 0, const char *) = path;
502 start_revision->kind = temprev.kind;
503 start_revision->value = temprev.value;
506 if (output_targets->nelts > 1)
508 path = APR_ARRAY_IDX(output_targets, 1, const char *);
509 SVN_ERR(svn_opt_parse_path(&temprev, &path, path, pool));
510 if (temprev.kind != svn_opt_revision_unspecified)
512 APR_ARRAY_IDX(output_targets, 1, const char *) = path;
513 end_revision->kind = temprev.kind;
514 end_revision->value = temprev.value;
519 *targets_p = output_targets;
524 svn_opt_print_help3(apr_getopt_t *os,
525 const char *pgm_name,
526 svn_boolean_t print_version,
528 const char *version_footer,
530 const svn_opt_subcommand_desc2_t *cmd_table,
531 const apr_getopt_option_t *option_table,
532 const int *global_options,
536 return svn_error_trace(svn_opt_print_help4(os,
551 svn_opt_print_help2(apr_getopt_t *os,
552 const char *pgm_name,
553 svn_boolean_t print_version,
555 const char *version_footer,
557 const svn_opt_subcommand_desc2_t *cmd_table,
558 const apr_getopt_option_t *option_table,
562 return svn_error_trace(svn_opt_print_help4(os,
577 svn_opt_print_help(apr_getopt_t *os,
578 const char *pgm_name,
579 svn_boolean_t print_version,
581 const char *version_footer,
583 const svn_opt_subcommand_desc_t *cmd_table,
584 const apr_getopt_option_t *option_table,
588 apr_array_header_t *targets = NULL;
591 SVN_ERR(svn_opt_parse_all_args(&targets, os, pool));
593 if (os && targets->nelts) /* help on subcommand(s) requested */
597 for (i = 0; i < targets->nelts; i++)
599 svn_opt_subcommand_help(APR_ARRAY_IDX(targets, i, const char *),
600 cmd_table, option_table, pool);
603 else if (print_version) /* just --version */
605 SVN_ERR(svn_opt__print_version_info(pgm_name, version_footer,
606 svn_version_extended(FALSE, pool),
607 quiet, FALSE, pool));
609 else if (os && !targets->nelts) /* `-h', `--help', or `help' */
610 svn_opt_print_generic_help(header,
616 else /* unknown option or cmd */
617 SVN_ERR(svn_cmdline_fprintf(stderr, pool,
618 _("Type '%s help' for usage.\n"), pgm_name));
624 svn_opt_print_generic_help(const char *header,
625 const svn_opt_subcommand_desc_t *cmd_table,
626 const apr_getopt_option_t *opt_table,
628 apr_pool_t *pool, FILE *stream)
634 if ((err = svn_cmdline_fputs(header, stream, pool)))
637 while (cmd_table[i].name)
639 if ((err = svn_cmdline_fputs(" ", stream, pool))
640 || (err = print_command_info(cmd_table + i, opt_table, FALSE,
642 || (err = svn_cmdline_fputs("\n", stream, pool)))
647 if ((err = svn_cmdline_fputs("\n", stream, pool)))
651 if ((err = svn_cmdline_fputs(footer, stream, pool)))
657 svn_handle_error2(err, stderr, FALSE, "svn: ");
658 svn_error_clear(err);
663 svn_io_open_unique_file2(apr_file_t **file,
664 const char **temp_path,
667 svn_io_file_del_t delete_when,
671 const char *filename;
673 svn_path_split(path, &dirpath, &filename, pool);
674 return svn_error_trace(svn_io_open_uniquely_named(file, temp_path,
675 dirpath, filename, suffix,
681 svn_io_open_unique_file(apr_file_t **file,
682 const char **temp_path,
685 svn_boolean_t delete_on_close,
688 return svn_error_trace(svn_io_open_unique_file2(file, temp_path,
691 ? svn_io_file_del_on_close
692 : svn_io_file_del_none,
697 svn_io_run_diff(const char *dir,
698 const char *const *user_args,
707 const char *diff_cmd,
710 SVN_ERR(svn_path_cstring_to_utf8(&diff_cmd, diff_cmd, pool));
712 return svn_error_trace(svn_io_run_diff2(dir, user_args, num_user_args,
715 outfile, errfile, diff_cmd,
720 svn_io_run_diff3_2(int *exitcode,
725 const char *mine_label,
726 const char *older_label,
727 const char *yours_label,
729 const char *diff3_cmd,
730 const apr_array_header_t *user_args,
733 SVN_ERR(svn_path_cstring_to_utf8(&diff3_cmd, diff3_cmd, pool));
735 return svn_error_trace(svn_io_run_diff3_3(exitcode, dir,
737 mine_label, older_label,
739 diff3_cmd, user_args, pool));
743 svn_io_run_diff3(const char *dir,
747 const char *mine_label,
748 const char *older_label,
749 const char *yours_label,
752 const char *diff3_cmd,
755 return svn_error_trace(svn_io_run_diff3_2(exitcode, dir, mine, older, yours,
756 mine_label, older_label,
758 merged, diff3_cmd, NULL, pool));
762 svn_io_remove_file(const char *path,
763 apr_pool_t *scratch_pool)
765 return svn_error_trace(svn_io_remove_file2(path, FALSE, scratch_pool));
768 svn_error_t *svn_io_file_lock(const char *lock_file,
769 svn_boolean_t exclusive,
772 return svn_io_file_lock2(lock_file, exclusive, FALSE, pool);
776 svn_io_get_dirents2(apr_hash_t **dirents,
780 /* Note that the first part of svn_io_dirent2_t is identical
781 to svn_io_dirent_t to allow this construct */
782 return svn_error_trace(
783 svn_io_get_dirents3(dirents, path, FALSE, pool, pool));
787 svn_io_get_dirents(apr_hash_t **dirents,
791 /* Note that in C, padding is not allowed at the beginning of structs,
792 so this is actually portable, since the kind field of svn_io_dirent_t
793 is first in that struct. */
794 return svn_io_get_dirents2(dirents, path, pool);
798 svn_io_start_cmd2(apr_proc_t *cmd_proc,
801 const char *const *args,
802 svn_boolean_t inherit,
803 svn_boolean_t infile_pipe,
805 svn_boolean_t outfile_pipe,
807 svn_boolean_t errfile_pipe,
811 return svn_io_start_cmd3(cmd_proc, path, cmd, args, NULL, inherit,
812 infile_pipe, infile, outfile_pipe, outfile,
813 errfile_pipe, errfile, pool);
817 svn_io_start_cmd(apr_proc_t *cmd_proc,
820 const char *const *args,
821 svn_boolean_t inherit,
827 return svn_io_start_cmd2(cmd_proc, path, cmd, args, inherit, FALSE,
828 infile, FALSE, outfile, FALSE, errfile, pool);
832 svn_io_file_read_full(apr_file_t *file, void *buf,
833 apr_size_t nbytes, apr_size_t *bytes_read,
836 return svn_io_file_read_full2(file, buf, nbytes, bytes_read, NULL, pool);
839 struct walk_func_filter_baton_t
841 svn_io_walk_func_t walk_func;
845 /* Implements svn_io_walk_func_t, but only allows APR_DIR and APR_REG
846 finfo types through to the wrapped function/baton. */
848 walk_func_filter_func(void *baton,
850 const apr_finfo_t *finfo,
853 struct walk_func_filter_baton_t *b = baton;
855 if (finfo->filetype == APR_DIR || finfo->filetype == APR_REG)
856 SVN_ERR(b->walk_func(b->walk_baton, path, finfo, pool));
862 svn_io_dir_walk(const char *dirname,
864 svn_io_walk_func_t walk_func,
868 struct walk_func_filter_baton_t baton;
869 baton.walk_func = walk_func;
870 baton.walk_baton = walk_baton;
871 return svn_error_trace(svn_io_dir_walk2(dirname, wanted,
872 walk_func_filter_func,
877 svn_io_stat_dirent(const svn_io_dirent2_t **dirent_p,
879 svn_boolean_t ignore_enoent,
880 apr_pool_t *result_pool,
881 apr_pool_t *scratch_pool)
883 return svn_error_trace(
884 svn_io_stat_dirent2(dirent_p,
892 /*** From constructors.c ***/
893 svn_log_changed_path_t *
894 svn_log_changed_path_dup(const svn_log_changed_path_t *changed_path,
897 svn_log_changed_path_t *new_changed_path
898 = apr_palloc(pool, sizeof(*new_changed_path));
900 *new_changed_path = *changed_path;
902 if (new_changed_path->copyfrom_path)
903 new_changed_path->copyfrom_path =
904 apr_pstrdup(pool, new_changed_path->copyfrom_path);
906 return new_changed_path;
909 /*** From cmdline.c ***/
911 svn_cmdline_prompt_user(const char **result,
912 const char *prompt_str,
915 return svn_error_trace(svn_cmdline_prompt_user2(result, prompt_str, NULL,
920 svn_cmdline_setup_auth_baton(svn_auth_baton_t **ab,
921 svn_boolean_t non_interactive,
922 const char *auth_username,
923 const char *auth_password,
924 const char *config_dir,
925 svn_boolean_t no_auth_cache,
927 svn_cancel_func_t cancel_func,
931 return svn_error_trace(svn_cmdline_create_auth_baton(
933 auth_username, auth_password,
934 config_dir, no_auth_cache, FALSE,
935 cfg, cancel_func, cancel_baton, pool));
940 svn_dso_initialize(void)
942 svn_error_t *err = svn_dso_initialize2();
945 svn_error_clear(err);
950 /*** From simple_providers.c ***/
952 svn_auth_get_simple_provider(svn_auth_provider_object_t **provider,
955 svn_auth_get_simple_provider2(provider, NULL, NULL, pool);
958 /*** From ssl_client_cert_pw_providers.c ***/
960 svn_auth_get_ssl_client_cert_pw_file_provider
961 (svn_auth_provider_object_t **provider,
964 svn_auth_get_ssl_client_cert_pw_file_provider2(provider, NULL, NULL, pool);
967 /*** From path.c ***/
969 #define SVN_EMPTY_PATH ""
972 svn_path_url_add_component(const char *url,
973 const char *component,
976 /* URL can have trailing '/' */
977 url = svn_path_canonicalize(url, pool);
979 return svn_path_url_add_component2(url, component, pool);
983 svn_path_split(const char *path,
984 const char **dirpath,
985 const char **base_name,
988 assert(dirpath != base_name);
991 *dirpath = svn_path_dirname(path, pool);
994 *base_name = svn_path_basename(path, pool);
999 svn_path_split_if_file(const char *path,
1000 const char **pdirectory,
1007 SVN_ERR_ASSERT(svn_path_is_canonical(path, pool));
1009 err = svn_io_stat(&finfo, path, APR_FINFO_TYPE, pool);
1010 if (err && ! APR_STATUS_IS_ENOENT(err->apr_err))
1013 if (err || finfo.filetype == APR_REG)
1015 svn_error_clear(err);
1016 svn_path_split(path, pdirectory, pfile, pool);
1018 else if (finfo.filetype == APR_DIR)
1021 *pfile = SVN_EMPTY_PATH;
1025 return svn_error_createf(SVN_ERR_BAD_FILENAME, NULL,
1026 _("'%s' is neither a file nor a directory name"),
1027 svn_path_local_style(path, pool));
1030 return SVN_NO_ERROR;
1033 /*** From stream.c ***/
1034 svn_error_t *svn_stream_copy2(svn_stream_t *from, svn_stream_t *to,
1035 svn_cancel_func_t cancel_func,
1037 apr_pool_t *scratch_pool)
1039 return svn_error_trace(svn_stream_copy3(
1040 svn_stream_disown(from, scratch_pool),
1041 svn_stream_disown(to, scratch_pool),
1042 cancel_func, cancel_baton, scratch_pool));
1045 svn_error_t *svn_stream_copy(svn_stream_t *from, svn_stream_t *to,
1046 apr_pool_t *scratch_pool)
1048 return svn_error_trace(svn_stream_copy3(
1049 svn_stream_disown(from, scratch_pool),
1050 svn_stream_disown(to, scratch_pool),
1051 NULL, NULL, scratch_pool));
1055 svn_stream_from_aprfile(apr_file_t *file, apr_pool_t *pool)
1057 return svn_stream_from_aprfile2(file, TRUE, pool);
1061 svn_stream_contents_same(svn_boolean_t *same,
1062 svn_stream_t *stream1,
1063 svn_stream_t *stream2,
1066 return svn_error_trace(svn_stream_contents_same2(
1068 svn_stream_disown(stream1, pool),
1069 svn_stream_disown(stream2, pool),
1074 svn_stream_set_read(svn_stream_t *stream,
1075 svn_read_fn_t read_fn)
1077 svn_stream_set_read2(stream, NULL /* only full read support */,
1082 svn_stream_read(svn_stream_t *stream,
1086 return svn_error_trace(svn_stream_read_full(stream, buffer, len));
1089 struct md5_stream_baton
1091 const unsigned char **read_digest;
1092 const unsigned char **write_digest;
1093 svn_checksum_t *read_checksum;
1094 svn_checksum_t *write_checksum;
1095 svn_stream_t *proxy;
1099 static svn_error_t *
1100 read_handler_md5(void *baton, char *buffer, apr_size_t *len)
1102 struct md5_stream_baton *btn = baton;
1103 return svn_error_trace(svn_stream_read2(btn->proxy, buffer, len));
1106 static svn_error_t *
1107 read_full_handler_md5(void *baton, char *buffer, apr_size_t *len)
1109 struct md5_stream_baton *btn = baton;
1110 return svn_error_trace(svn_stream_read_full(btn->proxy, buffer, len));
1113 static svn_error_t *
1114 skip_handler_md5(void *baton, apr_size_t len)
1116 struct md5_stream_baton *btn = baton;
1117 return svn_error_trace(svn_stream_skip(btn->proxy, len));
1120 static svn_error_t *
1121 write_handler_md5(void *baton, const char *buffer, apr_size_t *len)
1123 struct md5_stream_baton *btn = baton;
1124 return svn_error_trace(svn_stream_write(btn->proxy, buffer, len));
1127 static svn_error_t *
1128 close_handler_md5(void *baton)
1130 struct md5_stream_baton *btn = baton;
1132 SVN_ERR(svn_stream_close(btn->proxy));
1134 if (btn->read_digest)
1136 = apr_pmemdup(btn->pool, btn->read_checksum->digest,
1137 APR_MD5_DIGESTSIZE);
1139 if (btn->write_digest)
1141 = apr_pmemdup(btn->pool, btn->write_checksum->digest,
1142 APR_MD5_DIGESTSIZE);
1144 return SVN_NO_ERROR;
1149 svn_stream_checksummed(svn_stream_t *stream,
1150 const unsigned char **read_digest,
1151 const unsigned char **write_digest,
1152 svn_boolean_t read_all,
1156 struct md5_stream_baton *baton;
1158 if (! read_digest && ! write_digest)
1161 baton = apr_palloc(pool, sizeof(*baton));
1162 baton->read_digest = read_digest;
1163 baton->write_digest = write_digest;
1166 /* Set BATON->proxy to a stream that will fill in BATON->read_checksum
1167 * and BATON->write_checksum (if we want them) when it is closed. */
1169 = svn_stream_checksummed2(stream,
1170 read_digest ? &baton->read_checksum : NULL,
1171 write_digest ? &baton->write_checksum : NULL,
1175 /* Create a stream that will forward its read/write/close operations to
1176 * BATON->proxy and will fill in *READ_DIGEST and *WRITE_DIGEST (if we
1177 * want them) after it closes BATON->proxy. */
1178 s = svn_stream_create(baton, pool);
1179 svn_stream_set_read2(s, read_handler_md5, read_full_handler_md5);
1180 svn_stream_set_skip(s, skip_handler_md5);
1181 svn_stream_set_write(s, write_handler_md5);
1182 svn_stream_set_close(s, close_handler_md5);
1186 /*** From path.c ***/
1189 svn_path_internal_style(const char *path, apr_pool_t *pool)
1191 if (svn_path_is_url(path))
1192 return svn_uri_canonicalize(path, pool);
1194 return svn_dirent_internal_style(path, pool);
1199 svn_path_local_style(const char *path, apr_pool_t *pool)
1201 if (svn_path_is_url(path))
1202 return apr_pstrdup(pool, path);
1204 return svn_dirent_local_style(path, pool);
1208 svn_path_canonicalize(const char *path, apr_pool_t *pool)
1210 if (svn_path_is_url(path))
1211 return svn_uri_canonicalize(path, pool);
1213 return svn_dirent_canonicalize(path, pool);
1217 /*** From mergeinfo.c ***/
1220 svn_mergeinfo_inheritable(svn_mergeinfo_t *output,
1221 svn_mergeinfo_t mergeinfo,
1227 return svn_error_trace(svn_mergeinfo_inheritable2(output, mergeinfo, path,
1233 svn_rangelist_inheritable(svn_rangelist_t **inheritable_rangelist,
1234 const svn_rangelist_t *rangelist,
1239 return svn_error_trace(svn_rangelist_inheritable2(inheritable_rangelist,
1246 svn_rangelist_merge(svn_rangelist_t **rangelist,
1247 const svn_rangelist_t *changes,
1250 SVN_ERR(svn_rangelist_merge2(*rangelist, changes,
1253 return svn_error_trace(
1254 svn_rangelist__combine_adjacent_ranges(*rangelist, pool));
1258 svn_mergeinfo_diff(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added,
1259 svn_mergeinfo_t from, svn_mergeinfo_t to,
1260 svn_boolean_t consider_inheritance,
1263 return svn_error_trace(svn_mergeinfo_diff2(deleted, added, from, to,
1264 consider_inheritance, pool,
1269 svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo,
1270 svn_mergeinfo_t changes,
1273 return svn_error_trace(svn_mergeinfo_merge2(mergeinfo, changes, pool,
1278 svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser,
1279 svn_mergeinfo_t whiteboard, apr_pool_t *pool)
1281 return svn_mergeinfo_remove2(mergeinfo, eraser, whiteboard, TRUE, pool,
1286 svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo,
1287 svn_mergeinfo_t mergeinfo1,
1288 svn_mergeinfo_t mergeinfo2,
1291 return svn_mergeinfo_intersect2(mergeinfo, mergeinfo1, mergeinfo2,
1295 /*** From config.c ***/
1297 svn_config_create(svn_config_t **cfgp,
1298 svn_boolean_t section_names_case_sensitive,
1299 apr_pool_t *result_pool)
1301 return svn_error_trace(svn_config_create2(cfgp,
1302 section_names_case_sensitive,
1308 svn_config_read2(svn_config_t **cfgp, const char *file,
1309 svn_boolean_t must_exist,
1310 svn_boolean_t section_names_case_sensitive,
1311 apr_pool_t *result_pool)
1313 return svn_error_trace(svn_config_read3(cfgp, file,
1315 section_names_case_sensitive,
1321 svn_config_read(svn_config_t **cfgp, const char *file,
1322 svn_boolean_t must_exist,
1323 apr_pool_t *result_pool)
1325 return svn_error_trace(svn_config_read3(cfgp, file,
1331 #ifdef SVN_DISABLE_FULL_VERSION_MATCH
1332 /* This double underscore name is used by the 1.6 command line client.
1333 Keeping this name is sufficient for the 1.6 client to use the 1.7
1334 libraries at runtime. */
1336 svn_opt__eat_peg_revisions(apr_array_header_t **true_targets_p,
1337 apr_array_header_t *targets,
1340 svn_opt__eat_peg_revisions(apr_array_header_t **true_targets_p,
1341 apr_array_header_t *targets,
1345 apr_array_header_t *true_targets;
1347 true_targets = apr_array_make(pool, 5, sizeof(const char *));
1349 for (i = 0; i < targets->nelts; i++)
1351 const char *target = APR_ARRAY_IDX(targets, i, const char *);
1352 const char *true_target;
1354 SVN_ERR(svn_opt__split_arg_at_peg_revision(&true_target, NULL,
1356 APR_ARRAY_PUSH(true_targets, const char *) = true_target;
1359 SVN_ERR_ASSERT(true_targets_p);
1360 *true_targets_p = true_targets;
1362 return SVN_NO_ERROR;
1367 svn_xml_make_header(svn_stringbuf_t **str, apr_pool_t *pool)
1369 svn_xml_make_header2(str, NULL, pool);
1373 /*** From utf.c ***/
1375 svn_utf_initialize(apr_pool_t *pool)
1377 svn_utf_initialize2(FALSE, pool);
1381 svn_utf_cstring_from_utf8_ex(const char **dest,
1384 const char *convset_key,
1387 return svn_utf_cstring_from_utf8_ex2(dest, src, topage, pool);
1390 /*** From error.c ***/
1392 svn_handle_error(svn_error_t *err, FILE *stream, svn_boolean_t fatal)
1394 svn_handle_error2(err, stream, fatal, "svn: ");
1398 svn_handle_warning(FILE *stream, svn_error_t *err)
1400 svn_handle_warning2(stream, err, "svn: ");
1404 /*** From subst.c ***/
1406 svn_subst_build_keywords(svn_subst_keywords_t *kw,
1407 const char *keywords_val,
1415 const svn_string_t *val;
1417 SVN_ERR(svn_subst_build_keywords2(&kwhash, keywords_val, rev,
1418 url, date, author, pool));
1420 /* The behaviour of pre-1.3 svn_subst_build_keywords, which we are
1421 * replicating here, is to write to a slot in the svn_subst_keywords_t
1422 * only if the relevant keyword was present in keywords_val, otherwise
1423 * leaving that slot untouched. */
1425 val = svn_hash_gets(kwhash, SVN_KEYWORD_REVISION_LONG);
1429 val = svn_hash_gets(kwhash, SVN_KEYWORD_DATE_LONG);
1433 val = svn_hash_gets(kwhash, SVN_KEYWORD_AUTHOR_LONG);
1437 val = svn_hash_gets(kwhash, SVN_KEYWORD_URL_LONG);
1441 val = svn_hash_gets(kwhash, SVN_KEYWORD_ID);
1445 return SVN_NO_ERROR;
1448 /*** From version.c ***/
1450 svn_ver_check_list(const svn_version_t *my_version,
1451 const svn_version_checklist_t *checklist)
1453 return svn_ver_check_list2(my_version, checklist, svn_ver_compatible);
1456 /*** From win32_crypto.c ***/
1457 #if defined(WIN32) && !defined(__MINGW32__)
1459 svn_auth_get_windows_simple_provider(svn_auth_provider_object_t **provider,
1462 svn_auth__get_windows_simple_provider(provider, pool);
1466 svn_auth_get_windows_ssl_client_cert_pw_provider
1467 (svn_auth_provider_object_t **provider,
1470 svn_auth__get_windows_ssl_client_cert_pw_provider(provider, pool);
1474 svn_auth_get_windows_ssl_server_trust_provider
1475 (svn_auth_provider_object_t **provider, apr_pool_t *pool)
1477 svn_auth__get_windows_ssl_server_trust_provider(provider, pool);
1479 #endif /* WIN32 && !__MINGW32__ */
1481 /*** From macos_keychain.c ***/
1484 svn_auth_get_keychain_simple_provider(svn_auth_provider_object_t **provider,
1487 svn_auth__get_keychain_simple_provider(provider, pool);
1491 svn_auth_get_keychain_ssl_client_cert_pw_provider
1492 (svn_auth_provider_object_t **provider,
1495 svn_auth__get_keychain_ssl_client_cert_pw_provider(provider, pool);
1501 svn_auth_get_gpg_agent_simple_provider(svn_auth_provider_object_t **provider,
1504 #ifdef SVN_HAVE_GPG_AGENT
1505 svn_auth__get_gpg_agent_simple_provider(provider, pool);
1507 svn_auth__get_dummmy_simple_provider(provider, pool);
1508 #endif /* SVN_HAVE_GPG_AGENT */
1513 svn_cmdline_create_auth_baton(svn_auth_baton_t **ab,
1514 svn_boolean_t non_interactive,
1515 const char *auth_username,
1516 const char *auth_password,
1517 const char *config_dir,
1518 svn_boolean_t no_auth_cache,
1519 svn_boolean_t trust_server_cert,
1521 svn_cancel_func_t cancel_func,
1525 return svn_error_trace(svn_cmdline_create_auth_baton2(ab,