1/* 2 * deprecated.c: holding file for all deprecated APIs. 3 * "we can't lose 'em, but we can shun 'em!" 4 * 5 * ==================================================================== 6 * Licensed to the Apache Software Foundation (ASF) under one 7 * or more contributor license agreements. See the NOTICE file 8 * distributed with this work for additional information 9 * regarding copyright ownership. The ASF licenses this file 10 * to you under the Apache License, Version 2.0 (the 11 * "License"); you may not use this file except in compliance 12 * with the License. You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, 17 * software distributed under the License is distributed on an 18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 19 * KIND, either express or implied. See the License for the 20 * specific language governing permissions and limitations 21 * under the License. 22 * ==================================================================== 23 */ 24 25/* We define this here to remove any further warnings about the usage of 26 deprecated functions in this file. */ 27#define SVN_DEPRECATED 28 29#include "svn_repos.h" 30#include "svn_compat.h" 31#include "svn_hash.h" 32#include "svn_props.h" 33 34#include "svn_private_config.h" 35 36#include "repos.h" 37 38 39 40 41/*** From commit.c ***/ 42 43svn_error_t * 44svn_repos_get_commit_editor4(const svn_delta_editor_t **editor, 45 void **edit_baton, 46 svn_repos_t *repos, 47 svn_fs_txn_t *txn, 48 const char *repos_url, 49 const char *base_path, 50 const char *user, 51 const char *log_msg, 52 svn_commit_callback2_t commit_callback, 53 void *commit_baton, 54 svn_repos_authz_callback_t authz_callback, 55 void *authz_baton, 56 apr_pool_t *pool) 57{ 58 apr_hash_t *revprop_table = apr_hash_make(pool); 59 if (user) 60 svn_hash_sets(revprop_table, SVN_PROP_REVISION_AUTHOR, 61 svn_string_create(user, pool)); 62 if (log_msg) 63 svn_hash_sets(revprop_table, SVN_PROP_REVISION_LOG, 64 svn_string_create(log_msg, pool)); 65 return svn_repos_get_commit_editor5(editor, edit_baton, repos, txn, 66 repos_url, base_path, revprop_table, 67 commit_callback, commit_baton, 68 authz_callback, authz_baton, pool); 69} 70 71 72svn_error_t * 73svn_repos_get_commit_editor3(const svn_delta_editor_t **editor, 74 void **edit_baton, 75 svn_repos_t *repos, 76 svn_fs_txn_t *txn, 77 const char *repos_url, 78 const char *base_path, 79 const char *user, 80 const char *log_msg, 81 svn_commit_callback_t callback, 82 void *callback_baton, 83 svn_repos_authz_callback_t authz_callback, 84 void *authz_baton, 85 apr_pool_t *pool) 86{ 87 svn_commit_callback2_t callback2; 88 void *callback2_baton; 89 90 svn_compat_wrap_commit_callback(&callback2, &callback2_baton, 91 callback, callback_baton, 92 pool); 93 94 return svn_repos_get_commit_editor4(editor, edit_baton, repos, txn, 95 repos_url, base_path, user, 96 log_msg, callback2, 97 callback2_baton, authz_callback, 98 authz_baton, pool); 99} 100 101 102svn_error_t * 103svn_repos_get_commit_editor2(const svn_delta_editor_t **editor, 104 void **edit_baton, 105 svn_repos_t *repos, 106 svn_fs_txn_t *txn, 107 const char *repos_url, 108 const char *base_path, 109 const char *user, 110 const char *log_msg, 111 svn_commit_callback_t callback, 112 void *callback_baton, 113 apr_pool_t *pool) 114{ 115 return svn_repos_get_commit_editor3(editor, edit_baton, repos, txn, 116 repos_url, base_path, user, 117 log_msg, callback, callback_baton, 118 NULL, NULL, pool); 119} 120 121 122svn_error_t * 123svn_repos_get_commit_editor(const svn_delta_editor_t **editor, 124 void **edit_baton, 125 svn_repos_t *repos, 126 const char *repos_url, 127 const char *base_path, 128 const char *user, 129 const char *log_msg, 130 svn_commit_callback_t callback, 131 void *callback_baton, 132 apr_pool_t *pool) 133{ 134 return svn_repos_get_commit_editor2(editor, edit_baton, repos, NULL, 135 repos_url, base_path, user, 136 log_msg, callback, 137 callback_baton, pool); 138} 139 140svn_error_t * 141svn_repos_open(svn_repos_t **repos_p, 142 const char *path, 143 apr_pool_t *pool) 144{ 145 return svn_repos_open2(repos_p, path, NULL, pool); 146} 147 148 149/*** From repos.c ***/ 150struct recover_baton 151{ 152 svn_error_t *(*start_callback)(void *baton); 153 void *start_callback_baton; 154}; 155 156static void 157recovery_started(void *baton, 158 const svn_repos_notify_t *notify, 159 apr_pool_t *scratch_pool) 160{ 161 struct recover_baton *rb = baton; 162 163 if (notify->action == svn_repos_notify_mutex_acquired 164 && rb->start_callback != NULL) 165 svn_error_clear(rb->start_callback(rb->start_callback_baton)); 166} 167 168svn_error_t * 169svn_repos_recover3(const char *path, 170 svn_boolean_t nonblocking, 171 svn_error_t *(*start_callback)(void *baton), 172 void *start_callback_baton, 173 svn_cancel_func_t cancel_func, void *cancel_baton, 174 apr_pool_t *pool) 175{ 176 struct recover_baton rb; 177 178 rb.start_callback = start_callback; 179 rb.start_callback_baton = start_callback_baton; 180 181 return svn_repos_recover4(path, nonblocking, recovery_started, &rb, 182 cancel_func, cancel_baton, pool); 183} 184 185svn_error_t * 186svn_repos_recover2(const char *path, 187 svn_boolean_t nonblocking, 188 svn_error_t *(*start_callback)(void *baton), 189 void *start_callback_baton, 190 apr_pool_t *pool) 191{ 192 return svn_repos_recover3(path, nonblocking, 193 start_callback, start_callback_baton, 194 NULL, NULL, 195 pool); 196} 197 198svn_error_t * 199svn_repos_recover(const char *path, 200 apr_pool_t *pool) 201{ 202 return svn_repos_recover2(path, FALSE, NULL, NULL, pool); 203} 204 205svn_error_t * 206svn_repos_upgrade(const char *path, 207 svn_boolean_t nonblocking, 208 svn_error_t *(*start_callback)(void *baton), 209 void *start_callback_baton, 210 apr_pool_t *pool) 211{ 212 struct recover_baton rb; 213 214 rb.start_callback = start_callback; 215 rb.start_callback_baton = start_callback_baton; 216 217 return svn_repos_upgrade2(path, nonblocking, recovery_started, &rb, pool); 218} 219 220/*** From reporter.c ***/ 221svn_error_t * 222svn_repos_begin_report(void **report_baton, 223 svn_revnum_t revnum, 224 const char *username, 225 svn_repos_t *repos, 226 const char *fs_base, 227 const char *s_operand, 228 const char *switch_path, 229 svn_boolean_t text_deltas, 230 svn_boolean_t recurse, 231 svn_boolean_t ignore_ancestry, 232 const svn_delta_editor_t *editor, 233 void *edit_baton, 234 svn_repos_authz_func_t authz_read_func, 235 void *authz_read_baton, 236 apr_pool_t *pool) 237{ 238 return svn_repos_begin_report2(report_baton, 239 revnum, 240 repos, 241 fs_base, 242 s_operand, 243 switch_path, 244 text_deltas, 245 SVN_DEPTH_INFINITY_OR_FILES(recurse), 246 ignore_ancestry, 247 FALSE, /* don't send copyfrom args */ 248 editor, 249 edit_baton, 250 authz_read_func, 251 authz_read_baton, 252 pool); 253} 254 255svn_error_t * 256svn_repos_begin_report2(void **report_baton, 257 svn_revnum_t revnum, 258 svn_repos_t *repos, 259 const char *fs_base, 260 const char *target, 261 const char *tgt_path, 262 svn_boolean_t text_deltas, 263 svn_depth_t depth, 264 svn_boolean_t ignore_ancestry, 265 svn_boolean_t send_copyfrom_args, 266 const svn_delta_editor_t *editor, 267 void *edit_baton, 268 svn_repos_authz_func_t authz_read_func, 269 void *authz_read_baton, 270 apr_pool_t *pool) 271{ 272 return svn_repos_begin_report3(report_baton, 273 revnum, 274 repos, 275 fs_base, 276 target, 277 tgt_path, 278 text_deltas, 279 depth, 280 ignore_ancestry, 281 send_copyfrom_args, 282 editor, 283 edit_baton, 284 authz_read_func, 285 authz_read_baton, 286 0, /* disable zero-copy code path */ 287 pool); 288} 289 290svn_error_t * 291svn_repos_set_path2(void *baton, const char *path, svn_revnum_t rev, 292 svn_boolean_t start_empty, const char *lock_token, 293 apr_pool_t *pool) 294{ 295 return svn_repos_set_path3(baton, path, rev, svn_depth_infinity, 296 start_empty, lock_token, pool); 297} 298 299svn_error_t * 300svn_repos_set_path(void *baton, const char *path, svn_revnum_t rev, 301 svn_boolean_t start_empty, apr_pool_t *pool) 302{ 303 return svn_repos_set_path2(baton, path, rev, start_empty, NULL, pool); 304} 305 306svn_error_t * 307svn_repos_link_path2(void *baton, const char *path, const char *link_path, 308 svn_revnum_t rev, svn_boolean_t start_empty, 309 const char *lock_token, apr_pool_t *pool) 310{ 311 return svn_repos_link_path3(baton, path, link_path, rev, svn_depth_infinity, 312 start_empty, lock_token, pool); 313} 314 315svn_error_t * 316svn_repos_link_path(void *baton, const char *path, const char *link_path, 317 svn_revnum_t rev, svn_boolean_t start_empty, 318 apr_pool_t *pool) 319{ 320 return svn_repos_link_path2(baton, path, link_path, rev, start_empty, 321 NULL, pool); 322} 323 324/*** From dir-delta.c ***/ 325svn_error_t * 326svn_repos_dir_delta(svn_fs_root_t *src_root, 327 const char *src_parent_dir, 328 const char *src_entry, 329 svn_fs_root_t *tgt_root, 330 const char *tgt_fullpath, 331 const svn_delta_editor_t *editor, 332 void *edit_baton, 333 svn_repos_authz_func_t authz_read_func, 334 void *authz_read_baton, 335 svn_boolean_t text_deltas, 336 svn_boolean_t recurse, 337 svn_boolean_t entry_props, 338 svn_boolean_t ignore_ancestry, 339 apr_pool_t *pool) 340{ 341 return svn_repos_dir_delta2(src_root, 342 src_parent_dir, 343 src_entry, 344 tgt_root, 345 tgt_fullpath, 346 editor, 347 edit_baton, 348 authz_read_func, 349 authz_read_baton, 350 text_deltas, 351 SVN_DEPTH_INFINITY_OR_FILES(recurse), 352 entry_props, 353 ignore_ancestry, 354 pool); 355} 356 357/*** From replay.c ***/ 358svn_error_t * 359svn_repos_replay(svn_fs_root_t *root, 360 const svn_delta_editor_t *editor, 361 void *edit_baton, 362 apr_pool_t *pool) 363{ 364 return svn_repos_replay2(root, 365 "" /* the whole tree */, 366 SVN_INVALID_REVNUM, /* no low water mark */ 367 FALSE /* no text deltas */, 368 editor, edit_baton, 369 NULL /* no authz func */, 370 NULL /* no authz baton */, 371 pool); 372} 373 374/*** From fs-wrap.c ***/ 375svn_error_t * 376svn_repos_fs_change_rev_prop3(svn_repos_t *repos, 377 svn_revnum_t rev, 378 const char *author, 379 const char *name, 380 const svn_string_t *new_value, 381 svn_boolean_t use_pre_revprop_change_hook, 382 svn_boolean_t use_post_revprop_change_hook, 383 svn_repos_authz_func_t authz_read_func, 384 void *authz_read_baton, 385 apr_pool_t *pool) 386{ 387 return svn_repos_fs_change_rev_prop4(repos, rev, author, name, NULL, 388 new_value, 389 use_pre_revprop_change_hook, 390 use_post_revprop_change_hook, 391 authz_read_func, 392 authz_read_baton, pool); 393} 394 395svn_error_t * 396svn_repos_fs_change_rev_prop2(svn_repos_t *repos, 397 svn_revnum_t rev, 398 const char *author, 399 const char *name, 400 const svn_string_t *new_value, 401 svn_repos_authz_func_t authz_read_func, 402 void *authz_read_baton, 403 apr_pool_t *pool) 404{ 405 return svn_repos_fs_change_rev_prop3(repos, rev, author, name, new_value, 406 TRUE, TRUE, authz_read_func, 407 authz_read_baton, pool); 408} 409 410 411 412svn_error_t * 413svn_repos_fs_change_rev_prop(svn_repos_t *repos, 414 svn_revnum_t rev, 415 const char *author, 416 const char *name, 417 const svn_string_t *new_value, 418 apr_pool_t *pool) 419{ 420 return svn_repos_fs_change_rev_prop2(repos, rev, author, name, new_value, 421 NULL, NULL, pool); 422} 423 424struct pack_notify_wrapper_baton 425{ 426 svn_fs_pack_notify_t notify_func; 427 void *notify_baton; 428}; 429 430static void 431pack_notify_wrapper_func(void *baton, 432 const svn_repos_notify_t *notify, 433 apr_pool_t *scratch_pool) 434{ 435 struct pack_notify_wrapper_baton *pnwb = baton; 436 437 svn_error_clear(pnwb->notify_func(pnwb->notify_baton, notify->shard, 438 notify->action - 3, scratch_pool)); 439} 440 441svn_error_t * 442svn_repos_fs_pack(svn_repos_t *repos, 443 svn_fs_pack_notify_t notify_func, 444 void *notify_baton, 445 svn_cancel_func_t cancel_func, 446 void *cancel_baton, 447 apr_pool_t *pool) 448{ 449 struct pack_notify_wrapper_baton pnwb; 450 451 pnwb.notify_func = notify_func; 452 pnwb.notify_baton = notify_baton; 453 454 return svn_repos_fs_pack2(repos, pack_notify_wrapper_func, &pnwb, 455 cancel_func, cancel_baton, pool); 456} 457 458 459svn_error_t * 460svn_repos_fs_get_locks(apr_hash_t **locks, 461 svn_repos_t *repos, 462 const char *path, 463 svn_repos_authz_func_t authz_read_func, 464 void *authz_read_baton, 465 apr_pool_t *pool) 466{ 467 return svn_error_trace(svn_repos_fs_get_locks2(locks, repos, path, 468 svn_depth_infinity, 469 authz_read_func, 470 authz_read_baton, pool)); 471} 472 473 474/*** From logs.c ***/ 475svn_error_t * 476svn_repos_get_logs3(svn_repos_t *repos, 477 const apr_array_header_t *paths, 478 svn_revnum_t start, 479 svn_revnum_t end, 480 int limit, 481 svn_boolean_t discover_changed_paths, 482 svn_boolean_t strict_node_history, 483 svn_repos_authz_func_t authz_read_func, 484 void *authz_read_baton, 485 svn_log_message_receiver_t receiver, 486 void *receiver_baton, 487 apr_pool_t *pool) 488{ 489 svn_log_entry_receiver_t receiver2; 490 void *receiver2_baton; 491 492 svn_compat_wrap_log_receiver(&receiver2, &receiver2_baton, 493 receiver, receiver_baton, 494 pool); 495 496 return svn_repos_get_logs4(repos, paths, start, end, limit, 497 discover_changed_paths, strict_node_history, 498 FALSE, svn_compat_log_revprops_in(pool), 499 authz_read_func, authz_read_baton, 500 receiver2, receiver2_baton, 501 pool); 502} 503 504svn_error_t * 505svn_repos_get_logs2(svn_repos_t *repos, 506 const apr_array_header_t *paths, 507 svn_revnum_t start, 508 svn_revnum_t end, 509 svn_boolean_t discover_changed_paths, 510 svn_boolean_t strict_node_history, 511 svn_repos_authz_func_t authz_read_func, 512 void *authz_read_baton, 513 svn_log_message_receiver_t receiver, 514 void *receiver_baton, 515 apr_pool_t *pool) 516{ 517 return svn_repos_get_logs3(repos, paths, start, end, 0, 518 discover_changed_paths, strict_node_history, 519 authz_read_func, authz_read_baton, receiver, 520 receiver_baton, pool); 521} 522 523 524svn_error_t * 525svn_repos_get_logs(svn_repos_t *repos, 526 const apr_array_header_t *paths, 527 svn_revnum_t start, 528 svn_revnum_t end, 529 svn_boolean_t discover_changed_paths, 530 svn_boolean_t strict_node_history, 531 svn_log_message_receiver_t receiver, 532 void *receiver_baton, 533 apr_pool_t *pool) 534{ 535 return svn_repos_get_logs3(repos, paths, start, end, 0, 536 discover_changed_paths, strict_node_history, 537 NULL, NULL, /* no authz stuff */ 538 receiver, receiver_baton, pool); 539} 540 541/*** From rev_hunt.c ***/ 542svn_error_t * 543svn_repos_history(svn_fs_t *fs, 544 const char *path, 545 svn_repos_history_func_t history_func, 546 void *history_baton, 547 svn_revnum_t start, 548 svn_revnum_t end, 549 svn_boolean_t cross_copies, 550 apr_pool_t *pool) 551{ 552 return svn_repos_history2(fs, path, history_func, history_baton, 553 NULL, NULL, 554 start, end, cross_copies, pool); 555} 556 557svn_error_t * 558svn_repos_get_file_revs(svn_repos_t *repos, 559 const char *path, 560 svn_revnum_t start, 561 svn_revnum_t end, 562 svn_repos_authz_func_t authz_read_func, 563 void *authz_read_baton, 564 svn_repos_file_rev_handler_t handler, 565 void *handler_baton, 566 apr_pool_t *pool) 567{ 568 svn_file_rev_handler_t handler2; 569 void *handler2_baton; 570 571 svn_compat_wrap_file_rev_handler(&handler2, &handler2_baton, handler, 572 handler_baton, pool); 573 574 return svn_repos_get_file_revs2(repos, path, start, end, FALSE, 575 authz_read_func, authz_read_baton, 576 handler2, handler2_baton, pool); 577} 578 579/*** From dump.c ***/ 580svn_error_t * 581svn_repos_dump_fs(svn_repos_t *repos, 582 svn_stream_t *stream, 583 svn_stream_t *feedback_stream, 584 svn_revnum_t start_rev, 585 svn_revnum_t end_rev, 586 svn_boolean_t incremental, 587 svn_cancel_func_t cancel_func, 588 void *cancel_baton, 589 apr_pool_t *pool) 590{ 591 return svn_repos_dump_fs2(repos, stream, feedback_stream, start_rev, 592 end_rev, incremental, FALSE, cancel_func, 593 cancel_baton, pool); 594} 595 596/* Implementation of svn_repos_notify_func_t to wrap the output to a 597 response stream for svn_repos_dump_fs2() and svn_repos_verify_fs() */ 598static void 599repos_notify_handler(void *baton, 600 const svn_repos_notify_t *notify, 601 apr_pool_t *scratch_pool) 602{ 603 svn_stream_t *feedback_stream = baton; 604 apr_size_t len; 605 606 switch (notify->action) 607 { 608 case svn_repos_notify_warning: 609 svn_error_clear(svn_stream_puts(feedback_stream, notify->warning_str)); 610 return; 611 612 case svn_repos_notify_dump_rev_end: 613 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 614 _("* Dumped revision %ld.\n"), 615 notify->revision)); 616 return; 617 618 case svn_repos_notify_verify_rev_end: 619 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 620 _("* Verified revision %ld.\n"), 621 notify->revision)); 622 return; 623 624 case svn_repos_notify_load_txn_committed: 625 if (notify->old_revision == SVN_INVALID_REVNUM) 626 { 627 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 628 _("\n------- Committed revision %ld >>>\n\n"), 629 notify->new_revision)); 630 } 631 else 632 { 633 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 634 _("\n------- Committed new rev %ld" 635 " (loaded from original rev %ld" 636 ") >>>\n\n"), notify->new_revision, 637 notify->old_revision)); 638 } 639 return; 640 641 case svn_repos_notify_load_node_start: 642 { 643 switch (notify->node_action) 644 { 645 case svn_node_action_change: 646 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 647 _(" * editing path : %s ..."), 648 notify->path)); 649 break; 650 651 case svn_node_action_delete: 652 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 653 _(" * deleting path : %s ..."), 654 notify->path)); 655 break; 656 657 case svn_node_action_add: 658 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 659 _(" * adding path : %s ..."), 660 notify->path)); 661 break; 662 663 case svn_node_action_replace: 664 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 665 _(" * replacing path : %s ..."), 666 notify->path)); 667 break; 668 669 } 670 } 671 return; 672 673 case svn_repos_notify_load_node_done: 674 len = 7; 675 svn_error_clear(svn_stream_write(feedback_stream, _(" done.\n"), &len)); 676 return; 677 678 case svn_repos_notify_load_copied_node: 679 len = 9; 680 svn_error_clear(svn_stream_write(feedback_stream, "COPIED...", &len)); 681 return; 682 683 case svn_repos_notify_load_txn_start: 684 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 685 _("<<< Started new transaction, based on " 686 "original revision %ld\n"), 687 notify->old_revision)); 688 return; 689 690 case svn_repos_notify_load_normalized_mergeinfo: 691 svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool, 692 _(" removing '\\r' from %s ..."), 693 SVN_PROP_MERGEINFO)); 694 return; 695 696 default: 697 return; 698 } 699} 700 701 702svn_error_t * 703svn_repos_dump_fs2(svn_repos_t *repos, 704 svn_stream_t *stream, 705 svn_stream_t *feedback_stream, 706 svn_revnum_t start_rev, 707 svn_revnum_t end_rev, 708 svn_boolean_t incremental, 709 svn_boolean_t use_deltas, 710 svn_cancel_func_t cancel_func, 711 void *cancel_baton, 712 apr_pool_t *pool) 713{ 714 return svn_error_trace(svn_repos_dump_fs3(repos, 715 stream, 716 start_rev, 717 end_rev, 718 incremental, 719 use_deltas, 720 feedback_stream 721 ? repos_notify_handler 722 : NULL, 723 feedback_stream, 724 cancel_func, 725 cancel_baton, 726 pool)); 727} 728 729svn_error_t * 730svn_repos_verify_fs(svn_repos_t *repos, 731 svn_stream_t *feedback_stream, 732 svn_revnum_t start_rev, 733 svn_revnum_t end_rev, 734 svn_cancel_func_t cancel_func, 735 void *cancel_baton, 736 apr_pool_t *pool) 737{ 738 return svn_error_trace(svn_repos_verify_fs2(repos, 739 start_rev, 740 end_rev, 741 feedback_stream 742 ? repos_notify_handler 743 : NULL, 744 feedback_stream, 745 cancel_func, 746 cancel_baton, 747 pool)); 748} 749 750/*** From load.c ***/ 751 752svn_error_t * 753svn_repos_load_fs3(svn_repos_t *repos, 754 svn_stream_t *dumpstream, 755 enum svn_repos_load_uuid uuid_action, 756 const char *parent_dir, 757 svn_boolean_t use_pre_commit_hook, 758 svn_boolean_t use_post_commit_hook, 759 svn_boolean_t validate_props, 760 svn_repos_notify_func_t notify_func, 761 void *notify_baton, 762 svn_cancel_func_t cancel_func, 763 void *cancel_baton, 764 apr_pool_t *pool) 765{ 766 return svn_repos_load_fs4(repos, dumpstream, 767 SVN_INVALID_REVNUM, SVN_INVALID_REVNUM, 768 uuid_action, parent_dir, 769 use_pre_commit_hook, use_post_commit_hook, 770 validate_props, notify_func, notify_baton, 771 cancel_func, cancel_baton, pool); 772} 773 774svn_error_t * 775svn_repos_load_fs2(svn_repos_t *repos, 776 svn_stream_t *dumpstream, 777 svn_stream_t *feedback_stream, 778 enum svn_repos_load_uuid uuid_action, 779 const char *parent_dir, 780 svn_boolean_t use_pre_commit_hook, 781 svn_boolean_t use_post_commit_hook, 782 svn_cancel_func_t cancel_func, 783 void *cancel_baton, 784 apr_pool_t *pool) 785{ 786 return svn_repos_load_fs3(repos, dumpstream, uuid_action, parent_dir, 787 use_pre_commit_hook, use_post_commit_hook, FALSE, 788 feedback_stream ? repos_notify_handler : NULL, 789 feedback_stream, cancel_func, cancel_baton, pool); 790} 791 792 793static svn_repos_parser_fns_t * 794fns_from_fns2(const svn_repos_parse_fns2_t *fns2, 795 apr_pool_t *pool) 796{ 797 svn_repos_parser_fns_t *fns; 798 799 fns = apr_palloc(pool, sizeof(*fns)); 800 fns->new_revision_record = fns2->new_revision_record; 801 fns->uuid_record = fns2->uuid_record; 802 fns->new_node_record = fns2->new_node_record; 803 fns->set_revision_property = fns2->set_revision_property; 804 fns->set_node_property = fns2->set_node_property; 805 fns->remove_node_props = fns2->remove_node_props; 806 fns->set_fulltext = fns2->set_fulltext; 807 fns->close_node = fns2->close_node; 808 fns->close_revision = fns2->close_revision; 809 return fns; 810} 811 812static svn_repos_parser_fns2_t * 813fns2_from_fns3(const svn_repos_parse_fns3_t *fns3, 814 apr_pool_t *pool) 815{ 816 svn_repos_parser_fns2_t *fns2; 817 818 fns2 = apr_palloc(pool, sizeof(*fns2)); 819 fns2->new_revision_record = fns3->new_revision_record; 820 fns2->uuid_record = fns3->uuid_record; 821 fns2->new_node_record = fns3->new_node_record; 822 fns2->set_revision_property = fns3->set_revision_property; 823 fns2->set_node_property = fns3->set_node_property; 824 fns2->remove_node_props = fns3->remove_node_props; 825 fns2->set_fulltext = fns3->set_fulltext; 826 fns2->close_node = fns3->close_node; 827 fns2->close_revision = fns3->close_revision; 828 fns2->delete_node_property = fns3->delete_node_property; 829 fns2->apply_textdelta = fns3->apply_textdelta; 830 return fns2; 831} 832 833static svn_repos_parse_fns2_t * 834fns2_from_fns(const svn_repos_parser_fns_t *fns, 835 apr_pool_t *pool) 836{ 837 svn_repos_parse_fns2_t *fns2; 838 839 fns2 = apr_palloc(pool, sizeof(*fns2)); 840 fns2->new_revision_record = fns->new_revision_record; 841 fns2->uuid_record = fns->uuid_record; 842 fns2->new_node_record = fns->new_node_record; 843 fns2->set_revision_property = fns->set_revision_property; 844 fns2->set_node_property = fns->set_node_property; 845 fns2->remove_node_props = fns->remove_node_props; 846 fns2->set_fulltext = fns->set_fulltext; 847 fns2->close_node = fns->close_node; 848 fns2->close_revision = fns->close_revision; 849 fns2->delete_node_property = NULL; 850 fns2->apply_textdelta = NULL; 851 return fns2; 852} 853 854static svn_repos_parse_fns3_t * 855fns3_from_fns2(const svn_repos_parser_fns2_t *fns2, 856 apr_pool_t *pool) 857{ 858 svn_repos_parse_fns3_t *fns3; 859 860 fns3 = apr_palloc(pool, sizeof(*fns3)); 861 fns3->magic_header_record = NULL; 862 fns3->uuid_record = fns2->uuid_record; 863 fns3->new_revision_record = fns2->new_revision_record; 864 fns3->new_node_record = fns2->new_node_record; 865 fns3->set_revision_property = fns2->set_revision_property; 866 fns3->set_node_property = fns2->set_node_property; 867 fns3->remove_node_props = fns2->remove_node_props; 868 fns3->set_fulltext = fns2->set_fulltext; 869 fns3->close_node = fns2->close_node; 870 fns3->close_revision = fns2->close_revision; 871 fns3->delete_node_property = fns2->delete_node_property; 872 fns3->apply_textdelta = fns2->apply_textdelta; 873 return fns3; 874} 875 876svn_error_t * 877svn_repos_parse_dumpstream2(svn_stream_t *stream, 878 const svn_repos_parser_fns2_t *parse_fns, 879 void *parse_baton, 880 svn_cancel_func_t cancel_func, 881 void *cancel_baton, 882 apr_pool_t *pool) 883{ 884 svn_repos_parse_fns3_t *fns3 = fns3_from_fns2(parse_fns, pool); 885 886 return svn_repos_parse_dumpstream3(stream, fns3, parse_baton, FALSE, 887 cancel_func, cancel_baton, pool); 888} 889 890svn_error_t * 891svn_repos_parse_dumpstream(svn_stream_t *stream, 892 const svn_repos_parser_fns_t *parse_fns, 893 void *parse_baton, 894 svn_cancel_func_t cancel_func, 895 void *cancel_baton, 896 apr_pool_t *pool) 897{ 898 svn_repos_parse_fns2_t *fns2 = fns2_from_fns(parse_fns, pool); 899 900 return svn_repos_parse_dumpstream2(stream, fns2, parse_baton, 901 cancel_func, cancel_baton, pool); 902} 903 904svn_error_t * 905svn_repos_load_fs(svn_repos_t *repos, 906 svn_stream_t *dumpstream, 907 svn_stream_t *feedback_stream, 908 enum svn_repos_load_uuid uuid_action, 909 const char *parent_dir, 910 svn_cancel_func_t cancel_func, 911 void *cancel_baton, 912 apr_pool_t *pool) 913{ 914 return svn_repos_load_fs2(repos, dumpstream, feedback_stream, 915 uuid_action, parent_dir, FALSE, FALSE, 916 cancel_func, cancel_baton, pool); 917} 918 919svn_error_t * 920svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **callbacks, 921 void **parse_baton, 922 svn_repos_t *repos, 923 svn_boolean_t use_history, 924 svn_boolean_t validate_props, 925 enum svn_repos_load_uuid uuid_action, 926 const char *parent_dir, 927 svn_repos_notify_func_t notify_func, 928 void *notify_baton, 929 apr_pool_t *pool) 930{ 931 const svn_repos_parse_fns3_t *fns3; 932 933 SVN_ERR(svn_repos_get_fs_build_parser4(&fns3, parse_baton, repos, 934 SVN_INVALID_REVNUM, 935 SVN_INVALID_REVNUM, 936 use_history, validate_props, 937 uuid_action, parent_dir, 938 notify_func, notify_baton, pool)); 939 940 *callbacks = fns2_from_fns3(fns3, pool); 941 return SVN_NO_ERROR; 942} 943 944svn_error_t * 945svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser, 946 void **parse_baton, 947 svn_repos_t *repos, 948 svn_boolean_t use_history, 949 enum svn_repos_load_uuid uuid_action, 950 svn_stream_t *outstream, 951 const char *parent_dir, 952 apr_pool_t *pool) 953{ 954 return svn_repos_get_fs_build_parser3(parser, parse_baton, repos, use_history, 955 FALSE, uuid_action, parent_dir, 956 outstream ? repos_notify_handler : NULL, 957 outstream, pool); 958} 959 960svn_error_t * 961svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser_callbacks, 962 void **parse_baton, 963 svn_repos_t *repos, 964 svn_boolean_t use_history, 965 enum svn_repos_load_uuid uuid_action, 966 svn_stream_t *outstream, 967 const char *parent_dir, 968 apr_pool_t *pool) 969{ 970 const svn_repos_parse_fns2_t *fns2; 971 972 SVN_ERR(svn_repos_get_fs_build_parser2(&fns2, parse_baton, repos, 973 use_history, uuid_action, outstream, 974 parent_dir, pool)); 975 976 *parser_callbacks = fns_from_fns2(fns2, pool); 977 return SVN_NO_ERROR; 978} 979 980 981svn_error_t * 982svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p, 983 svn_repos_t *repos, 984 svn_revnum_t rev, 985 const char *author, 986 apr_pool_t *pool) 987{ 988 /* ### someday, we might run a read-hook here. */ 989 990 /* Begin the transaction. */ 991 SVN_ERR(svn_fs_begin_txn2(txn_p, repos->fs, rev, 0, pool)); 992 993 /* We pass the author to the filesystem by adding it as a property 994 on the txn. */ 995 996 /* User (author). */ 997 if (author) 998 { 999 svn_string_t val; 1000 val.data = author; 1001 val.len = strlen(author); 1002 SVN_ERR(svn_fs_change_txn_prop(*txn_p, SVN_PROP_REVISION_AUTHOR, 1003 &val, pool)); 1004 } 1005 1006 return SVN_NO_ERROR; 1007} 1008 1009/*** From authz.c ***/ 1010 1011svn_error_t * 1012svn_repos_authz_read(svn_authz_t **authz_p, const char *file, 1013 svn_boolean_t must_exist, apr_pool_t *pool) 1014{ 1015 return svn_repos__authz_read(authz_p, file, NULL, must_exist, 1016 FALSE, pool); 1017} 1018