]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/libsvn_subr/deprecated.c
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / libsvn_subr / deprecated.c
1 /*
2  * deprecated.c:  holding file for all deprecated APIs.
3  *                "we can't lose 'em, but we can shun 'em!"
4  *
5  * ====================================================================
6  *    Licensed to the Apache Software Foundation (ASF) under one
7  *    or more contributor license agreements.  See the NOTICE file
8  *    distributed with this work for additional information
9  *    regarding copyright ownership.  The ASF licenses this file
10  *    to you under the Apache License, Version 2.0 (the
11  *    "License"); you may not use this file except in compliance
12  *    with the License.  You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  *    Unless required by applicable law or agreed to in writing,
17  *    software distributed under the License is distributed on an
18  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  *    KIND, either express or implied.  See the License for the
20  *    specific language governing permissions and limitations
21  *    under the License.
22  * ====================================================================
23  */
24
25 /* ==================================================================== */
26
27
28 \f
29 #include <assert.h>
30
31 #include <apr_md5.h>
32
33 /* We define this here to remove any further warnings about the usage of
34    deprecated functions in this file. */
35 #define SVN_DEPRECATED
36
37 #include "svn_hash.h"
38 #include "svn_subst.h"
39 #include "svn_path.h"
40 #include "svn_opt.h"
41 #include "svn_cmdline.h"
42 #include "svn_version.h"
43 #include "svn_pools.h"
44 #include "svn_dso.h"
45 #include "svn_mergeinfo.h"
46 #include "svn_utf.h"
47 #include "svn_xml.h"
48 #include "svn_auth.h"
49
50 #include "opt.h"
51 #include "auth.h"
52 #include "private/svn_opt_private.h"
53 #include "private/svn_mergeinfo_private.h"
54
55 #include "svn_private_config.h"
56
57
58
59 \f
60 /*** Code. ***/
61
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. */
67 static apr_hash_t *
68 kwstruct_to_kwhash(const svn_subst_keywords_t *kwstruct,
69                    apr_pool_t *pool)
70 {
71   apr_hash_t *kwhash;
72
73   if (kwstruct == NULL)
74     return NULL;
75
76   kwhash = apr_hash_make(pool);
77
78   if (kwstruct->revision)
79     {
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);
83     }
84   if (kwstruct->date)
85     {
86       svn_hash_sets(kwhash, SVN_KEYWORD_DATE_LONG, kwstruct->date);
87       svn_hash_sets(kwhash, SVN_KEYWORD_DATE_SHORT, kwstruct->date);
88     }
89   if (kwstruct->author)
90     {
91       svn_hash_sets(kwhash, SVN_KEYWORD_AUTHOR_LONG, kwstruct->author);
92       svn_hash_sets(kwhash, SVN_KEYWORD_AUTHOR_SHORT, kwstruct->author);
93     }
94   if (kwstruct->url)
95     {
96       svn_hash_sets(kwhash, SVN_KEYWORD_URL_LONG, kwstruct->url);
97       svn_hash_sets(kwhash, SVN_KEYWORD_URL_SHORT, kwstruct->url);
98     }
99   if (kwstruct->id)
100     {
101       svn_hash_sets(kwhash, SVN_KEYWORD_ID, kwstruct->id);
102     }
103
104   return kwhash;
105 }
106
107
108 svn_error_t *
109 svn_subst_translate_stream3(svn_stream_t *src_stream,
110                             svn_stream_t *dst_stream,
111                             const char *eol_str,
112                             svn_boolean_t repair,
113                             apr_hash_t *keywords,
114                             svn_boolean_t expand,
115                             apr_pool_t *pool)
116 {
117   /* The docstring requires that *some* translation be requested. */
118   SVN_ERR_ASSERT(eol_str || keywords);
119
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);
123
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);
128
129   return svn_error_trace(svn_stream_copy3(src_stream, dst_stream,
130                                           NULL, NULL, pool));
131 }
132
133 svn_error_t *
134 svn_subst_translate_stream2(svn_stream_t *s, /* src stream */
135                             svn_stream_t *d, /* dst stream */
136                             const char *eol_str,
137                             svn_boolean_t repair,
138                             const svn_subst_keywords_t *keywords,
139                             svn_boolean_t expand,
140                             apr_pool_t *pool)
141 {
142   apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
143
144   return svn_error_trace(svn_subst_translate_stream3(s, d, eol_str, repair,
145                                                      kh, expand, pool));
146 }
147
148 svn_error_t *
149 svn_subst_translate_stream(svn_stream_t *s, /* src stream */
150                            svn_stream_t *d, /* dst stream */
151                            const char *eol_str,
152                            svn_boolean_t repair,
153                            const svn_subst_keywords_t *keywords,
154                            svn_boolean_t expand)
155 {
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);
161 }
162
163 svn_error_t *
164 svn_subst_translate_cstring(const char *src,
165                             const char **dst,
166                             const char *eol_str,
167                             svn_boolean_t repair,
168                             const svn_subst_keywords_t *keywords,
169                             svn_boolean_t expand,
170                             apr_pool_t *pool)
171 {
172   apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
173
174   return svn_error_trace(svn_subst_translate_cstring2(src, dst, eol_str,
175                                                       repair, kh, expand,
176                                                       pool));
177 }
178
179 svn_error_t *
180 svn_subst_copy_and_translate(const char *src,
181                              const char *dst,
182                              const char *eol_str,
183                              svn_boolean_t repair,
184                              const svn_subst_keywords_t *keywords,
185                              svn_boolean_t expand,
186                              apr_pool_t *pool)
187 {
188   return svn_error_trace(svn_subst_copy_and_translate2(src, dst, eol_str,
189                                                        repair, keywords,
190                                                        expand, FALSE, pool));
191 }
192
193 svn_error_t *
194 svn_subst_copy_and_translate2(const char *src,
195                               const char *dst,
196                               const char *eol_str,
197                               svn_boolean_t repair,
198                               const svn_subst_keywords_t *keywords,
199                               svn_boolean_t expand,
200                               svn_boolean_t special,
201                               apr_pool_t *pool)
202 {
203   apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
204
205   return svn_error_trace(svn_subst_copy_and_translate3(src, dst, eol_str,
206                                                        repair, kh, expand,
207                                                        special, pool));
208 }
209
210 svn_error_t *
211 svn_subst_copy_and_translate3(const char *src,
212                               const char *dst,
213                               const char *eol_str,
214                               svn_boolean_t repair,
215                               apr_hash_t *keywords,
216                               svn_boolean_t expand,
217                               svn_boolean_t special,
218                               apr_pool_t *pool)
219 {
220   return svn_error_trace(svn_subst_copy_and_translate4(src, dst, eol_str,
221                                                        repair, keywords,
222                                                        expand, special,
223                                                        NULL, NULL,
224                                                        pool));
225 }
226
227
228 svn_error_t *
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,
232                                            const char *eol_str,
233                                            svn_boolean_t always_repair_eols,
234                                            apr_hash_t *keywords,
235                                            apr_pool_t *pool)
236 {
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);
242
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);
247
248  return SVN_NO_ERROR;
249 }
250
251 svn_error_t *
252 svn_subst_translate_string(svn_string_t **new_value,
253                            const svn_string_t *value,
254                            const char *encoding,
255                            apr_pool_t *pool)
256 {
257   return svn_subst_translate_string2(new_value, NULL, NULL, value,
258                                      encoding, FALSE, pool, pool);
259 }
260
261 svn_error_t *
262 svn_subst_stream_detranslated(svn_stream_t **stream_p,
263                               const char *src,
264                               svn_subst_eol_style_t eol_style,
265                               const char *eol_str,
266                               svn_boolean_t always_repair_eols,
267                               apr_hash_t *keywords,
268                               svn_boolean_t special,
269                               apr_pool_t *pool)
270 {
271   svn_stream_t *src_stream;
272
273   if (special)
274     return svn_subst_read_specialfile(stream_p, src, pool, pool);
275
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));
279
280   return svn_error_trace(svn_subst_stream_translated_to_normal_form(
281                            stream_p, src_stream,
282                            eol_style, eol_str,
283                            always_repair_eols,
284                            keywords, pool));
285 }
286
287 svn_error_t *
288 svn_subst_translate_to_normal_form(const char *src,
289                                    const char *dst,
290                                    svn_subst_eol_style_t eol_style,
291                                    const char *eol_str,
292                                    svn_boolean_t always_repair_eols,
293                                    apr_hash_t *keywords,
294                                    svn_boolean_t special,
295                                    apr_pool_t *pool)
296 {
297
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);
303
304   return svn_error_trace(svn_subst_copy_and_translate3(
305                            src, dst, eol_str,
306                            eol_style == svn_subst_eol_style_fixed
307                              || always_repair_eols,
308                            keywords,
309                            FALSE /* contract keywords */,
310                            special,
311                            pool));
312 }
313
314
315 /*** From opt.c ***/
316 /* Same as print_command_info2(), but with deprecated struct revision. */
317 static svn_error_t *
318 print_command_info(const svn_opt_subcommand_desc_t *cmd,
319                    const apr_getopt_option_t *options_table,
320                    svn_boolean_t help,
321                    apr_pool_t *pool,
322                    FILE *stream)
323 {
324   svn_boolean_t first_time;
325   apr_size_t i;
326
327   /* Print the canonical command name. */
328   SVN_ERR(svn_cmdline_fputs(cmd->name, stream, pool));
329
330   /* Print the list of aliases. */
331   first_time = TRUE;
332   for (i = 0; i < SVN_OPT_MAX_ALIASES; i++)
333     {
334       if (cmd->aliases[i] == NULL)
335         break;
336
337       if (first_time) {
338         SVN_ERR(svn_cmdline_fputs(" (", stream, pool));
339         first_time = FALSE;
340       }
341       else
342         SVN_ERR(svn_cmdline_fputs(", ", stream, pool));
343
344       SVN_ERR(svn_cmdline_fputs(cmd->aliases[i], stream, pool));
345     }
346
347   if (! first_time)
348     SVN_ERR(svn_cmdline_fputs(")", stream, pool));
349
350   if (help)
351     {
352       const apr_getopt_option_t *option;
353       svn_boolean_t have_options = FALSE;
354
355       SVN_ERR(svn_cmdline_fprintf(stream, pool, ": %s", _(cmd->help)));
356
357       /* Loop over all valid option codes attached to the subcommand */
358       for (i = 0; i < SVN_OPT_MAX_OPTIONS; i++)
359         {
360           if (cmd->valid_options[i])
361             {
362               if (!have_options)
363                 {
364                   SVN_ERR(svn_cmdline_fputs(_("\nValid options:\n"),
365                                             stream, pool));
366                   have_options = TRUE;
367                 }
368
369               /* convert each option code into an option */
370               option =
371                 svn_opt_get_option_from_code2(cmd->valid_options[i],
372                                               options_table, NULL, pool);
373
374               /* print the option's docstring */
375               if (option && option->description)
376                 {
377                   const char *optstr;
378                   svn_opt_format_option(&optstr, option, TRUE, pool);
379                   SVN_ERR(svn_cmdline_fprintf(stream, pool, "  %s\n",
380                                               optstr));
381                 }
382             }
383         }
384
385       if (have_options)
386         SVN_ERR(svn_cmdline_fprintf(stream, pool, "\n"));
387     }
388
389   return SVN_NO_ERROR;
390 }
391
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)
395 {
396   int i = 0;
397
398   if (cmd_name == NULL)
399     return NULL;
400
401   while (table[i].name) {
402     int j;
403     if (strcmp(cmd_name, table[i].name) == 0)
404       return table + i;
405     for (j = 0; (j < SVN_OPT_MAX_ALIASES) && table[i].aliases[j]; j++)
406       if (strcmp(cmd_name, table[i].aliases[j]) == 0)
407         return table + i;
408
409     i++;
410   }
411
412   /* If we get here, there was no matching subcommand name or alias. */
413   return NULL;
414 }
415
416 void
417 svn_opt_subcommand_help2(const char *subcommand,
418                          const svn_opt_subcommand_desc2_t *table,
419                          const apr_getopt_option_t *options_table,
420                          apr_pool_t *pool)
421 {
422   svn_opt_subcommand_help3(subcommand, table, options_table,
423                            NULL, pool);
424 }
425
426 void
427 svn_opt_subcommand_help(const char *subcommand,
428                         const svn_opt_subcommand_desc_t *table,
429                         const apr_getopt_option_t *options_table,
430                         apr_pool_t *pool)
431 {
432   const svn_opt_subcommand_desc_t *cmd =
433     svn_opt_get_canonical_subcommand(table, subcommand);
434   svn_error_t *err;
435
436   if (cmd)
437     err = print_command_info(cmd, options_table, TRUE, pool, stdout);
438   else
439     err = svn_cmdline_fprintf(stderr, pool,
440                               _("\"%s\": unknown command.\n\n"), subcommand);
441
442   if (err) {
443     svn_handle_error2(err, stderr, FALSE, "svn: ");
444     svn_error_clear(err);
445   }
446 }
447
448 svn_error_t *
449 svn_opt_args_to_target_array3(apr_array_header_t **targets_p,
450                               apr_getopt_t *os,
451                               const apr_array_header_t *known_targets,
452                               apr_pool_t *pool)
453 {
454   return svn_error_trace(svn_opt__args_to_target_array(targets_p, os,
455                                                        known_targets, pool));
456 }
457
458 svn_error_t *
459 svn_opt_args_to_target_array2(apr_array_header_t **targets_p,
460                               apr_getopt_t *os,
461                               const apr_array_header_t *known_targets,
462                               apr_pool_t *pool)
463 {
464   svn_error_t *err = svn_opt_args_to_target_array3(targets_p, os,
465                                                    known_targets, pool);
466
467   if (err && err->apr_err == SVN_ERR_RESERVED_FILENAME_SPECIFIED)
468     {
469       svn_error_clear(err);
470       return SVN_NO_ERROR;
471     }
472
473   return err;
474 }
475
476 svn_error_t *
477 svn_opt_args_to_target_array(apr_array_header_t **targets_p,
478                              apr_getopt_t *os,
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,
483                              apr_pool_t *pool)
484 {
485   apr_array_header_t *output_targets;
486
487   SVN_ERR(svn_opt_args_to_target_array2(&output_targets, os,
488                                         known_targets, pool));
489
490   if (extract_revisions)
491     {
492       svn_opt_revision_t temprev;
493       const char *path;
494
495       if (output_targets->nelts > 0)
496         {
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)
500             {
501               APR_ARRAY_IDX(output_targets, 0, const char *) = path;
502               start_revision->kind = temprev.kind;
503               start_revision->value = temprev.value;
504             }
505         }
506       if (output_targets->nelts > 1)
507         {
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)
511             {
512               APR_ARRAY_IDX(output_targets, 1, const char *) = path;
513               end_revision->kind = temprev.kind;
514               end_revision->value = temprev.value;
515             }
516         }
517     }
518
519   *targets_p = output_targets;
520   return SVN_NO_ERROR;
521 }
522
523 svn_error_t *
524 svn_opt_print_help3(apr_getopt_t *os,
525                     const char *pgm_name,
526                     svn_boolean_t print_version,
527                     svn_boolean_t quiet,
528                     const char *version_footer,
529                     const char *header,
530                     const svn_opt_subcommand_desc2_t *cmd_table,
531                     const apr_getopt_option_t *option_table,
532                     const int *global_options,
533                     const char *footer,
534                     apr_pool_t *pool)
535 {
536   return svn_error_trace(svn_opt_print_help4(os,
537                                              pgm_name,
538                                              print_version,
539                                              quiet,
540                                              FALSE,
541                                              version_footer,
542                                              header,
543                                              cmd_table,
544                                              option_table,
545                                              global_options,
546                                              footer,
547                                              pool));
548 }
549
550 svn_error_t *
551 svn_opt_print_help2(apr_getopt_t *os,
552                     const char *pgm_name,
553                     svn_boolean_t print_version,
554                     svn_boolean_t quiet,
555                     const char *version_footer,
556                     const char *header,
557                     const svn_opt_subcommand_desc2_t *cmd_table,
558                     const apr_getopt_option_t *option_table,
559                     const char *footer,
560                     apr_pool_t *pool)
561 {
562   return svn_error_trace(svn_opt_print_help4(os,
563                                              pgm_name,
564                                              print_version,
565                                              quiet,
566                                              FALSE,
567                                              version_footer,
568                                              header,
569                                              cmd_table,
570                                              option_table,
571                                              NULL,
572                                              footer,
573                                              pool));
574 }
575
576 svn_error_t *
577 svn_opt_print_help(apr_getopt_t *os,
578                    const char *pgm_name,
579                    svn_boolean_t print_version,
580                    svn_boolean_t quiet,
581                    const char *version_footer,
582                    const char *header,
583                    const svn_opt_subcommand_desc_t *cmd_table,
584                    const apr_getopt_option_t *option_table,
585                    const char *footer,
586                    apr_pool_t *pool)
587 {
588   apr_array_header_t *targets = NULL;
589
590   if (os)
591     SVN_ERR(svn_opt_parse_all_args(&targets, os, pool));
592
593   if (os && targets->nelts)  /* help on subcommand(s) requested */
594     {
595       int i;
596
597       for (i = 0; i < targets->nelts; i++)
598         {
599           svn_opt_subcommand_help(APR_ARRAY_IDX(targets, i, const char *),
600                                   cmd_table, option_table, pool);
601         }
602     }
603   else if (print_version)   /* just --version */
604     {
605       SVN_ERR(svn_opt__print_version_info(pgm_name, version_footer,
606                                           svn_version_extended(FALSE, pool),
607                                           quiet, FALSE, pool));
608     }
609   else if (os && !targets->nelts)            /* `-h', `--help', or `help' */
610     svn_opt_print_generic_help(header,
611                                cmd_table,
612                                option_table,
613                                footer,
614                                pool,
615                                stdout);
616   else                                       /* unknown option or cmd */
617     SVN_ERR(svn_cmdline_fprintf(stderr, pool,
618                                 _("Type '%s help' for usage.\n"), pgm_name));
619
620   return SVN_NO_ERROR;
621 }
622
623 void
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,
627                            const char *footer,
628                            apr_pool_t *pool, FILE *stream)
629 {
630   int i = 0;
631   svn_error_t *err;
632
633   if (header)
634     if ((err = svn_cmdline_fputs(header, stream, pool)))
635       goto print_error;
636
637   while (cmd_table[i].name)
638     {
639       if ((err = svn_cmdline_fputs("   ", stream, pool))
640           || (err = print_command_info(cmd_table + i, opt_table, FALSE,
641                                        pool, stream))
642           || (err = svn_cmdline_fputs("\n", stream, pool)))
643         goto print_error;
644       i++;
645     }
646
647   if ((err = svn_cmdline_fputs("\n", stream, pool)))
648     goto print_error;
649
650   if (footer)
651     if ((err = svn_cmdline_fputs(footer, stream, pool)))
652       goto print_error;
653
654   return;
655
656  print_error:
657   svn_handle_error2(err, stderr, FALSE, "svn: ");
658   svn_error_clear(err);
659 }
660
661 /*** From io.c ***/
662 svn_error_t *
663 svn_io_open_unique_file2(apr_file_t **file,
664                          const char **temp_path,
665                          const char *path,
666                          const char *suffix,
667                          svn_io_file_del_t delete_when,
668                          apr_pool_t *pool)
669 {
670   const char *dirpath;
671   const char *filename;
672
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,
676                                                     delete_when,
677                                                     pool, pool));
678 }
679
680 svn_error_t *
681 svn_io_open_unique_file(apr_file_t **file,
682                         const char **temp_path,
683                         const char *path,
684                         const char *suffix,
685                         svn_boolean_t delete_on_close,
686                         apr_pool_t *pool)
687 {
688   return svn_error_trace(svn_io_open_unique_file2(file, temp_path,
689                                                   path, suffix,
690                                                   delete_on_close
691                                                     ? svn_io_file_del_on_close
692                                                     : svn_io_file_del_none,
693                                                   pool));
694 }
695
696 svn_error_t *
697 svn_io_run_diff(const char *dir,
698                 const char *const *user_args,
699                 int num_user_args,
700                 const char *label1,
701                 const char *label2,
702                 const char *from,
703                 const char *to,
704                 int *pexitcode,
705                 apr_file_t *outfile,
706                 apr_file_t *errfile,
707                 const char *diff_cmd,
708                 apr_pool_t *pool)
709 {
710   SVN_ERR(svn_path_cstring_to_utf8(&diff_cmd, diff_cmd, pool));
711
712   return svn_error_trace(svn_io_run_diff2(dir, user_args, num_user_args,
713                                           label1, label2,
714                                           from, to, pexitcode,
715                                           outfile, errfile, diff_cmd,
716                                           pool));
717 }
718
719 svn_error_t *
720 svn_io_run_diff3_2(int *exitcode,
721                    const char *dir,
722                    const char *mine,
723                    const char *older,
724                    const char *yours,
725                    const char *mine_label,
726                    const char *older_label,
727                    const char *yours_label,
728                    apr_file_t *merged,
729                    const char *diff3_cmd,
730                    const apr_array_header_t *user_args,
731                    apr_pool_t *pool)
732 {
733   SVN_ERR(svn_path_cstring_to_utf8(&diff3_cmd, diff3_cmd, pool));
734
735   return svn_error_trace(svn_io_run_diff3_3(exitcode, dir,
736                                             mine, older, yours,
737                                             mine_label, older_label,
738                                             yours_label, merged,
739                                             diff3_cmd, user_args, pool));
740 }
741
742 svn_error_t *
743 svn_io_run_diff3(const char *dir,
744                  const char *mine,
745                  const char *older,
746                  const char *yours,
747                  const char *mine_label,
748                  const char *older_label,
749                  const char *yours_label,
750                  apr_file_t *merged,
751                  int *exitcode,
752                  const char *diff3_cmd,
753                  apr_pool_t *pool)
754 {
755   return svn_error_trace(svn_io_run_diff3_2(exitcode, dir, mine, older, yours,
756                                             mine_label, older_label,
757                                             yours_label,
758                                             merged, diff3_cmd, NULL, pool));
759 }
760
761 svn_error_t *
762 svn_io_remove_file(const char *path,
763                    apr_pool_t *scratch_pool)
764 {
765   return svn_error_trace(svn_io_remove_file2(path, FALSE, scratch_pool));
766 }
767
768 svn_error_t *svn_io_file_lock(const char *lock_file,
769                               svn_boolean_t exclusive,
770                               apr_pool_t *pool)
771 {
772   return svn_io_file_lock2(lock_file, exclusive, FALSE, pool);
773 }
774
775 svn_error_t *
776 svn_io_get_dirents2(apr_hash_t **dirents,
777                     const char *path,
778                     apr_pool_t *pool)
779 {
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));
784 }
785
786 svn_error_t *
787 svn_io_get_dirents(apr_hash_t **dirents,
788                    const char *path,
789                    apr_pool_t *pool)
790 {
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);
795 }
796
797 svn_error_t *
798 svn_io_start_cmd2(apr_proc_t *cmd_proc,
799                   const char *path,
800                   const char *cmd,
801                   const char *const *args,
802                   svn_boolean_t inherit,
803                   svn_boolean_t infile_pipe,
804                   apr_file_t *infile,
805                   svn_boolean_t outfile_pipe,
806                   apr_file_t *outfile,
807                   svn_boolean_t errfile_pipe,
808                   apr_file_t *errfile,
809                   apr_pool_t *pool)
810 {
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);
814 }
815
816 svn_error_t *
817 svn_io_start_cmd(apr_proc_t *cmd_proc,
818                  const char *path,
819                  const char *cmd,
820                  const char *const *args,
821                  svn_boolean_t inherit,
822                  apr_file_t *infile,
823                  apr_file_t *outfile,
824                  apr_file_t *errfile,
825                  apr_pool_t *pool)
826 {
827   return svn_io_start_cmd2(cmd_proc, path, cmd, args, inherit, FALSE,
828                            infile, FALSE, outfile, FALSE, errfile, pool);
829 }
830
831 svn_error_t *
832 svn_io_file_read_full(apr_file_t *file, void *buf,
833                       apr_size_t nbytes, apr_size_t *bytes_read,
834                       apr_pool_t *pool)
835 {
836   return svn_io_file_read_full2(file, buf, nbytes, bytes_read, NULL, pool);
837 }
838
839 struct walk_func_filter_baton_t
840 {
841   svn_io_walk_func_t walk_func;
842   void *walk_baton;
843 };
844
845 /* Implements svn_io_walk_func_t, but only allows APR_DIR and APR_REG
846    finfo types through to the wrapped function/baton.  */
847 static svn_error_t *
848 walk_func_filter_func(void *baton,
849                       const char *path,
850                       const apr_finfo_t *finfo,
851                       apr_pool_t *pool)
852 {
853   struct walk_func_filter_baton_t *b = baton;
854
855   if (finfo->filetype == APR_DIR || finfo->filetype == APR_REG)
856     SVN_ERR(b->walk_func(b->walk_baton, path, finfo, pool));
857
858   return SVN_NO_ERROR;
859 }
860
861 svn_error_t *
862 svn_io_dir_walk(const char *dirname,
863                 apr_int32_t wanted,
864                 svn_io_walk_func_t walk_func,
865                 void *walk_baton,
866                 apr_pool_t *pool)
867 {
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,
873                                           &baton, pool));
874 }
875
876 svn_error_t *
877 svn_io_stat_dirent(const svn_io_dirent2_t **dirent_p,
878                    const char *path,
879                    svn_boolean_t ignore_enoent,
880                    apr_pool_t *result_pool,
881                    apr_pool_t *scratch_pool)
882 {
883   return svn_error_trace(
884             svn_io_stat_dirent2(dirent_p,
885                                 path,
886                                 FALSE,
887                                 ignore_enoent,
888                                 result_pool,
889                                 scratch_pool));
890 }
891
892 /*** From constructors.c ***/
893 svn_log_changed_path_t *
894 svn_log_changed_path_dup(const svn_log_changed_path_t *changed_path,
895                          apr_pool_t *pool)
896 {
897   svn_log_changed_path_t *new_changed_path
898     = apr_palloc(pool, sizeof(*new_changed_path));
899
900   *new_changed_path = *changed_path;
901
902   if (new_changed_path->copyfrom_path)
903     new_changed_path->copyfrom_path =
904       apr_pstrdup(pool, new_changed_path->copyfrom_path);
905
906   return new_changed_path;
907 }
908
909 /*** From cmdline.c ***/
910 svn_error_t *
911 svn_cmdline_prompt_user(const char **result,
912                         const char *prompt_str,
913                         apr_pool_t *pool)
914 {
915   return svn_error_trace(svn_cmdline_prompt_user2(result, prompt_str, NULL,
916                                                   pool));
917 }
918
919 svn_error_t *
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,
926                              svn_config_t *cfg,
927                              svn_cancel_func_t cancel_func,
928                              void *cancel_baton,
929                              apr_pool_t *pool)
930 {
931   return svn_error_trace(svn_cmdline_create_auth_baton(
932                            ab, non_interactive,
933                            auth_username, auth_password,
934                            config_dir, no_auth_cache, FALSE,
935                            cfg, cancel_func, cancel_baton, pool));
936 }
937
938 /*** From dso.c ***/
939 void
940 svn_dso_initialize(void)
941 {
942   svn_error_t *err = svn_dso_initialize2();
943   if (err)
944     {
945       svn_error_clear(err);
946       abort();
947     }
948 }
949
950 /*** From simple_providers.c ***/
951 void
952 svn_auth_get_simple_provider(svn_auth_provider_object_t **provider,
953                              apr_pool_t *pool)
954 {
955   svn_auth_get_simple_provider2(provider, NULL, NULL, pool);
956 }
957
958 /*** From ssl_client_cert_pw_providers.c ***/
959 void
960 svn_auth_get_ssl_client_cert_pw_file_provider
961   (svn_auth_provider_object_t **provider,
962    apr_pool_t *pool)
963 {
964   svn_auth_get_ssl_client_cert_pw_file_provider2(provider, NULL, NULL, pool);
965 }
966
967 /*** From path.c ***/
968
969 #define SVN_EMPTY_PATH ""
970
971 const char *
972 svn_path_url_add_component(const char *url,
973                            const char *component,
974                            apr_pool_t *pool)
975 {
976   /* URL can have trailing '/' */
977   url = svn_path_canonicalize(url, pool);
978
979   return svn_path_url_add_component2(url, component, pool);
980 }
981
982 void
983 svn_path_split(const char *path,
984                const char **dirpath,
985                const char **base_name,
986                apr_pool_t *pool)
987 {
988   assert(dirpath != base_name);
989
990   if (dirpath)
991     *dirpath = svn_path_dirname(path, pool);
992
993   if (base_name)
994     *base_name = svn_path_basename(path, pool);
995 }
996
997
998 svn_error_t *
999 svn_path_split_if_file(const char *path,
1000                        const char **pdirectory,
1001                        const char **pfile,
1002                        apr_pool_t *pool)
1003 {
1004   apr_finfo_t finfo;
1005   svn_error_t *err;
1006
1007   SVN_ERR_ASSERT(svn_path_is_canonical(path, pool));
1008
1009   err = svn_io_stat(&finfo, path, APR_FINFO_TYPE, pool);
1010   if (err && ! APR_STATUS_IS_ENOENT(err->apr_err))
1011     return err;
1012
1013   if (err || finfo.filetype == APR_REG)
1014     {
1015       svn_error_clear(err);
1016       svn_path_split(path, pdirectory, pfile, pool);
1017     }
1018   else if (finfo.filetype == APR_DIR)
1019     {
1020       *pdirectory = path;
1021       *pfile = SVN_EMPTY_PATH;
1022     }
1023   else
1024     {
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));
1028     }
1029
1030   return SVN_NO_ERROR;
1031 }
1032
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,
1036                               void *cancel_baton,
1037                               apr_pool_t *scratch_pool)
1038 {
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));
1043 }
1044
1045 svn_error_t *svn_stream_copy(svn_stream_t *from, svn_stream_t *to,
1046                              apr_pool_t *scratch_pool)
1047 {
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));
1052 }
1053
1054 svn_stream_t *
1055 svn_stream_from_aprfile(apr_file_t *file, apr_pool_t *pool)
1056 {
1057   return svn_stream_from_aprfile2(file, TRUE, pool);
1058 }
1059
1060 svn_error_t *
1061 svn_stream_contents_same(svn_boolean_t *same,
1062                          svn_stream_t *stream1,
1063                          svn_stream_t *stream2,
1064                          apr_pool_t *pool)
1065 {
1066   return svn_error_trace(svn_stream_contents_same2(
1067                            same,
1068                            svn_stream_disown(stream1, pool),
1069                            svn_stream_disown(stream2, pool),
1070                            pool));
1071 }
1072
1073 void
1074 svn_stream_set_read(svn_stream_t *stream,
1075                     svn_read_fn_t read_fn)
1076 {
1077   svn_stream_set_read2(stream, NULL /* only full read support */,
1078                        read_fn);
1079 }
1080
1081 svn_error_t *
1082 svn_stream_read(svn_stream_t *stream,
1083                 char *buffer,
1084                 apr_size_t *len)
1085 {
1086   return svn_error_trace(svn_stream_read_full(stream, buffer, len));
1087 }
1088
1089 struct md5_stream_baton
1090 {
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;
1096   apr_pool_t *pool;
1097 };
1098
1099 static svn_error_t *
1100 read_handler_md5(void *baton, char *buffer, apr_size_t *len)
1101 {
1102   struct md5_stream_baton *btn = baton;
1103   return svn_error_trace(svn_stream_read2(btn->proxy, buffer, len));
1104 }
1105
1106 static svn_error_t *
1107 read_full_handler_md5(void *baton, char *buffer, apr_size_t *len)
1108 {
1109   struct md5_stream_baton *btn = baton;
1110   return svn_error_trace(svn_stream_read_full(btn->proxy, buffer, len));
1111 }
1112
1113 static svn_error_t *
1114 skip_handler_md5(void *baton, apr_size_t len)
1115 {
1116   struct md5_stream_baton *btn = baton;
1117   return svn_error_trace(svn_stream_skip(btn->proxy, len));
1118 }
1119
1120 static svn_error_t *
1121 write_handler_md5(void *baton, const char *buffer, apr_size_t *len)
1122 {
1123   struct md5_stream_baton *btn = baton;
1124   return svn_error_trace(svn_stream_write(btn->proxy, buffer, len));
1125 }
1126
1127 static svn_error_t *
1128 close_handler_md5(void *baton)
1129 {
1130   struct md5_stream_baton *btn = baton;
1131
1132   SVN_ERR(svn_stream_close(btn->proxy));
1133
1134   if (btn->read_digest)
1135     *btn->read_digest
1136       = apr_pmemdup(btn->pool, btn->read_checksum->digest,
1137                     APR_MD5_DIGESTSIZE);
1138
1139   if (btn->write_digest)
1140     *btn->write_digest
1141       = apr_pmemdup(btn->pool, btn->write_checksum->digest,
1142                     APR_MD5_DIGESTSIZE);
1143
1144   return SVN_NO_ERROR;
1145 }
1146
1147
1148 svn_stream_t *
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,
1153                        apr_pool_t *pool)
1154 {
1155   svn_stream_t *s;
1156   struct md5_stream_baton *baton;
1157
1158   if (! read_digest && ! write_digest)
1159     return stream;
1160
1161   baton = apr_palloc(pool, sizeof(*baton));
1162   baton->read_digest = read_digest;
1163   baton->write_digest = write_digest;
1164   baton->pool = pool;
1165
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. */
1168   baton->proxy
1169     = svn_stream_checksummed2(stream,
1170                               read_digest ? &baton->read_checksum : NULL,
1171                               write_digest ? &baton->write_checksum : NULL,
1172                               svn_checksum_md5,
1173                               read_all, pool);
1174
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);
1183   return s;
1184 }
1185
1186 /*** From path.c ***/
1187
1188 const char *
1189 svn_path_internal_style(const char *path, apr_pool_t *pool)
1190 {
1191   if (svn_path_is_url(path))
1192     return svn_uri_canonicalize(path, pool);
1193   else
1194     return svn_dirent_internal_style(path, pool);
1195 }
1196
1197
1198 const char *
1199 svn_path_local_style(const char *path, apr_pool_t *pool)
1200 {
1201   if (svn_path_is_url(path))
1202     return apr_pstrdup(pool, path);
1203   else
1204     return svn_dirent_local_style(path, pool);
1205 }
1206
1207 const char *
1208 svn_path_canonicalize(const char *path, apr_pool_t *pool)
1209 {
1210   if (svn_path_is_url(path))
1211     return svn_uri_canonicalize(path, pool);
1212   else
1213     return svn_dirent_canonicalize(path, pool);
1214 }
1215
1216
1217 /*** From mergeinfo.c ***/
1218
1219 svn_error_t *
1220 svn_mergeinfo_inheritable(svn_mergeinfo_t *output,
1221                           svn_mergeinfo_t mergeinfo,
1222                           const char *path,
1223                           svn_revnum_t start,
1224                           svn_revnum_t end,
1225                           apr_pool_t *pool)
1226 {
1227   return svn_error_trace(svn_mergeinfo_inheritable2(output, mergeinfo, path,
1228                                                     start, end,
1229                                                     TRUE, pool, pool));
1230 }
1231
1232 svn_error_t *
1233 svn_rangelist_inheritable(svn_rangelist_t **inheritable_rangelist,
1234                           const svn_rangelist_t *rangelist,
1235                           svn_revnum_t start,
1236                           svn_revnum_t end,
1237                           apr_pool_t *pool)
1238 {
1239   return svn_error_trace(svn_rangelist_inheritable2(inheritable_rangelist,
1240                                                     rangelist,
1241                                                     start, end, TRUE,
1242                                                     pool, pool));
1243 }
1244
1245 svn_error_t *
1246 svn_rangelist_merge(svn_rangelist_t **rangelist,
1247                     const svn_rangelist_t *changes,
1248                     apr_pool_t *pool)
1249 {
1250   SVN_ERR(svn_rangelist_merge2(*rangelist, changes,
1251                                pool, pool));
1252
1253   return svn_error_trace(
1254             svn_rangelist__combine_adjacent_ranges(*rangelist, pool));
1255 }
1256
1257 svn_error_t *
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,
1261                    apr_pool_t *pool)
1262 {
1263   return svn_error_trace(svn_mergeinfo_diff2(deleted, added, from, to,
1264                                              consider_inheritance, pool,
1265                                              pool));
1266 }
1267
1268 svn_error_t *
1269 svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo,
1270                     svn_mergeinfo_t changes,
1271                     apr_pool_t *pool)
1272 {
1273   return svn_error_trace(svn_mergeinfo_merge2(mergeinfo, changes, pool,
1274                          pool));
1275 }
1276
1277 svn_error_t *
1278 svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser,
1279                      svn_mergeinfo_t whiteboard, apr_pool_t *pool)
1280 {
1281   return svn_mergeinfo_remove2(mergeinfo, eraser, whiteboard, TRUE, pool,
1282                                pool);
1283 }
1284
1285 svn_error_t *
1286 svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo,
1287                         svn_mergeinfo_t mergeinfo1,
1288                         svn_mergeinfo_t mergeinfo2,
1289                         apr_pool_t *pool)
1290 {
1291   return svn_mergeinfo_intersect2(mergeinfo, mergeinfo1, mergeinfo2,
1292                                   TRUE, pool, pool);
1293 }
1294
1295 /*** From config.c ***/
1296 svn_error_t *
1297 svn_config_create(svn_config_t **cfgp,
1298                   svn_boolean_t section_names_case_sensitive,
1299                   apr_pool_t *result_pool)
1300 {
1301   return svn_error_trace(svn_config_create2(cfgp,
1302                                             section_names_case_sensitive,
1303                                             FALSE,
1304                                             result_pool));
1305 }
1306
1307 svn_error_t *
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)
1312 {
1313   return svn_error_trace(svn_config_read3(cfgp, file,
1314                                           must_exist,
1315                                           section_names_case_sensitive,
1316                                           FALSE,
1317                                           result_pool));
1318 }
1319
1320 svn_error_t *
1321 svn_config_read(svn_config_t **cfgp, const char *file,
1322                 svn_boolean_t must_exist,
1323                 apr_pool_t *result_pool)
1324 {
1325   return svn_error_trace(svn_config_read3(cfgp, file,
1326                                           must_exist,
1327                                           FALSE, FALSE,
1328                                           result_pool));
1329 }
1330
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. */
1335 svn_error_t *
1336 svn_opt__eat_peg_revisions(apr_array_header_t **true_targets_p,
1337                            apr_array_header_t *targets,
1338                            apr_pool_t *pool);
1339 svn_error_t *
1340 svn_opt__eat_peg_revisions(apr_array_header_t **true_targets_p,
1341                            apr_array_header_t *targets,
1342                            apr_pool_t *pool)
1343 {
1344   unsigned int i;
1345   apr_array_header_t *true_targets;
1346
1347   true_targets = apr_array_make(pool, 5, sizeof(const char *));
1348
1349   for (i = 0; i < targets->nelts; i++)
1350     {
1351       const char *target = APR_ARRAY_IDX(targets, i, const char *);
1352       const char *true_target;
1353
1354       SVN_ERR(svn_opt__split_arg_at_peg_revision(&true_target, NULL,
1355                                                  target, pool));
1356       APR_ARRAY_PUSH(true_targets, const char *) = true_target;
1357     }
1358
1359   SVN_ERR_ASSERT(true_targets_p);
1360   *true_targets_p = true_targets;
1361
1362   return SVN_NO_ERROR;
1363 }
1364 #endif
1365
1366 void
1367 svn_xml_make_header(svn_stringbuf_t **str, apr_pool_t *pool)
1368 {
1369   svn_xml_make_header2(str, NULL, pool);
1370 }
1371
1372
1373 /*** From utf.c ***/
1374 void
1375 svn_utf_initialize(apr_pool_t *pool)
1376 {
1377   svn_utf_initialize2(FALSE, pool);
1378 }
1379
1380 svn_error_t *
1381 svn_utf_cstring_from_utf8_ex(const char **dest,
1382                              const char *src,
1383                              const char *topage,
1384                              const char *convset_key,
1385                              apr_pool_t *pool)
1386 {
1387   return svn_utf_cstring_from_utf8_ex2(dest, src, topage, pool);
1388 }
1389
1390 /*** From error.c ***/
1391 void
1392 svn_handle_error(svn_error_t *err, FILE *stream, svn_boolean_t fatal)
1393 {
1394   svn_handle_error2(err, stream, fatal, "svn: ");
1395 }
1396
1397 void
1398 svn_handle_warning(FILE *stream, svn_error_t *err)
1399 {
1400   svn_handle_warning2(stream, err, "svn: ");
1401 }
1402
1403
1404 /*** From subst.c ***/
1405 svn_error_t *
1406 svn_subst_build_keywords(svn_subst_keywords_t *kw,
1407                          const char *keywords_val,
1408                          const char *rev,
1409                          const char *url,
1410                          apr_time_t date,
1411                          const char *author,
1412                          apr_pool_t *pool)
1413 {
1414   apr_hash_t *kwhash;
1415   const svn_string_t *val;
1416
1417   SVN_ERR(svn_subst_build_keywords2(&kwhash, keywords_val, rev,
1418                                     url, date, author, pool));
1419
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. */
1424
1425   val = svn_hash_gets(kwhash, SVN_KEYWORD_REVISION_LONG);
1426   if (val)
1427     kw->revision = val;
1428
1429   val = svn_hash_gets(kwhash, SVN_KEYWORD_DATE_LONG);
1430   if (val)
1431     kw->date = val;
1432
1433   val = svn_hash_gets(kwhash, SVN_KEYWORD_AUTHOR_LONG);
1434   if (val)
1435     kw->author = val;
1436
1437   val = svn_hash_gets(kwhash, SVN_KEYWORD_URL_LONG);
1438   if (val)
1439     kw->url = val;
1440
1441   val = svn_hash_gets(kwhash, SVN_KEYWORD_ID);
1442   if (val)
1443     kw->id = val;
1444
1445   return SVN_NO_ERROR;
1446 }
1447
1448 /*** From version.c ***/
1449 svn_error_t *
1450 svn_ver_check_list(const svn_version_t *my_version,
1451                    const svn_version_checklist_t *checklist)
1452 {
1453   return svn_ver_check_list2(my_version, checklist, svn_ver_compatible);
1454 }
1455
1456 /*** From win32_crypto.c ***/
1457 #if defined(WIN32) && !defined(__MINGW32__)
1458 void
1459 svn_auth_get_windows_simple_provider(svn_auth_provider_object_t **provider,
1460                                      apr_pool_t *pool)
1461 {
1462   svn_auth__get_windows_simple_provider(provider, pool);
1463 }
1464
1465 void
1466 svn_auth_get_windows_ssl_client_cert_pw_provider
1467    (svn_auth_provider_object_t **provider,
1468     apr_pool_t *pool)
1469 {
1470   svn_auth__get_windows_ssl_client_cert_pw_provider(provider, pool);
1471 }
1472
1473 void
1474 svn_auth_get_windows_ssl_server_trust_provider
1475   (svn_auth_provider_object_t **provider, apr_pool_t *pool)
1476 {
1477   svn_auth__get_windows_ssl_server_trust_provider(provider, pool);
1478 }
1479 #endif /* WIN32 && !__MINGW32__ */
1480
1481 /*** From macos_keychain.c ***/
1482 #if defined(DARWIN)
1483 void
1484 svn_auth_get_keychain_simple_provider(svn_auth_provider_object_t **provider,
1485                                       apr_pool_t *pool)
1486 {
1487   svn_auth__get_keychain_simple_provider(provider, pool);
1488 }
1489
1490 void
1491 svn_auth_get_keychain_ssl_client_cert_pw_provider
1492   (svn_auth_provider_object_t **provider,
1493    apr_pool_t *pool)
1494 {
1495   svn_auth__get_keychain_ssl_client_cert_pw_provider(provider, pool);
1496 }
1497 #endif /* DARWIN */
1498
1499 #if !defined(WIN32)
1500 void
1501 svn_auth_get_gpg_agent_simple_provider(svn_auth_provider_object_t **provider,
1502                                        apr_pool_t *pool)
1503 {
1504 #ifdef SVN_HAVE_GPG_AGENT
1505   svn_auth__get_gpg_agent_simple_provider(provider, pool);
1506 #else
1507   svn_auth__get_dummmy_simple_provider(provider, pool);
1508 #endif /* SVN_HAVE_GPG_AGENT */
1509 }
1510 #endif /* !WIN32 */
1511
1512 svn_error_t *
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,
1520                               svn_config_t *cfg,
1521                               svn_cancel_func_t cancel_func,
1522                               void *cancel_baton,
1523                               apr_pool_t *pool)
1524 {
1525   return svn_error_trace(svn_cmdline_create_auth_baton2(ab,
1526                                                         non_interactive,
1527                                                         auth_username,
1528                                                         auth_password,
1529                                                         config_dir,
1530                                                         no_auth_cache,
1531                                                         trust_server_cert,
1532                                                         FALSE,
1533                                                         FALSE,
1534                                                         FALSE,
1535                                                         FALSE,
1536                                                         cfg,
1537                                                         cancel_func,
1538                                                         cancel_baton,
1539                                                         pool));
1540 }