wc_db.h revision 299742
1/** 2 * @copyright 3 * ==================================================================== 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * ==================================================================== 21 * @endcopyright 22 * 23 * @file wc_db.h 24 * @brief The Subversion Working Copy Library - Metadata/Base-Text Support 25 * 26 * Requires: 27 * - A working copy 28 * 29 * Provides: 30 * - Ability to manipulate working copy's administrative files. 31 * 32 * Used By: 33 * - The main working copy library 34 */ 35 36#ifndef SVN_WC_DB_H 37#define SVN_WC_DB_H 38 39#include "svn_wc.h" 40 41#include "svn_types.h" 42#include "svn_error.h" 43#include "svn_config.h" 44#include "svn_io.h" 45 46#include "private/svn_skel.h" 47#include "private/svn_sqlite.h" 48#include "private/svn_wc_private.h" 49 50#include "svn_private_config.h" 51 52#ifdef __cplusplus 53extern "C" { 54#endif /* __cplusplus */ 55 56/* INTERFACE CONVENTIONS 57 58 "OUT" PARAMETERS 59 60 There are numerous functions within this API which take a (large) number 61 of "out" parameters. These are listed individually, rather than combined 62 into a struct, so that a caller can be fine-grained about the which 63 pieces of information are being requested. In many cases, only a subset 64 is required, so the implementation can perform various optimizations 65 to fulfill the limited request for information. 66 67 68 POOLS 69 70 wc_db uses the dual-pool paradigm for all of its functions. Any OUT 71 parameter will be allocated within the result pool, and all temporary 72 allocations will be performed within the scratch pool. 73 74 The pool that DB is allocated within (the "state" pool) is only used 75 for a few, limited allocations to track each of the working copy roots 76 that the DB is asked to operate upon. The memory usage on this pool 77 is O(# wcroots), which should normally be one or a few. Custom clients 78 which hold open structures over a significant period of time should 79 pay particular attention to the number of roots touched, and the 80 resulting impact on memory consumption (which should still be minimal). 81 82 83 PARAMETER CONVENTIONS 84 85 * Parameter Order 86 - any output arguments 87 - DB 88 - LOCAL_ABSPATH 89 - any other input arguments 90 - RESULT_POOL 91 - SCRATCH_POOL 92 93 * DB 94 This parameter is the primary context for all operations on the 95 metadata for working copies. This parameter is passed to almost every 96 function, and maintains information and state about every working 97 copy "touched" by any of the APIs in this interface. 98 99 * *_ABSPATH 100 All *_ABSPATH parameters in this API are absolute paths in the local 101 filesystem, represented in Subversion internal canonical form. 102 103 * LOCAL_ABSPATH 104 This parameter specifies a particular *versioned* node in the local 105 filesystem. From this node, a working copy root is implied, and will 106 be used for the given API operation. 107 108 * LOCAL_DIR_ABSPATH 109 This parameter is similar to LOCAL_ABSPATH, but the semantics of the 110 parameter and operation require the node to be a directory within 111 the working copy. 112 113 * WRI_ABSPATH 114 This is a "Working copy Root Indicator" path. This refers to a location 115 in the local filesystem that is anywhere inside a working copy. The given 116 operation will be performed within the context of the root of that 117 working copy. This does not necessarily need to refer to a specific 118 versioned node or the root of a working copy (although it can) -- any 119 location, existing or not, is sufficient, as long as it is inside a 120 working copy. 121 ### TODO: Define behaviour for switches and externals. 122 ### Preference has been stated that WRI_ABSPATH should imply the root 123 ### of the parent WC of all switches and externals, but that may 124 ### not play out well, especially with multiple repositories involved. 125*/ 126 127/* Context data structure for interacting with the administrative data. */ 128typedef struct svn_wc__db_t svn_wc__db_t; 129 130 131/* Enumerated values describing the state of a node. */ 132typedef enum svn_wc__db_status_t { 133 /* The node is present and has no known modifications applied to it. */ 134 svn_wc__db_status_normal, 135 136 /* The node has been added (potentially obscuring a delete or move of 137 the BASE node; see HAVE_BASE param [### What param? This is an enum 138 not a function.] ). The text will be marked as 139 modified, and if properties exist, they will be marked as modified. 140 141 In many cases svn_wc__db_status_added means any of added, moved-here 142 or copied-here. See individual functions for clarification and 143 svn_wc__db_scan_addition() to get more details. */ 144 svn_wc__db_status_added, 145 146 /* This node has been added with history, based on the move source. 147 Text and property modifications are based on whether changes have 148 been made against their pristine versions. */ 149 svn_wc__db_status_moved_here, 150 151 /* This node has been added with history, based on the copy source. 152 Text and property modifications are based on whether changes have 153 been made against their pristine versions. */ 154 svn_wc__db_status_copied, 155 156 /* This node has been deleted. No text or property modifications 157 will be present. */ 158 svn_wc__db_status_deleted, 159 160 /* This node was named by the server, but no information was provided. */ 161 svn_wc__db_status_server_excluded, 162 163 /* This node has been administratively excluded. */ 164 svn_wc__db_status_excluded, 165 166 /* This node is not present in this revision. This typically happens 167 when a node is deleted and committed without updating its parent. 168 The parent revision indicates it should be present, but this node's 169 revision states otherwise. */ 170 svn_wc__db_status_not_present, 171 172 /* This node is known, but its information is incomplete. Generally, 173 it should be treated similar to the other missing status values 174 until some (later) process updates the node with its data. 175 176 When the incomplete status applies to a directory, the list of 177 children and the list of its base properties as recorded in the 178 working copy do not match their working copy versions. 179 The update editor can complete a directory by using a different 180 update algorithm. */ 181 svn_wc__db_status_incomplete, 182 183 /* The BASE node has been marked as deleted. Only used as an internal 184 status in wc_db.c and entries.c. */ 185 svn_wc__db_status_base_deleted 186 187} svn_wc__db_status_t; 188 189/* Lock information. We write/read it all as one, so let's use a struct 190 for convenience. */ 191typedef struct svn_wc__db_lock_t { 192 /* The lock token */ 193 const char *token; 194 195 /* The owner of the lock, possibly NULL */ 196 const char *owner; 197 198 /* A comment about the lock, possibly NULL */ 199 const char *comment; 200 201 /* The date the lock was created */ 202 apr_time_t date; 203} svn_wc__db_lock_t; 204 205 206/* ### NOTE: I have not provided docstrings for most of this file at this 207 ### point in time. The shape and extent of this API is still in massive 208 ### flux. I'm iterating in public, but do not want to doc until it feels 209 ### like it is "Right". 210*/ 211 212/* ### where/how to handle: text_time, locks, working_size */ 213 214 215/* 216 @defgroup svn_wc__db_admin General administrative functions 217 @{ 218*/ 219 220/* Open a working copy administrative database context. 221 222 This context is (initially) not associated with any particular working 223 copy directory or working copy root (wcroot). As operations are performed, 224 this context will load the appropriate wcroot information. 225 226 The context is returned in DB. 227 228 CONFIG should hold the various configuration options that may apply to 229 the administrative operation. It should live at least as long as the 230 RESULT_POOL parameter. 231 232 When OPEN_WITHOUT_UPGRADE is TRUE, then the working copy databases will 233 be opened even when an old database format is found/detected during 234 the operation of a wc_db API). If open_without_upgrade is FALSE and an 235 upgrade is required, then SVN_ERR_WC_UPGRADE_REQUIRED will be returned 236 from that API. 237 Passing TRUE will allow a bare minimum of APIs to function (most notably, 238 the temp_get_format() function will always return a value) since most of 239 these APIs expect a current-format database to be present. 240 241 If ENFORCE_EMPTY_WQ is TRUE, then any databases with stale work items in 242 their work queue will raise an error when they are opened. The operation 243 will raise SVN_ERR_WC_CLEANUP_REQUIRED. Passing FALSE for this routine 244 means that the work queue is being processed (via 'svn cleanup') and all 245 operations should be allowed. 246 247 The DB will be closed when RESULT_POOL is cleared. It may also be closed 248 manually using svn_wc__db_close(). In particular, this will close any 249 SQLite databases that have been opened and cached. 250 251 The context is allocated in RESULT_POOL. This pool is *retained* and used 252 for future allocations within the DB. Be forewarned about unbounded 253 memory growth if this DB is used across an unbounded number of wcroots 254 and versioned directories. 255 256 Temporary allocations will be made in SCRATCH_POOL. 257*/ 258svn_error_t * 259svn_wc__db_open(svn_wc__db_t **db, 260 svn_config_t *config, 261 svn_boolean_t open_without_upgrade, 262 svn_boolean_t enforce_empty_wq, 263 apr_pool_t *result_pool, 264 apr_pool_t *scratch_pool); 265 266 267/* Close DB. */ 268svn_error_t * 269svn_wc__db_close(svn_wc__db_t *db); 270 271 272/* Initialize the SDB for LOCAL_ABSPATH, which should be a working copy path. 273 274 A REPOSITORY row will be constructed for the repository identified by 275 REPOS_ROOT_URL and REPOS_UUID. Neither of these may be NULL. 276 277 A BASE_NODE row will be created for the directory at REPOS_RELPATH at 278 revision INITIAL_REV. 279 If INITIAL_REV is greater than zero, then the node will be marked as 280 "incomplete" because we don't know its children. Contrary, if the 281 INITIAL_REV is zero, then this directory should represent the root and 282 we know it has no children, so the node is complete. 283 284 ### Is there any benefit to marking it 'complete' if rev==0? Seems like 285 ### an unnecessary special case. 286 287 DEPTH is the initial depth of the working copy; it must be a definite 288 depth, not svn_depth_unknown. 289 290 Use SCRATCH_POOL for temporary allocations. 291*/ 292svn_error_t * 293svn_wc__db_init(svn_wc__db_t *db, 294 const char *local_abspath, 295 const char *repos_relpath, 296 const char *repos_root_url, 297 const char *repos_uuid, 298 svn_revnum_t initial_rev, 299 svn_depth_t depth, 300 apr_pool_t *scratch_pool); 301 302 303/* Compute the LOCAL_RELPATH for the given LOCAL_ABSPATH, relative 304 from wri_abspath. 305 306 The LOCAL_RELPATH is a relative path to the working copy's root. That 307 root will be located by this function, and the path will be relative to 308 that location. If LOCAL_ABSPATH is the wcroot directory, then "" will 309 be returned. 310 311 The LOCAL_RELPATH should ONLY be used for persisting paths to disk. 312 Those paths should not be abspaths, otherwise the working copy cannot 313 be moved. The working copy library should not make these paths visible 314 in its API (which should all be abspaths), and it should not be using 315 relpaths for other processing. 316 317 LOCAL_RELPATH will be allocated in RESULT_POOL. All other (temporary) 318 allocations will be made in SCRATCH_POOL. 319 320 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 321 option. 322*/ 323svn_error_t * 324svn_wc__db_to_relpath(const char **local_relpath, 325 svn_wc__db_t *db, 326 const char *wri_abspath, 327 const char *local_abspath, 328 apr_pool_t *result_pool, 329 apr_pool_t *scratch_pool); 330 331 332/* Compute the LOCAL_ABSPATH for a LOCAL_RELPATH located within the working 333 copy identified by WRI_ABSPATH. 334 335 This is the reverse of svn_wc__db_to_relpath. It should be used for 336 returning a persisted relpath back into an abspath. 337 338 LOCAL_ABSPATH will be allocated in RESULT_POOL. All other (temporary) 339 allocations will be made in SCRATCH_POOL. 340 341 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 342 option. 343 */ 344svn_error_t * 345svn_wc__db_from_relpath(const char **local_abspath, 346 svn_wc__db_t *db, 347 const char *wri_abspath, 348 const char *local_relpath, 349 apr_pool_t *result_pool, 350 apr_pool_t *scratch_pool); 351 352/* Compute the working copy root WCROOT_ABSPATH for WRI_ABSPATH using DB. 353 354 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 355 option. 356 */ 357svn_error_t * 358svn_wc__db_get_wcroot(const char **wcroot_abspath, 359 svn_wc__db_t *db, 360 const char *wri_abspath, 361 apr_pool_t *result_pool, 362 apr_pool_t *scratch_pool); 363 364 365/* @} */ 366 367/* Different kinds of trees 368 369 The design doc mentions three different kinds of trees, BASE, WORKING and 370 ACTUAL: http://svn.apache.org/repos/asf/subversion/trunk/notes/wc-ng-design 371 We have different APIs to handle each tree, enumerated below, along with 372 a blurb to explain what that tree represents. 373*/ 374 375/* @defgroup svn_wc__db_base BASE tree management 376 377 BASE is what we get from the server. It is the *absolute* pristine copy. 378 You need to use checkout, update, switch, or commit to alter your view of 379 the repository. 380 381 In the BASE tree, each node corresponds to a particular node-rev in the 382 repository. It can be a mixed-revision tree. Each node holds either a 383 copy of the node-rev as it exists in the repository (if presence = 384 'normal'), or a place-holder (if presence = 'server-excluded' or 'excluded' or 385 'not-present'). 386 387 @{ 388*/ 389 390/* Add or replace a directory in the BASE tree. 391 392 The directory is located at LOCAL_ABSPATH on the local filesystem, and 393 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 394 repository, at revision REVISION. 395 396 The directory properties are given by the PROPS hash (which is 397 const char *name => const svn_string_t *). 398 399 The last-change information is given by <CHANGED_REV, CHANGED_DATE, 400 CHANGED_AUTHOR>. 401 402 The directory's children are listed in CHILDREN, as an array of 403 const char *. The child nodes do NOT have to exist when this API 404 is called. For each child node which does not exists, an "incomplete" 405 node will be added. These child nodes will be added regardless of 406 the DEPTH value. The caller must sort out which must be recorded, 407 and which must be omitted. 408 409 This subsystem does not use DEPTH, but it can be recorded here in 410 the BASE tree for higher-level code to use. 411 412 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 413 data. 414 415 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 416 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 417 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 418 ACTUAL, to mark the properties unmodified. 419 420 If NEW_IPROPS is not NULL, then it is a depth-first ordered array of 421 svn_prop_inherited_item_t * structures that is set as the base node's 422 inherited_properties. 423 424 If CONFLICT is not NULL, then it describes a conflict for this node. The 425 node will be record as conflicted (in ACTUAL). 426 427 Any work items that are necessary as part of this node construction may 428 be passed in WORK_ITEMS. 429 430 All temporary allocations will be made in SCRATCH_POOL. 431*/ 432svn_error_t * 433svn_wc__db_base_add_directory(svn_wc__db_t *db, 434 const char *local_abspath, 435 const char *wri_abspath, 436 const char *repos_relpath, 437 const char *repos_root_url, 438 const char *repos_uuid, 439 svn_revnum_t revision, 440 const apr_hash_t *props, 441 svn_revnum_t changed_rev, 442 apr_time_t changed_date, 443 const char *changed_author, 444 const apr_array_header_t *children, 445 svn_depth_t depth, 446 apr_hash_t *dav_cache, 447 svn_boolean_t update_actual_props, 448 apr_hash_t *new_actual_props, 449 apr_array_header_t *new_iprops, 450 const svn_skel_t *conflict, 451 const svn_skel_t *work_items, 452 apr_pool_t *scratch_pool); 453 454/* Add a new directory in BASE, whether WORKING nodes exist or not. Mark it 455 as incomplete and with revision REVISION. If REPOS_RELPATH is not NULL, 456 apply REPOS_RELPATH, REPOS_ROOT_URL and REPOS_UUID. 457 Perform all temporary allocations in SCRATCH_POOL. 458 */ 459svn_error_t * 460svn_wc__db_base_add_incomplete_directory(svn_wc__db_t *db, 461 const char *local_abspath, 462 const char *repos_relpath, 463 const char *repos_root_url, 464 const char *repos_uuid, 465 svn_revnum_t revision, 466 svn_depth_t depth, 467 svn_boolean_t insert_base_deleted, 468 svn_boolean_t delete_working, 469 svn_skel_t *conflict, 470 svn_skel_t *work_items, 471 apr_pool_t *scratch_pool); 472 473 474/* Add or replace a file in the BASE tree. 475 476 The file is located at LOCAL_ABSPATH on the local filesystem, and 477 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 478 repository, at revision REVISION. 479 480 The file properties are given by the PROPS hash (which is 481 const char *name => const svn_string_t *). 482 483 The last-change information is given by <CHANGED_REV, CHANGED_DATE, 484 CHANGED_AUTHOR>. 485 486 The checksum of the file contents is given in CHECKSUM. An entry in 487 the pristine text base is NOT required when this API is called. 488 489 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 490 data. 491 492 If CONFLICT is not NULL, then it describes a conflict for this node. The 493 node will be record as conflicted (in ACTUAL). 494 495 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 496 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 497 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 498 ACTUAL, to mark the properties unmodified. 499 500 Any work items that are necessary as part of this node construction may 501 be passed in WORK_ITEMS. 502 503 Unless KEEP_RECORDED_INFO is set to TRUE, recorded size and timestamp values 504 will be cleared. 505 506 All temporary allocations will be made in SCRATCH_POOL. 507*/ 508svn_error_t * 509svn_wc__db_base_add_file(svn_wc__db_t *db, 510 const char *local_abspath, 511 const char *wri_abspath, 512 const char *repos_relpath, 513 const char *repos_root_url, 514 const char *repos_uuid, 515 svn_revnum_t revision, 516 const apr_hash_t *props, 517 svn_revnum_t changed_rev, 518 apr_time_t changed_date, 519 const char *changed_author, 520 const svn_checksum_t *checksum, 521 apr_hash_t *dav_cache, 522 svn_boolean_t delete_working, 523 svn_boolean_t update_actual_props, 524 apr_hash_t *new_actual_props, 525 apr_array_header_t *new_iprops, 526 svn_boolean_t keep_recorded_info, 527 svn_boolean_t insert_base_deleted, 528 const svn_skel_t *conflict, 529 const svn_skel_t *work_items, 530 apr_pool_t *scratch_pool); 531 532 533/* Add or replace a symlink in the BASE tree. 534 535 The symlink is located at LOCAL_ABSPATH on the local filesystem, and 536 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 537 repository, at revision REVISION. 538 539 The symlink's properties are given by the PROPS hash (which is 540 const char *name => const svn_string_t *). 541 542 The last-change information is given by <CHANGED_REV, CHANGED_DATE, 543 CHANGED_AUTHOR>. 544 545 The target of the symlink is specified by TARGET. 546 547 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 548 data. 549 550 If CONFLICT is not NULL, then it describes a conflict for this node. The 551 node will be record as conflicted (in ACTUAL). 552 553 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 554 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 555 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 556 ACTUAL, to mark the properties unmodified. 557 558 Any work items that are necessary as part of this node construction may 559 be passed in WORK_ITEMS. 560 561 All temporary allocations will be made in SCRATCH_POOL. 562*/ 563/* ### KFF: This is an interesting question, because currently 564 ### symlinks are versioned as regular files with the svn:special 565 ### property; then the file's text contents indicate that it is a 566 ### symlink and where that symlink points. That's for portability: 567 ### you can check 'em out onto a platform that doesn't support 568 ### symlinks, and even modify the link and check it back in. It's 569 ### a great solution; but then the question for wc-ng is: 570 ### 571 ### Suppose you check out a symlink on platform X and platform Y. 572 ### X supports symlinks; Y does not. Should the wc-ng storage for 573 ### those two be the same? I mean, on platform Y, the file is just 574 ### going to look and behave like a regular file. It would be sort 575 ### of odd for the wc-ng storage for that file to be of a different 576 ### type from all the other files. (On the other hand, maybe it's 577 ### weird today that the wc-1 storage for a working symlink is to 578 ### be like a regular file (i.e., regular text-base and whatnot). 579 ### 580 ### I'm still feeling my way around this problem; just pointing out 581 ### the issues. 582 583 ### gjs: symlinks are stored in the database as first-class objects, 584 ### rather than in the filesystem as "special" regular files. thus, 585 ### all portability concerns are moot. higher-levels can figure out 586 ### how to represent the link in ACTUAL. higher-levels can also 587 ### deal with translating to/from the svn:special property and 588 ### the plain-text file contents. 589 ### dlr: What about hard links? At minimum, mention in doc string. 590*/ 591svn_error_t * 592svn_wc__db_base_add_symlink(svn_wc__db_t *db, 593 const char *local_abspath, 594 const char *wri_abspath, 595 const char *repos_relpath, 596 const char *repos_root_url, 597 const char *repos_uuid, 598 svn_revnum_t revision, 599 const apr_hash_t *props, 600 svn_revnum_t changed_rev, 601 apr_time_t changed_date, 602 const char *changed_author, 603 const char *target, 604 apr_hash_t *dav_cache, 605 svn_boolean_t delete_working, 606 svn_boolean_t update_actual_props, 607 apr_hash_t *new_actual_props, 608 apr_array_header_t *new_iprops, 609 svn_boolean_t keep_recorded_info, 610 svn_boolean_t insert_base_deleted, 611 const svn_skel_t *conflict, 612 const svn_skel_t *work_items, 613 apr_pool_t *scratch_pool); 614 615 616/* Create a node in the BASE tree that is present in name only. 617 618 The new node will be located at LOCAL_ABSPATH, and correspond to the 619 repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> 620 at revision REVISION. 621 622 The node's kind is described by KIND, and the reason for its absence 623 is specified by STATUS. Only these values are allowed for STATUS: 624 625 svn_wc__db_status_server_excluded 626 svn_wc__db_status_excluded 627 628 If CONFLICT is not NULL, then it describes a conflict for this node. The 629 node will be record as conflicted (in ACTUAL). 630 631 Any work items that are necessary as part of this node construction may 632 be passed in WORK_ITEMS. 633 634 All temporary allocations will be made in SCRATCH_POOL. 635*/ 636svn_error_t * 637svn_wc__db_base_add_excluded_node(svn_wc__db_t *db, 638 const char *local_abspath, 639 const char *repos_relpath, 640 const char *repos_root_url, 641 const char *repos_uuid, 642 svn_revnum_t revision, 643 svn_node_kind_t kind, 644 svn_wc__db_status_t status, 645 const svn_skel_t *conflict, 646 const svn_skel_t *work_items, 647 apr_pool_t *scratch_pool); 648 649 650/* Create a node in the BASE tree that is present in name only. 651 652 The new node will be located at LOCAL_ABSPATH, and correspond to the 653 repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> 654 at revision REVISION. 655 656 The node's kind is described by KIND, and the reason for its absence 657 is 'svn_wc__db_status_not_present'. 658 659 If CONFLICT is not NULL, then it describes a conflict for this node. The 660 node will be record as conflicted (in ACTUAL). 661 662 Any work items that are necessary as part of this node construction may 663 be passed in WORK_ITEMS. 664 665 All temporary allocations will be made in SCRATCH_POOL. 666*/ 667svn_error_t * 668svn_wc__db_base_add_not_present_node(svn_wc__db_t *db, 669 const char *local_abspath, 670 const char *repos_relpath, 671 const char *repos_root_url, 672 const char *repos_uuid, 673 svn_revnum_t revision, 674 svn_node_kind_t kind, 675 const svn_skel_t *conflict, 676 const svn_skel_t *work_items, 677 apr_pool_t *scratch_pool); 678 679/* Remove a node and all its descendants from the BASE tree. This can 680 be done in two modes: 681 682 * Remove everything, scheduling wq operations to clean up 683 the working copy. (KEEP_WORKING = FALSE) 684 685 * Bump things to WORKING, so the BASE layer is free, but the working 686 copy unmodified, except that everything that was visible from 687 BASE is now a copy of what it used to be. (KEEP_WORKING = TRUE) 688 689 This operation *installs* workqueue operations to update the local 690 filesystem after the database operation. 691 692 To maintain a consistent database this function will also remove 693 any working node that marks LOCAL_ABSPATH as base-deleted. If this 694 results in there being no working node for LOCAL_ABSPATH then any 695 actual node will be removed if the actual node does not mark a 696 conflict. 697 698 699 If MARK_NOT_PRESENT or MARK_EXCLUDED is TRUE, install a marker 700 of the specified type at the root of the now removed tree, with 701 either the specified revision (or in case of SVN_INVALID_REVNUM) 702 the original revision. 703 704 If CONFLICT and/or WORK_ITEMS are passed they are installed as part 705 of the operation, after the work items inserted by the operation 706 itself. 707*/ 708svn_error_t * 709svn_wc__db_base_remove(svn_wc__db_t *db, 710 const char *local_abspath, 711 svn_boolean_t keep_working, 712 svn_boolean_t mark_not_present, 713 svn_boolean_t mark_excluded, 714 svn_revnum_t marker_revision, 715 svn_skel_t *conflict, 716 svn_skel_t *work_items, 717 apr_pool_t *scratch_pool); 718 719 720/* Retrieve information about a node in the BASE tree. 721 722 For the BASE node implied by LOCAL_ABSPATH from the local filesystem, 723 return information in the provided OUT parameters. Each OUT parameter 724 may be NULL, indicating that specific item is not requested. 725 726 If there is no information about this node, then SVN_ERR_WC_PATH_NOT_FOUND 727 will be returned. 728 729 The OUT parameters, and their "not available" values are: 730 STATUS n/a (always available) 731 KIND n/a (always available) 732 REVISION SVN_INVALID_REVNUM 733 REPOS_RELPATH NULL (caller should scan up) 734 REPOS_ROOT_URL NULL (caller should scan up) 735 REPOS_UUID NULL (caller should scan up) 736 CHANGED_REV SVN_INVALID_REVNUM 737 CHANGED_DATE 0 738 CHANGED_AUTHOR NULL 739 DEPTH svn_depth_unknown 740 CHECKSUM NULL 741 TARGET NULL 742 LOCK NULL 743 744 HAD_PROPS FALSE 745 PROPS NULL 746 747 UPDATE_ROOT FALSE 748 749 If the STATUS is normal, the REPOS_* values will be non-NULL. 750 751 If DEPTH is requested, and the node is NOT a directory, then the 752 value will be set to svn_depth_unknown. If LOCAL_ABSPATH is a link, 753 it's up to the caller to resolve depth for the link's target. 754 755 If CHECKSUM is requested, and the node is NOT a file, then it will 756 be set to NULL. 757 758 If TARGET is requested, and the node is NOT a symlink, then it will 759 be set to NULL. 760 761 *PROPS maps "const char *" names to "const svn_string_t *" values. If 762 the base node is capable of having properties but has none, set 763 *PROPS to an empty hash. If its status is such that it cannot have 764 properties, set *PROPS to NULL. 765 766 If UPDATE_ROOT is requested, set it to TRUE if the node should only 767 be updated when it is the root of an update (e.g. file externals). 768 769 All returned data will be allocated in RESULT_POOL. All temporary 770 allocations will be made in SCRATCH_POOL. 771*/ 772svn_error_t * 773svn_wc__db_base_get_info(svn_wc__db_status_t *status, 774 svn_node_kind_t *kind, 775 svn_revnum_t *revision, 776 const char **repos_relpath, 777 const char **repos_root_url, 778 const char **repos_uuid, 779 svn_revnum_t *changed_rev, 780 apr_time_t *changed_date, 781 const char **changed_author, 782 svn_depth_t *depth, 783 const svn_checksum_t **checksum, 784 const char **target, 785 svn_wc__db_lock_t **lock, 786 svn_boolean_t *had_props, 787 apr_hash_t **props, 788 svn_boolean_t *update_root, 789 svn_wc__db_t *db, 790 const char *local_abspath, 791 apr_pool_t *result_pool, 792 apr_pool_t *scratch_pool); 793 794/* Structure returned by svn_wc__db_base_get_children_info. Only has the 795 fields needed by the adm crawler. */ 796struct svn_wc__db_base_info_t { 797 svn_wc__db_status_t status; 798 svn_node_kind_t kind; 799 svn_revnum_t revnum; 800 const char *repos_relpath; 801 const char *repos_root_url; 802 svn_depth_t depth; 803 svn_boolean_t update_root; 804 svn_wc__db_lock_t *lock; 805}; 806 807/* Return in *NODES a hash mapping name->struct svn_wc__db_base_info_t for 808 the children of DIR_ABSPATH at op_depth 0. 809 */ 810svn_error_t * 811svn_wc__db_base_get_children_info(apr_hash_t **nodes, 812 svn_wc__db_t *db, 813 const char *dir_abspath, 814 apr_pool_t *result_pool, 815 apr_pool_t *scratch_pool); 816 817 818/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the BASE tree. 819 820 *PROPS maps "const char *" names to "const svn_string_t *" values. 821 If the node has no properties, set *PROPS to an empty hash. 822 *PROPS will never be set to NULL. 823 If the node is not present in the BASE tree (with presence 'normal' 824 or 'incomplete'), return an error. 825 Allocate *PROPS and its keys and values in RESULT_POOL. 826*/ 827svn_error_t * 828svn_wc__db_base_get_props(apr_hash_t **props, 829 svn_wc__db_t *db, 830 const char *local_abspath, 831 apr_pool_t *result_pool, 832 apr_pool_t *scratch_pool); 833 834 835/* Return a list of the BASE tree node's children's names. 836 837 For the node indicated by LOCAL_ABSPATH, this function will return 838 the names of all of its children in the array CHILDREN. The array 839 elements are const char * values. 840 841 If the node is not a directory, then SVN_ERR_WC_NOT_WORKING_COPY will 842 be returned. 843 844 All returned data will be allocated in RESULT_POOL. All temporary 845 allocations will be made in SCRATCH_POOL. 846*/ 847svn_error_t * 848svn_wc__db_base_get_children(const apr_array_header_t **children, 849 svn_wc__db_t *db, 850 const char *local_abspath, 851 apr_pool_t *result_pool, 852 apr_pool_t *scratch_pool); 853 854 855/* Set the dav cache for LOCAL_ABSPATH to PROPS. Use SCRATCH_POOL for 856 temporary allocations. */ 857svn_error_t * 858svn_wc__db_base_set_dav_cache(svn_wc__db_t *db, 859 const char *local_abspath, 860 const apr_hash_t *props, 861 apr_pool_t *scratch_pool); 862 863 864/* Retrieve the dav cache for LOCAL_ABSPATH into *PROPS, allocated in 865 RESULT_POOL. Use SCRATCH_POOL for temporary allocations. Return 866 SVN_ERR_WC_PATH_NOT_FOUND if no dav cache can be located for 867 LOCAL_ABSPATH in DB. */ 868svn_error_t * 869svn_wc__db_base_get_dav_cache(apr_hash_t **props, 870 svn_wc__db_t *db, 871 const char *local_abspath, 872 apr_pool_t *result_pool, 873 apr_pool_t *scratch_pool); 874 875/* Recursively clear the dav cache for LOCAL_ABSPATH. Use 876 SCRATCH_POOL for temporary allocations. */ 877svn_error_t * 878svn_wc__db_base_clear_dav_cache_recursive(svn_wc__db_t *db, 879 const char *local_abspath, 880 apr_pool_t *scratch_pool); 881 882/* Set LOCK_TOKENS to a hash mapping const char * full URLs to const char * 883 * lock tokens for every base node at or under LOCAL_ABSPATH in DB which has 884 * such a lock token set on it. 885 * Allocate the hash and all items therein from RESULT_POOL. */ 886svn_error_t * 887svn_wc__db_base_get_lock_tokens_recursive(apr_hash_t **lock_tokens, 888 svn_wc__db_t *db, 889 const char *local_abspath, 890 apr_pool_t *result_pool, 891 apr_pool_t *scratch_pool); 892 893/* ### anything else needed for maintaining the BASE tree? */ 894 895 896/* @} */ 897 898/* @defgroup svn_wc__db_pristine Pristine ("text base") management 899 @{ 900*/ 901 902/* Set *PRISTINE_ABSPATH to the path to the pristine text file 903 identified by SHA1_CHECKSUM. Error if it does not exist. 904 905 ### This is temporary - callers should not be looking at the file 906 directly. 907 908 Allocate the path in RESULT_POOL. */ 909svn_error_t * 910svn_wc__db_pristine_get_path(const char **pristine_abspath, 911 svn_wc__db_t *db, 912 const char *wri_abspath, 913 const svn_checksum_t *checksum, 914 apr_pool_t *result_pool, 915 apr_pool_t *scratch_pool); 916 917/* Set *PRISTINE_ABSPATH to the path under WCROOT_ABSPATH that will be 918 used by the pristine text identified by SHA1_CHECKSUM. The file 919 need not exist. 920 */ 921svn_error_t * 922svn_wc__db_pristine_get_future_path(const char **pristine_abspath, 923 const char *wcroot_abspath, 924 const svn_checksum_t *sha1_checksum, 925 apr_pool_t *result_pool, 926 apr_pool_t *scratch_pool); 927 928 929/* If requested set *CONTENTS to a readable stream that will yield the pristine 930 text identified by SHA1_CHECKSUM (must be a SHA-1 checksum) within the WC 931 identified by WRI_ABSPATH in DB. 932 933 If requested set *SIZE to the size of the pristine stream in bytes, 934 935 Even if the pristine text is removed from the store while it is being 936 read, the stream will remain valid and readable until it is closed. 937 938 Allocate the stream in RESULT_POOL. */ 939svn_error_t * 940svn_wc__db_pristine_read(svn_stream_t **contents, 941 svn_filesize_t *size, 942 svn_wc__db_t *db, 943 const char *wri_abspath, 944 const svn_checksum_t *sha1_checksum, 945 apr_pool_t *result_pool, 946 apr_pool_t *scratch_pool); 947 948/* Baton for svn_wc__db_pristine_install */ 949typedef struct svn_wc__db_install_data_t 950 svn_wc__db_install_data_t; 951 952/* Open a writable stream to a temporary text base, ready for installing 953 into the pristine store. Set *STREAM to the opened stream. The temporary 954 file will have an arbitrary unique name. Return as *INSTALL_DATA a baton 955 for eiter installing or removing the file 956 957 Arrange that, on stream closure, *MD5_CHECKSUM and *SHA1_CHECKSUM will be 958 set to the MD-5 and SHA-1 checksums respectively of that file. 959 MD5_CHECKSUM and/or SHA1_CHECKSUM may be NULL if not wanted. 960 961 Allocate the new stream, path and checksums in RESULT_POOL. 962 */ 963svn_error_t * 964svn_wc__db_pristine_prepare_install(svn_stream_t **stream, 965 svn_wc__db_install_data_t **install_data, 966 svn_checksum_t **sha1_checksum, 967 svn_checksum_t **md5_checksum, 968 svn_wc__db_t *db, 969 const char *wri_abspath, 970 apr_pool_t *result_pool, 971 apr_pool_t *scratch_pool); 972 973/* Install the file created via svn_wc__db_pristine_prepare_install() into 974 the pristine data store, to be identified by the SHA-1 checksum of its 975 contents, SHA1_CHECKSUM, and whose MD-5 checksum is MD5_CHECKSUM. */ 976svn_error_t * 977svn_wc__db_pristine_install(svn_wc__db_install_data_t *install_data, 978 const svn_checksum_t *sha1_checksum, 979 const svn_checksum_t *md5_checksum, 980 apr_pool_t *scratch_pool); 981 982/* Removes the temporary data created by svn_wc__db_pristine_prepare_install 983 when the pristine won't be installed. */ 984svn_error_t * 985svn_wc__db_pristine_install_abort(svn_wc__db_install_data_t *install_data, 986 apr_pool_t *scratch_pool); 987 988 989/* Set *MD5_CHECKSUM to the MD-5 checksum of a pristine text 990 identified by its SHA-1 checksum SHA1_CHECKSUM. Return an error 991 if the pristine text does not exist or its MD5 checksum is not found. 992 993 Allocate *MD5_CHECKSUM in RESULT_POOL. */ 994svn_error_t * 995svn_wc__db_pristine_get_md5(const svn_checksum_t **md5_checksum, 996 svn_wc__db_t *db, 997 const char *wri_abspath, 998 const svn_checksum_t *sha1_checksum, 999 apr_pool_t *result_pool, 1000 apr_pool_t *scratch_pool); 1001 1002 1003/* Set *SHA1_CHECKSUM to the SHA-1 checksum of a pristine text 1004 identified by its MD-5 checksum MD5_CHECKSUM. Return an error 1005 if the pristine text does not exist or its SHA-1 checksum is not found. 1006 1007 Note: The MD-5 checksum is not strictly guaranteed to be unique in the 1008 database table, although duplicates are expected to be extremely rare. 1009 ### TODO: The behaviour is currently unspecified if the MD-5 checksum is 1010 not unique. Need to see whether this function is going to stay in use, 1011 and, if so, address this somehow. 1012 1013 Allocate *SHA1_CHECKSUM in RESULT_POOL. */ 1014svn_error_t * 1015svn_wc__db_pristine_get_sha1(const svn_checksum_t **sha1_checksum, 1016 svn_wc__db_t *db, 1017 const char *wri_abspath, 1018 const svn_checksum_t *md5_checksum, 1019 apr_pool_t *result_pool, 1020 apr_pool_t *scratch_pool); 1021 1022 1023/* If necessary transfers the PRISTINE files of the tree rooted at 1024 SRC_LOCAL_ABSPATH to the working copy identified by DST_WRI_ABSPATH. */ 1025svn_error_t * 1026svn_wc__db_pristine_transfer(svn_wc__db_t *db, 1027 const char *src_local_abspath, 1028 const char *dst_wri_abspath, 1029 svn_cancel_func_t cancel_func, 1030 void *cancel_baton, 1031 apr_pool_t *scratch_pool); 1032 1033/* Remove the pristine text with SHA-1 checksum SHA1_CHECKSUM from the 1034 * pristine store, iff it is not referenced by any of the (other) WC DB 1035 * tables. */ 1036svn_error_t * 1037svn_wc__db_pristine_remove(svn_wc__db_t *db, 1038 const char *wri_abspath, 1039 const svn_checksum_t *sha1_checksum, 1040 apr_pool_t *scratch_pool); 1041 1042 1043/* Remove all unreferenced pristines in the WC of WRI_ABSPATH in DB. */ 1044svn_error_t * 1045svn_wc__db_pristine_cleanup(svn_wc__db_t *db, 1046 const char *wri_abspath, 1047 apr_pool_t *scratch_pool); 1048 1049 1050/* Set *PRESENT to true if the pristine store for WRI_ABSPATH in DB contains 1051 a pristine text with SHA-1 checksum SHA1_CHECKSUM, and to false otherwise. 1052*/ 1053svn_error_t * 1054svn_wc__db_pristine_check(svn_boolean_t *present, 1055 svn_wc__db_t *db, 1056 const char *wri_abspath, 1057 const svn_checksum_t *sha1_checksum, 1058 apr_pool_t *scratch_pool); 1059 1060/* @defgroup svn_wc__db_external External management 1061 @{ */ 1062 1063/* Adds (or overwrites) a file external LOCAL_ABSPATH to the working copy 1064 identified by WRI_ABSPATH. 1065 1066 It updates both EXTERNALS and NODES in one atomic step. 1067 */ 1068svn_error_t * 1069svn_wc__db_external_add_file(svn_wc__db_t *db, 1070 const char *local_abspath, 1071 const char *wri_abspath, 1072 1073 const char *repos_relpath, 1074 const char *repos_root_url, 1075 const char *repos_uuid, 1076 svn_revnum_t revision, 1077 1078 const apr_hash_t *props, 1079 apr_array_header_t *iprops, 1080 1081 svn_revnum_t changed_rev, 1082 apr_time_t changed_date, 1083 const char *changed_author, 1084 1085 const svn_checksum_t *checksum, 1086 1087 const apr_hash_t *dav_cache, 1088 1089 const char *record_ancestor_abspath, 1090 const char *recorded_repos_relpath, 1091 svn_revnum_t recorded_peg_revision, 1092 svn_revnum_t recorded_revision, 1093 1094 svn_boolean_t update_actual_props, 1095 apr_hash_t *new_actual_props, 1096 1097 svn_boolean_t keep_recorded_info, 1098 const svn_skel_t *conflict, 1099 const svn_skel_t *work_items, 1100 apr_pool_t *scratch_pool); 1101 1102/* Adds (or overwrites) a symlink external LOCAL_ABSPATH to the working copy 1103 identified by WRI_ABSPATH. 1104 */ 1105svn_error_t * 1106svn_wc__db_external_add_symlink(svn_wc__db_t *db, 1107 const char *local_abspath, 1108 const char *wri_abspath, 1109 1110 const char *repos_relpath, 1111 const char *repos_root_url, 1112 const char *repos_uuid, 1113 svn_revnum_t revision, 1114 1115 const apr_hash_t *props, 1116 1117 svn_revnum_t changed_rev, 1118 apr_time_t changed_date, 1119 const char *changed_author, 1120 1121 const char *target, 1122 1123 const apr_hash_t *dav_cache, 1124 1125 const char *record_ancestor_abspath, 1126 const char *recorded_repos_relpath, 1127 svn_revnum_t recorded_peg_revision, 1128 svn_revnum_t recorded_revision, 1129 1130 svn_boolean_t update_actual_props, 1131 apr_hash_t *new_actual_props, 1132 1133 svn_boolean_t keep_recorded_info, 1134 const svn_skel_t *work_items, 1135 apr_pool_t *scratch_pool); 1136 1137/* Adds (or overwrites) a directory external LOCAL_ABSPATH to the working copy 1138 identified by WRI_ABSPATH. 1139 1140 Directory externals are stored in their own working copy, so one should use 1141 the normal svn_wc__db functions to access the normal working copy 1142 information. 1143 */ 1144svn_error_t * 1145svn_wc__db_external_add_dir(svn_wc__db_t *db, 1146 const char *local_abspath, 1147 const char *wri_abspath, 1148 1149 const char *repos_root_url, 1150 const char *repos_uuid, 1151 1152 const char *record_ancestor_abspath, 1153 const char *recorded_repos_relpath, 1154 svn_revnum_t recorded_peg_revision, 1155 svn_revnum_t recorded_revision, 1156 1157 const svn_skel_t *work_items, 1158 apr_pool_t *scratch_pool); 1159 1160/* Remove a registered external LOCAL_ABSPATH from the working copy identified 1161 by WRI_ABSPATH. 1162 */ 1163svn_error_t * 1164svn_wc__db_external_remove(svn_wc__db_t *db, 1165 const char *local_abspath, 1166 const char *wri_abspath, 1167 1168 const svn_skel_t *work_items, 1169 apr_pool_t *scratch_pool); 1170 1171 1172/* Reads information on the external LOCAL_ABSPATH as stored in the working 1173 copy identified with WRI_ABSPATH (If NULL the parent directory of 1174 LOCAL_ABSPATH is taken as WRI_ABSPATH). 1175 1176 Return SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not an external in 1177 this working copy. 1178 1179 When STATUS is requested it has one of these values 1180 svn_wc__db_status_normal The external is available 1181 svn_wc__db_status_excluded The external is user excluded 1182 1183 When KIND is requested then the value will be set to the kind of external. 1184 1185 If DEFINING_ABSPATH is requested, then the value will be set to the 1186 absolute path of the directory which originally defined the external. 1187 (The path with the svn:externals property) 1188 1189 If REPOS_ROOT_URL is requested, then the value will be set to the 1190 repository root of the external. 1191 1192 If REPOS_UUID is requested, then the value will be set to the 1193 repository uuid of the external. 1194 1195 If RECORDED_REPOS_RELPATH is requested, then the value will be set to the 1196 original repository relative path inside REPOS_ROOT_URL of the external. 1197 1198 If RECORDED_PEG_REVISION is requested, then the value will be set to the 1199 original recorded operational (peg) revision of the external. 1200 1201 If RECORDED_REVISION is requested, then the value will be set to the 1202 original recorded revision of the external. 1203 1204 Allocate the result in RESULT_POOL and perform temporary allocations in 1205 SCRATCH_POOL. 1206 */ 1207svn_error_t * 1208svn_wc__db_external_read(svn_wc__db_status_t *status, 1209 svn_node_kind_t *kind, 1210 const char **defining_abspath, 1211 1212 const char **repos_root_url, 1213 const char **repos_uuid, 1214 1215 const char **recorded_repos_relpath, 1216 svn_revnum_t *recorded_peg_revision, 1217 svn_revnum_t *recorded_revision, 1218 1219 svn_wc__db_t *db, 1220 const char *local_abspath, 1221 const char *wri_abspath, 1222 apr_pool_t *result_pool, 1223 apr_pool_t *scratch_pool); 1224 1225/* Return in *EXTERNALS a list of svn_wc__committable_external_info_t * 1226 * containing info on externals defined to be checked out below LOCAL_ABSPATH, 1227 * returning only those externals that are not fixed to a specific revision. 1228 * 1229 * If IMMEDIATES_ONLY is TRUE, only those externals defined to be checked out 1230 * as immediate children of LOCAL_ABSPATH are returned (this is useful for 1231 * treating user requested depth < infinity). 1232 * 1233 * If there are no externals to be returned, set *EXTERNALS to NULL. Otherwise 1234 * set *EXTERNALS to an APR array newly cleated in RESULT_POOL. 1235 * 1236 * NOTE: This only returns the externals known by the immediate WC root for 1237 * LOCAL_ABSPATH; i.e.: 1238 * - If there is a further parent WC "above" the immediate WC root, and if 1239 * that parent WC defines externals to live somewhere within this WC, these 1240 * externals will appear to be foreign/unversioned and won't be picked up. 1241 * - Likewise, only the topmost level of externals nestings (externals 1242 * defined within a checked out external dir) is picked up by this function. 1243 * (For recursion, see svn_wc__committable_externals_below().) 1244 * 1245 * ###TODO: Add a WRI_ABSPATH (wc root indicator) separate from LOCAL_ABSPATH, 1246 * to allow searching any wc-root for externals under LOCAL_ABSPATH, not only 1247 * LOCAL_ABSPATH's most immediate wc-root. */ 1248svn_error_t * 1249svn_wc__db_committable_externals_below(apr_array_header_t **externals, 1250 svn_wc__db_t *db, 1251 const char *local_abspath, 1252 svn_boolean_t immediates_only, 1253 apr_pool_t *result_pool, 1254 apr_pool_t *scratch_pool); 1255 1256/* Opaque struct for svn_wc__db_create_commit_queue, svn_wc__db_commit_queue_add, 1257 svn_wc__db_process_commit_queue */ 1258typedef struct svn_wc__db_commit_queue_t svn_wc__db_commit_queue_t; 1259 1260/* Create a new svn_wc__db_commit_queue_t instance in RESULT_POOL for the 1261 working copy specified with WRI_ABSPATH */ 1262svn_error_t * 1263svn_wc__db_create_commit_queue(svn_wc__db_commit_queue_t **queue, 1264 svn_wc__db_t *db, 1265 const char *wri_abspath, 1266 apr_pool_t *result_pool, 1267 apr_pool_t *scratch_pool); 1268 1269/* Adds the specified path to the commit queue with the related information. 1270 1271 See svn_wc_queue_committed4() for argument documentation. 1272 1273 Note that this function currently DOESN'T copy the passed values to 1274 RESULT_POOL, but expects them to be valid until processing. Otherwise the 1275 only users memory requirements would +- double. 1276 */ 1277svn_error_t * 1278svn_wc__db_commit_queue_add(svn_wc__db_commit_queue_t *queue, 1279 const char *local_abspath, 1280 svn_boolean_t recurse, 1281 svn_boolean_t is_commited, 1282 svn_boolean_t remove_lock, 1283 svn_boolean_t remove_changelist, 1284 const svn_checksum_t *new_sha1_checksum, 1285 apr_hash_t *new_dav_cache, 1286 apr_pool_t *result_pool, 1287 apr_pool_t *scratch_pool); 1288 1289/* Process the items in QUEUE in a single transaction. Commit workqueue items 1290 for items that need post processing. 1291 1292 Implementation detail of svn_wc_process_committed_queue2(). 1293 */ 1294svn_error_t * 1295svn_wc__db_process_commit_queue(svn_wc__db_t *db, 1296 svn_wc__db_commit_queue_t *queue, 1297 svn_revnum_t new_revnum, 1298 apr_time_t new_date, 1299 const char *new_author, 1300 apr_pool_t *scratch_pool); 1301 1302 1303/* Gets a mapping from const char * local abspaths of externals to the const 1304 char * local abspath of where they are defined for all externals defined 1305 at or below LOCAL_ABSPATH. 1306 1307 ### Returns NULL in *EXTERNALS until we bumped to format 29. 1308 1309 Allocate the result in RESULT_POOL and perform temporary allocations in 1310 SCRATCH_POOL. */ 1311svn_error_t * 1312svn_wc__db_externals_defined_below(apr_hash_t **externals, 1313 svn_wc__db_t *db, 1314 const char *local_abspath, 1315 apr_pool_t *result_pool, 1316 apr_pool_t *scratch_pool); 1317 1318/* Gather all svn:externals property values from the actual properties on 1319 directories below LOCAL_ABSPATH as a mapping of const char *local_abspath 1320 to const char * property values. 1321 1322 If DEPTHS is not NULL, set *depths to an apr_hash_t* mapping the same 1323 local_abspaths to the const char * ambient depth of the node. 1324 1325 Allocate the result in RESULT_POOL and perform temporary allocations in 1326 SCRATCH_POOL. */ 1327svn_error_t * 1328svn_wc__db_externals_gather_definitions(apr_hash_t **externals, 1329 apr_hash_t **depths, 1330 svn_wc__db_t *db, 1331 const char *local_abspath, 1332 apr_pool_t *result_pool, 1333 apr_pool_t *scratch_pool); 1334 1335/* @} */ 1336 1337/* @defgroup svn_wc__db_op Operations on WORKING tree 1338 @{ 1339*/ 1340 1341/* Copy the node at SRC_ABSPATH (in NODES and ACTUAL_NODE tables) to 1342 * DST_ABSPATH, both in DB but not necessarily in the same WC. The parent 1343 * of DST_ABSPATH must be a versioned directory. 1344 * 1345 * This copy is NOT recursive. It simply establishes this one node, plus 1346 * incomplete nodes for the children. 1347 * 1348 * If IS_MOVE is TRUE, mark this copy operation as the copy-half of 1349 * a move. The delete-half of the move needs to be created separately 1350 * with svn_wc__db_op_delete(). 1351 * 1352 * Add WORK_ITEMS to the work queue. */ 1353svn_error_t * 1354svn_wc__db_op_copy(svn_wc__db_t *db, 1355 const char *src_abspath, 1356 const char *dst_abspath, 1357 const char *dst_op_root_abspath, 1358 svn_boolean_t is_move, 1359 const svn_skel_t *work_items, 1360 apr_pool_t *scratch_pool); 1361 1362/* Checks if LOCAL_ABSPATH represents a move back to its original location, 1363 * and if it is reverts the move while keeping local changes after it has been 1364 * moved from MOVED_FROM_ABSPATH. 1365 * 1366 * If MOVED_BACK is not NULL, set *MOVED_BACK to TRUE when a move was reverted, 1367 * otherwise to FALSE. 1368 */ 1369svn_error_t * 1370svn_wc__db_op_handle_move_back(svn_boolean_t *moved_back, 1371 svn_wc__db_t *db, 1372 const char *local_abspath, 1373 const char *moved_from_abspath, 1374 const svn_skel_t *work_items, 1375 apr_pool_t *scratch_pool); 1376 1377 1378/* Copy the leaves of the op_depth layer directly shadowed by the operation 1379 * of SRC_ABSPATH (so SRC_ABSPATH must be an op_root) to dst_abspaths 1380 * parents layer. 1381 * 1382 * This operation is recursive. It copies all the descendants at the lower 1383 * layer and adds base-deleted nodes on dst_abspath layer to mark these nodes 1384 * properly deleted. 1385 * 1386 * Usually this operation is directly followed by a call to svn_wc__db_op_copy 1387 * which performs the real copy from src_abspath to dst_abspath. 1388 */ 1389svn_error_t * 1390svn_wc__db_op_copy_shadowed_layer(svn_wc__db_t *db, 1391 const char *src_abspath, 1392 const char *dst_abspath, 1393 svn_boolean_t is_move, 1394 apr_pool_t *scratch_pool); 1395 1396 1397/* Record a copy at LOCAL_ABSPATH from a repository directory. 1398 1399 This copy is NOT recursive. It simply establishes this one node. 1400 CHILDREN must be provided, and incomplete nodes will be constructed 1401 for them. 1402 1403 ### arguments docco. */ 1404svn_error_t * 1405svn_wc__db_op_copy_dir(svn_wc__db_t *db, 1406 const char *local_abspath, 1407 const apr_hash_t *props, 1408 svn_revnum_t changed_rev, 1409 apr_time_t changed_date, 1410 const char *changed_author, 1411 const char *original_repos_relpath, 1412 const char *original_root_url, 1413 const char *original_uuid, 1414 svn_revnum_t original_revision, 1415 const apr_array_header_t *children, 1416 svn_depth_t depth, 1417 svn_boolean_t is_move, 1418 const svn_skel_t *conflict, 1419 const svn_skel_t *work_items, 1420 apr_pool_t *scratch_pool); 1421 1422 1423/* Record a copy at LOCAL_ABSPATH from a repository file. 1424 1425 ### arguments docco. */ 1426svn_error_t * 1427svn_wc__db_op_copy_file(svn_wc__db_t *db, 1428 const char *local_abspath, 1429 const apr_hash_t *props, 1430 svn_revnum_t changed_rev, 1431 apr_time_t changed_date, 1432 const char *changed_author, 1433 const char *original_repos_relpath, 1434 const char *original_root_url, 1435 const char *original_uuid, 1436 svn_revnum_t original_revision, 1437 const svn_checksum_t *checksum, 1438 svn_boolean_t update_actual_props, 1439 const apr_hash_t *new_actual_props, 1440 svn_boolean_t is_move, 1441 const svn_skel_t *conflict, 1442 const svn_skel_t *work_items, 1443 apr_pool_t *scratch_pool); 1444 1445 1446svn_error_t * 1447svn_wc__db_op_copy_symlink(svn_wc__db_t *db, 1448 const char *local_abspath, 1449 const apr_hash_t *props, 1450 svn_revnum_t changed_rev, 1451 apr_time_t changed_date, 1452 const char *changed_author, 1453 const char *original_repos_relpath, 1454 const char *original_root_url, 1455 const char *original_uuid, 1456 svn_revnum_t original_revision, 1457 const char *target, 1458 svn_boolean_t is_move, 1459 const svn_skel_t *conflict, 1460 const svn_skel_t *work_items, 1461 apr_pool_t *scratch_pool); 1462 1463 1464/* ### do we need svn_wc__db_op_copy_server_excluded() ?? */ 1465 1466 1467/* ### add a new versioned directory. a list of children is NOT passed 1468 ### since they are added in future, distinct calls to db_op_add_*. 1469 PROPS gives the properties; empty or NULL means none. */ 1470/* ### do we need a CONFLICTS param? */ 1471svn_error_t * 1472svn_wc__db_op_add_directory(svn_wc__db_t *db, 1473 const char *local_abspath, 1474 const apr_hash_t *props, 1475 const svn_skel_t *work_items, 1476 apr_pool_t *scratch_pool); 1477 1478 1479/* Add a file. 1480 PROPS gives the properties; empty or NULL means none. 1481 ### this file has no "pristine" 1482 ### contents, so a checksum [reference] is not required. */ 1483/* ### do we need a CONFLICTS param? */ 1484svn_error_t * 1485svn_wc__db_op_add_file(svn_wc__db_t *db, 1486 const char *local_abspath, 1487 const apr_hash_t *props, 1488 const svn_skel_t *work_items, 1489 apr_pool_t *scratch_pool); 1490 1491 1492/* Add a symlink. 1493 PROPS gives the properties; empty or NULL means none. */ 1494/* ### do we need a CONFLICTS param? */ 1495svn_error_t * 1496svn_wc__db_op_add_symlink(svn_wc__db_t *db, 1497 const char *local_abspath, 1498 const char *target, 1499 const apr_hash_t *props, 1500 const svn_skel_t *work_items, 1501 apr_pool_t *scratch_pool); 1502 1503 1504/* Set the properties of the node LOCAL_ABSPATH in the ACTUAL tree to 1505 PROPS. 1506 1507 PROPS maps "const char *" names to "const svn_string_t *" values. 1508 To specify no properties, PROPS must be an empty hash, not NULL. 1509 If the node is not present, return an error. 1510 1511 If PROPS is NULL, set the properties to be the same as the pristine 1512 properties. 1513 1514 If CONFLICT is not NULL, it is used to register a conflict on this 1515 node at the same time the properties are changed. 1516 1517 WORK_ITEMS are inserted into the work queue, as additional things that 1518 need to be completed before the working copy is stable. 1519 1520 1521 If CLEAR_RECORDED_INFO is true, the recorded information for the node 1522 is cleared. (commonly used when updating svn:* magic properties). 1523 1524 NOTE: This will overwrite ALL working properties the node currently 1525 has. There is no db_op_set_prop() function. Callers must read all the 1526 properties, change one, and write all the properties. 1527 ### ugh. this has poor transaction semantics... 1528 1529 1530 NOTE: This will create an entry in the ACTUAL table for the node if it 1531 does not yet have one. 1532*/ 1533svn_error_t * 1534svn_wc__db_op_set_props(svn_wc__db_t *db, 1535 const char *local_abspath, 1536 apr_hash_t *props, 1537 svn_boolean_t clear_recorded_info, 1538 const svn_skel_t *conflict, 1539 const svn_skel_t *work_items, 1540 apr_pool_t *scratch_pool); 1541 1542/* Mark LOCAL_ABSPATH, and all children, for deletion. 1543 * 1544 * This function removes the file externals (and if DELETE_DIR_EXTERNALS is 1545 * TRUE also the directory externals) registered below LOCAL_ABSPATH. 1546 * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes) 1547 * 1548 * If MOVED_TO_ABSPATH is not NULL, mark the deletion of LOCAL_ABSPATH 1549 * as the delete-half of a move from LOCAL_ABSPATH to MOVED_TO_ABSPATH. 1550 * 1551 * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON) 1552 * for each node deleted. While this processing occurs, if CANCEL_FUNC is 1553 * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation 1554 * during the processing. 1555 * 1556 * Note: the notification (and cancellation) occur outside of a SQLite 1557 * transaction. 1558 */ 1559svn_error_t * 1560svn_wc__db_op_delete(svn_wc__db_t *db, 1561 const char *local_abspath, 1562 const char *moved_to_abspath, 1563 svn_boolean_t delete_dir_externals, 1564 svn_skel_t *conflict, 1565 svn_skel_t *work_items, 1566 svn_cancel_func_t cancel_func, 1567 void *cancel_baton, 1568 svn_wc_notify_func2_t notify_func, 1569 void *notify_baton, 1570 apr_pool_t *scratch_pool); 1571 1572 1573/* Mark all LOCAL_ABSPATH in the TARGETS array, and all of their children, 1574 * for deletion. 1575 * 1576 * This function is more efficient than svn_wc__db_op_delete() because 1577 * only one sqlite transaction is used for all targets. 1578 * It currently lacks support for moves (though this could be changed, 1579 * at which point svn_wc__db_op_delete() becomes redundant). 1580 * 1581 * This function removes the file externals (and if DELETE_DIR_EXTERNALS is 1582 * TRUE also the directory externals) registered below the targets. 1583 * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes) 1584 * 1585 * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON) 1586 * for each node deleted. While this processing occurs, if CANCEL_FUNC is 1587 * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation 1588 * during the processing. 1589 * 1590 * Note: the notification (and cancellation) occur outside of a SQLite 1591 * transaction. 1592 */ 1593svn_error_t * 1594svn_wc__db_op_delete_many(svn_wc__db_t *db, 1595 apr_array_header_t *targets, 1596 svn_boolean_t delete_dir_externals, 1597 const svn_skel_t *conflict, 1598 svn_cancel_func_t cancel_func, 1599 void *cancel_baton, 1600 svn_wc_notify_func2_t notify_func, 1601 void *notify_baton, 1602 apr_pool_t *scratch_pool); 1603 1604 1605/* ### mark PATH as (possibly) modified. "svn edit" ... right API here? */ 1606svn_error_t * 1607svn_wc__db_op_modified(svn_wc__db_t *db, 1608 const char *local_abspath, 1609 apr_pool_t *scratch_pool); 1610 1611 1612/* ### use NULL to remove from a changelist. 1613 1614 ### NOTE: only depth=svn_depth_empty is supported right now. 1615 */ 1616svn_error_t * 1617svn_wc__db_op_set_changelist(svn_wc__db_t *db, 1618 const char *local_abspath, 1619 const char *new_changelist, 1620 const apr_array_header_t *changelist_filter, 1621 svn_depth_t depth, 1622 /* ### flip to CANCEL, then NOTIFY. precedent. */ 1623 svn_wc_notify_func2_t notify_func, 1624 void *notify_baton, 1625 svn_cancel_func_t cancel_func, 1626 void *cancel_baton, 1627 apr_pool_t *scratch_pool); 1628 1629/* Record CONFLICT on LOCAL_ABSPATH, potentially replacing other conflicts 1630 recorded on LOCAL_ABSPATH. 1631 1632 Users should in most cases pass CONFLICT to another WC_DB call instead of 1633 calling svn_wc__db_op_mark_conflict() directly outside a transaction, to 1634 allow recording atomically with the operation involved. 1635 1636 Any work items that are necessary as part of marking this node conflicted 1637 can be passed in WORK_ITEMS. 1638 */ 1639svn_error_t * 1640svn_wc__db_op_mark_conflict(svn_wc__db_t *db, 1641 const char *local_abspath, 1642 const svn_skel_t *conflict, 1643 const svn_skel_t *work_items, 1644 apr_pool_t *scratch_pool); 1645 1646 1647/* ### caller maintains ACTUAL, and how the resolution occurred. we're just 1648 ### recording state. 1649 ### 1650 ### I'm not sure that these three values are the best way to do this, 1651 ### but they're handy for now. */ 1652svn_error_t * 1653svn_wc__db_op_mark_resolved(svn_wc__db_t *db, 1654 const char *local_abspath, 1655 svn_boolean_t resolved_text, 1656 svn_boolean_t resolved_props, 1657 svn_boolean_t resolved_tree, 1658 const svn_skel_t *work_items, 1659 apr_pool_t *scratch_pool); 1660 1661 1662/* Revert all local changes which are being maintained in the database, 1663 * including conflict storage, properties and text modification status. 1664 * 1665 * Returns SVN_ERR_WC_INVALID_OPERATION_DEPTH if the revert is not 1666 * possible, e.g. copy/delete but not a root, or a copy root with 1667 * children. 1668 * 1669 * At present only depth=empty and depth=infinity are supported. 1670 * 1671 * If @a clear_changelists is FALSE then changelist information is kept, 1672 * otherwise it is cleared. 1673 * 1674 * This function populates the revert list that can be queried to 1675 * determine what was reverted. 1676 */ 1677svn_error_t * 1678svn_wc__db_op_revert(svn_wc__db_t *db, 1679 const char *local_abspath, 1680 svn_depth_t depth, 1681 svn_boolean_t clear_changelists, 1682 apr_pool_t *result_pool, 1683 apr_pool_t *scratch_pool); 1684 1685/* Query the revert list for LOCAL_ABSPATH and set *REVERTED if the 1686 * path was reverted. Set *MARKER_FILES to a const char *list of 1687 * marker files if any were recorded on LOCAL_ABSPATH. 1688 * 1689 * Set *COPIED_HERE if the reverted node was copied here and is the 1690 * operation root of the copy. 1691 * Set *KIND to the node kind of the reverted node. 1692 * 1693 * Removes the row for LOCAL_ABSPATH from the revert list. 1694 */ 1695svn_error_t * 1696svn_wc__db_revert_list_read(svn_boolean_t *reverted, 1697 const apr_array_header_t **marker_files, 1698 svn_boolean_t *copied_here, 1699 svn_node_kind_t *kind, 1700 svn_wc__db_t *db, 1701 const char *local_abspath, 1702 apr_pool_t *result_pool, 1703 apr_pool_t *scratch_pool); 1704 1705/* The type of elements in the array returned by 1706 * svn_wc__db_revert_list_read_copied_children(). */ 1707typedef struct svn_wc__db_revert_list_copied_child_info_t { 1708 const char *abspath; 1709 svn_node_kind_t kind; 1710} svn_wc__db_revert_list_copied_child_info_t ; 1711 1712/* Return in *CHILDREN a list of reverted copied nodes at or within 1713 * LOCAL_ABSPATH (which is a reverted file or a reverted directory). 1714 * Allocate *COPIED_CHILDREN and its elements in RESULT_POOL. 1715 * The elements are of type svn_wc__db_revert_list_copied_child_info_t. */ 1716svn_error_t * 1717svn_wc__db_revert_list_read_copied_children(apr_array_header_t **children, 1718 svn_wc__db_t *db, 1719 const char *local_abspath, 1720 apr_pool_t *result_pool, 1721 apr_pool_t *scratch_pool); 1722 1723 1724/* Make revert notifications for all paths in the revert list that are 1725 * equal to LOCAL_ABSPATH or below LOCAL_ABSPATH. 1726 * 1727 * Removes all the corresponding rows from the revert list. 1728 * 1729 * ### Pass in cancel_func? 1730 */ 1731svn_error_t * 1732svn_wc__db_revert_list_notify(svn_wc_notify_func2_t notify_func, 1733 void *notify_baton, 1734 svn_wc__db_t *db, 1735 const char *local_abspath, 1736 apr_pool_t *scratch_pool); 1737 1738/* Clean up after svn_wc__db_op_revert by removing the revert list. 1739 */ 1740svn_error_t * 1741svn_wc__db_revert_list_done(svn_wc__db_t *db, 1742 const char *local_abspath, 1743 apr_pool_t *scratch_pool); 1744 1745/* ### status */ 1746 1747 1748/* @} */ 1749 1750/* @defgroup svn_wc__db_read Read operations on the BASE/WORKING tree 1751 @{ 1752 1753 These functions query information about nodes in ACTUAL, and returns 1754 the requested information from the appropriate ACTUAL, WORKING, or 1755 BASE tree. 1756 1757 For example, asking for the checksum of the pristine version will 1758 return the one recorded in WORKING, or if no WORKING node exists, then 1759 the checksum comes from BASE. 1760*/ 1761 1762/* Retrieve information about a node. 1763 1764 For the node implied by LOCAL_ABSPATH from the local filesystem, return 1765 information in the provided OUT parameters. Each OUT parameter may be 1766 NULL, indicating that specific item is not requested. 1767 1768 The information returned comes from the BASE tree, as possibly modified 1769 by the WORKING and ACTUAL trees. 1770 1771 If there is no information about the node, then SVN_ERR_WC_PATH_NOT_FOUND 1772 will be returned. 1773 1774 The OUT parameters, and their "not available" values are: 1775 STATUS n/a (always available) 1776 KIND svn_node_unknown (For ACTUAL only nodes) 1777 REVISION SVN_INVALID_REVNUM 1778 REPOS_RELPATH NULL 1779 REPOS_ROOT_URL NULL 1780 REPOS_UUID NULL 1781 CHANGED_REV SVN_INVALID_REVNUM 1782 CHANGED_DATE 0 1783 CHANGED_AUTHOR NULL 1784 DEPTH svn_depth_unknown 1785 CHECKSUM NULL 1786 TARGET NULL 1787 1788 ORIGINAL_REPOS_RELPATH NULL 1789 ORIGINAL_ROOT_URL NULL 1790 ORIGINAL_UUID NULL 1791 ORIGINAL_REVISION SVN_INVALID_REVNUM 1792 1793 LOCK NULL 1794 1795 RECORDED_SIZE SVN_INVALID_FILESIZE 1796 RECORDED_TIME 0 1797 1798 CHANGELIST NULL 1799 CONFLICTED FALSE 1800 1801 OP_ROOT FALSE 1802 HAD_PROPS FALSE 1803 PROPS_MOD FALSE 1804 1805 HAVE_BASE FALSE 1806 HAVE_MORE_WORK FALSE 1807 HAVE_WORK FALSE 1808 1809 When STATUS is requested, then it will be one of these values: 1810 1811 svn_wc__db_status_normal 1812 A plain BASE node, with no local changes. 1813 1814 svn_wc__db_status_added 1815 A node has been added/copied/moved to here. See HAVE_BASE to see 1816 if this change overwrites a BASE node. Use scan_addition() to resolve 1817 whether this has been added, copied, or moved, and the details of the 1818 operation (this function only looks at LOCAL_ABSPATH, but resolving 1819 the details requires scanning one or more ancestor nodes). 1820 1821 svn_wc__db_status_deleted 1822 This node has been deleted or moved away. It may be a delete/move of 1823 a BASE node, or a child node of a subtree that was copied/moved to 1824 an ancestor location. Call scan_deletion() to determine the full 1825 details of the operations upon this node. 1826 1827 svn_wc__db_status_server_excluded 1828 The node is versioned/known by the server, but the server has 1829 decided not to provide further information about the node. This 1830 is a BASE node (since changes are not allowed to this node). 1831 1832 svn_wc__db_status_excluded 1833 The node has been excluded from the working copy tree. This may 1834 be an exclusion from the BASE tree, or an exclusion in the 1835 WORKING tree for a child node of a copied/moved parent. 1836 1837 svn_wc__db_status_not_present 1838 This is a node from the BASE tree, has been marked as "not-present" 1839 within this mixed-revision working copy. This node is at a revision 1840 that is not in the tree, contrary to its inclusion in the parent 1841 node's revision. 1842 1843 svn_wc__db_status_incomplete 1844 The BASE is incomplete due to an interrupted operation. An 1845 incomplete WORKING node will be svn_wc__db_status_added. 1846 1847 If REVISION is requested, it will be set to the revision of the 1848 unmodified (BASE) node, or to SVN_INVALID_REVNUM if any structural 1849 changes have been made to that node (that is, if the node has a row in 1850 the WORKING table). 1851 1852 If DEPTH is requested, and the node is NOT a directory, then 1853 the value will be set to svn_depth_unknown. 1854 1855 If CHECKSUM is requested, and the node is NOT a file, then it will 1856 be set to NULL. 1857 1858 If TARGET is requested, and the node is NOT a symlink, then it will 1859 be set to NULL. 1860 1861 If TRANSLATED_SIZE is requested, and the node is NOT a file, then 1862 it will be set to SVN_INVALID_FILESIZE. 1863 1864 If HAVE_WORK is TRUE, the returned information is from the highest WORKING 1865 layer. In that case HAVE_MORE_WORK and HAVE_BASE provide information about 1866 what other layers exist for this node. 1867 1868 If HAVE_WORK is FALSE and HAVE_BASE is TRUE then the information is from 1869 the BASE tree. 1870 1871 If HAVE_WORK and HAVE_BASE are both FALSE and when retrieving CONFLICTED, 1872 then the node doesn't exist at all. 1873 1874 If OP_ROOT is requested and the node has a WORKING layer, OP_ROOT will be 1875 set to true if this node is the op_root for this layer. 1876 1877 If HAD_PROPS is requested and the node has pristine props, the value will 1878 be set to TRUE. 1879 1880 If PROPS_MOD is requested and the node has property modification the value 1881 will be set to TRUE. 1882 1883 ### add information about the need to scan upwards to get a complete 1884 ### picture of the state of this node. 1885 1886 ### add some documentation about OUT parameter values based on STATUS ?? 1887 1888 ### the TEXT_MOD may become an enumerated value at some point to 1889 ### indicate different states of knowledge about text modifications. 1890 ### for example, an "svn edit" command in the future might set a 1891 ### flag indicating administratively-defined modification. and/or we 1892 ### might have a status indicating that we saw it was modified while 1893 ### performing a filesystem traversal. 1894 1895 All returned data will be allocated in RESULT_POOL. All temporary 1896 allocations will be made in SCRATCH_POOL. 1897*/ 1898/* ### old docco. needs to be incorporated as appropriate. there is 1899 ### some pending, potential changes to the definition of this API, 1900 ### so not worrying about it just yet. 1901 1902 ### if the node has not been committed (after adding): 1903 ### revision will be SVN_INVALID_REVNUM 1904 ### repos_* will be NULL 1905 ### changed_rev will be SVN_INVALID_REVNUM 1906 ### changed_date will be 0 1907 ### changed_author will be NULL 1908 ### status will be svn_wc__db_status_added 1909 ### text_mod will be TRUE 1910 ### prop_mod will be TRUE if any props have been set 1911 ### base_shadowed will be FALSE 1912 1913 ### if the node is not a copy, or a move destination: 1914 ### original_repos_path will be NULL 1915 ### original_root_url will be NULL 1916 ### original_uuid will be NULL 1917 ### original_revision will be SVN_INVALID_REVNUM 1918 1919 ### note that @a base_shadowed can be derived. if the status specifies 1920 ### an add/copy/move *and* there is a corresponding node in BASE, then 1921 ### the BASE has been deleted to open the way for this node. 1922*/ 1923svn_error_t * 1924svn_wc__db_read_info(svn_wc__db_status_t *status, /* ### derived */ 1925 svn_node_kind_t *kind, 1926 svn_revnum_t *revision, 1927 const char **repos_relpath, 1928 const char **repos_root_url, 1929 const char **repos_uuid, 1930 svn_revnum_t *changed_rev, 1931 apr_time_t *changed_date, 1932 const char **changed_author, 1933 svn_depth_t *depth, /* dirs only */ 1934 const svn_checksum_t **checksum, /* files only */ 1935 const char **target, /* symlinks only */ 1936 1937 /* ### the following fields if copied/moved (history) */ 1938 const char **original_repos_relpath, 1939 const char **original_root_url, 1940 const char **original_uuid, 1941 svn_revnum_t *original_revision, 1942 1943 /* For BASE nodes */ 1944 svn_wc__db_lock_t **lock, 1945 1946 /* Recorded for files present in the working copy */ 1947 svn_filesize_t *recorded_size, 1948 apr_time_t *recorded_time, 1949 1950 /* From ACTUAL */ 1951 const char **changelist, 1952 svn_boolean_t *conflicted, 1953 1954 /* ### the followed are derived fields */ 1955 svn_boolean_t *op_root, 1956 1957 svn_boolean_t *had_props, 1958 svn_boolean_t *props_mod, 1959 1960 svn_boolean_t *have_base, 1961 svn_boolean_t *have_more_work, 1962 svn_boolean_t *have_work, 1963 1964 svn_wc__db_t *db, 1965 const char *local_abspath, 1966 apr_pool_t *result_pool, 1967 apr_pool_t *scratch_pool); 1968 1969/* Structure used as linked list in svn_wc__db_info_t to describe all nodes 1970 in this location that were moved to another location */ 1971struct svn_wc__db_moved_to_info_t 1972{ 1973 const char *moved_to_abspath; 1974 const char *shadow_op_root_abspath; 1975 1976 struct svn_wc__db_moved_to_info_t *next; 1977}; 1978 1979/* Structure returned by svn_wc__db_read_children_info. Only has the 1980 fields needed by status. */ 1981struct svn_wc__db_info_t { 1982 svn_wc__db_status_t status; 1983 svn_node_kind_t kind; 1984 svn_revnum_t revnum; 1985 const char *repos_relpath; 1986 const char *repos_root_url; 1987 const char *repos_uuid; 1988 svn_revnum_t changed_rev; 1989 const char *changed_author; 1990 apr_time_t changed_date; 1991 svn_depth_t depth; 1992 1993 svn_filesize_t recorded_size; 1994 apr_time_t recorded_time; 1995 1996 const char *changelist; 1997 svn_boolean_t conflicted; 1998#ifdef HAVE_SYMLINK 1999 svn_boolean_t special; 2000#endif 2001 svn_boolean_t op_root; 2002 2003 svn_boolean_t has_checksum; 2004 svn_boolean_t copied; 2005 svn_boolean_t had_props; 2006 svn_boolean_t props_mod; 2007 2008 svn_boolean_t have_base; 2009 svn_boolean_t have_more_work; 2010 2011 svn_boolean_t locked; /* WC directory lock */ 2012 svn_wc__db_lock_t *lock; /* Repository file lock */ 2013 svn_boolean_t incomplete; /* TRUE if a working node is incomplete */ 2014 2015 struct svn_wc__db_moved_to_info_t *moved_to; /* A linked list of locations 2016 where nodes at this path 2017 are moved to. Highest layers 2018 first */ 2019 svn_boolean_t moved_here; /* Only on op-roots. */ 2020 2021 svn_boolean_t file_external; 2022 svn_boolean_t has_descendants; /* Is dir, or has tc descendants */ 2023}; 2024 2025/* Return in *NODES a hash mapping name->struct svn_wc__db_info_t for 2026 the children of DIR_ABSPATH, and in *CONFLICTS a hash of names in 2027 conflict. 2028 2029 The results include any path that was a child of a deleted directory that 2030 existed at LOCAL_ABSPATH, even if that directory is now scheduled to be 2031 replaced by the working node at LOCAL_ABSPATH. 2032 2033 If BASE_TREE_ONLY is set, only information about the BASE tree 2034 is returned. 2035 */ 2036svn_error_t * 2037svn_wc__db_read_children_info(apr_hash_t **nodes, 2038 apr_hash_t **conflicts, 2039 svn_wc__db_t *db, 2040 const char *dir_abspath, 2041 svn_boolean_t base_tree_only, 2042 apr_pool_t *result_pool, 2043 apr_pool_t *scratch_pool); 2044 2045/* Like svn_wc__db_read_children_info, but only gets an info node for the root 2046 element. 2047 2048 If BASE_TREE_ONLY is set, only information about the BASE tree 2049 is returned. */ 2050svn_error_t * 2051svn_wc__db_read_single_info(const struct svn_wc__db_info_t **info, 2052 svn_wc__db_t *db, 2053 const char *local_abspath, 2054 svn_boolean_t base_tree_only, 2055 apr_pool_t *result_pool, 2056 apr_pool_t *scratch_pool); 2057 2058/* Structure returned by svn_wc__db_read_walker_info. Only has the 2059 fields needed by svn_wc__internal_walk_children(). */ 2060struct svn_wc__db_walker_info_t { 2061 const char *name; 2062 svn_wc__db_status_t status; 2063 svn_node_kind_t kind; 2064}; 2065 2066/* When a node is deleted in WORKING, some of its information is no longer 2067 available. But in some cases it might still be relevant to obtain this 2068 information even when the information isn't stored in the BASE tree. 2069 2070 This function allows access to that specific information. 2071 2072 When a node is not deleted, this node returns the same information 2073 as svn_wc__db_read_info(). 2074 2075 All output arguments are optional and behave in the same way as when 2076 calling svn_wc__db_read_info(). 2077 2078 (All other information (like original_*) can be obtained via other apis). 2079 2080 *PROPS maps "const char *" names to "const svn_string_t *" values. If 2081 the pristine node is capable of having properties but has none, set 2082 *PROPS to an empty hash. If its status is such that it cannot have 2083 properties, set *PROPS to NULL. 2084 */ 2085svn_error_t * 2086svn_wc__db_read_pristine_info(svn_wc__db_status_t *status, 2087 svn_node_kind_t *kind, 2088 svn_revnum_t *changed_rev, 2089 apr_time_t *changed_date, 2090 const char **changed_author, 2091 svn_depth_t *depth, /* dirs only */ 2092 const svn_checksum_t **checksum, /* files only */ 2093 const char **target, /* symlinks only */ 2094 svn_boolean_t *had_props, 2095 apr_hash_t **props, 2096 svn_wc__db_t *db, 2097 const char *local_abspath, 2098 apr_pool_t *result_pool, 2099 apr_pool_t *scratch_pool); 2100 2101/* Gets the information required to install a pristine file to the working copy 2102 2103 Set WCROOT_ABSPATH to the working copy root, SHA1_CHECKSUM to the 2104 checksum of the node (a valid reference into the pristine store) 2105 and PRISTINE_PROPS to the node's pristine properties (to use for 2106 installing the file). 2107 2108 If WRI_ABSPATH is not NULL, check for information in the working copy 2109 identified by WRI_ABSPATH. 2110 */ 2111svn_error_t * 2112svn_wc__db_read_node_install_info(const char **wcroot_abspath, 2113 const svn_checksum_t **sha1_checksum, 2114 apr_hash_t **pristine_props, 2115 apr_time_t *changed_date, 2116 svn_wc__db_t *db, 2117 const char *local_abspath, 2118 const char *wri_abspath, 2119 apr_pool_t *result_pool, 2120 apr_pool_t *scratch_pool); 2121 2122/* Return in *ITEMS an array of struct svn_wc__db_walker_info_t* for 2123 the direct children of DIR_ABSPATH. */ 2124svn_error_t * 2125svn_wc__db_read_children_walker_info(const apr_array_header_t **items, 2126 svn_wc__db_t *db, 2127 const char *dir_abspath, 2128 apr_pool_t *result_pool, 2129 apr_pool_t *scratch_pool); 2130 2131 2132/** 2133 * Set *revision, *repos_relpath, *repos_root_url, *repos_uuid to 2134 * the intended/commit location of LOCAL_ABSPATH. These arguments may be 2135 * NULL if they are not needed. 2136 * 2137 * If the node is deleted, return the url it would have in the repository 2138 * if it wouldn't be deleted. If the node is added return the url it will 2139 * have in the repository, once committed. 2140 * 2141 * If the node is not added and has an existing repository location, set 2142 * revision to its existing revision, otherwise to SVN_INVALID_REVNUM. 2143 */ 2144svn_error_t * 2145svn_wc__db_read_repos_info(svn_revnum_t *revision, 2146 const char **repos_relpath, 2147 const char **repos_root_url, 2148 const char **repos_uuid, 2149 svn_wc__db_t *db, 2150 const char *local_abspath, 2151 apr_pool_t *result_pool, 2152 apr_pool_t *scratch_pool); 2153 2154 2155/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the ACTUAL 2156 tree (looking through to the WORKING or BASE tree as required). 2157 2158 ### *PROPS will be set to NULL in the following situations: 2159 ### ... tbd 2160 2161 PROPS maps "const char *" names to "const svn_string_t *" values. 2162 If the node has no properties, set *PROPS to an empty hash. 2163 If the node is not present, return an error. 2164 Allocate *PROPS and its keys and values in RESULT_POOL. 2165*/ 2166svn_error_t * 2167svn_wc__db_read_props(apr_hash_t **props, 2168 svn_wc__db_t *db, 2169 const char *local_abspath, 2170 apr_pool_t *result_pool, 2171 apr_pool_t *scratch_pool); 2172 2173/* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and 2174 * a hash table mapping <tt>char *</tt> names onto svn_string_t * 2175 * values for any properties of child nodes of LOCAL_ABSPATH (up to DEPTH). 2176 * 2177 * If PRISTINE is FALSE, read the properties from the WORKING layer (highest 2178 * op_depth); if PRISTINE is FALSE, local modifications will be visible. 2179 */ 2180svn_error_t * 2181svn_wc__db_read_props_streamily(svn_wc__db_t *db, 2182 const char *local_abspath, 2183 svn_depth_t depth, 2184 svn_boolean_t pristine, 2185 const apr_array_header_t *changelists, 2186 svn_wc__proplist_receiver_t receiver_func, 2187 void *receiver_baton, 2188 svn_cancel_func_t cancel_func, 2189 void *cancel_baton, 2190 apr_pool_t *scratch_pool); 2191 2192 2193/* Set *PROPS to the base properties of the node at LOCAL_ABSPATH. 2194 2195 *PROPS maps "const char *" names to "const svn_string_t *" values. 2196 If the node has no properties, set *PROPS to an empty hash. 2197 If the base node is in a state that cannot have properties (such as 2198 not-present or locally added without copy-from), return an error. 2199 2200 Allocate *PROPS and its keys and values in RESULT_POOL. 2201 2202 See also svn_wc_get_pristine_props(). 2203*/ 2204svn_error_t * 2205svn_wc__db_read_pristine_props(apr_hash_t **props, 2206 svn_wc__db_t *db, 2207 const char *local_abspath, 2208 apr_pool_t *result_pool, 2209 apr_pool_t *scratch_pool); 2210 2211 2212/** 2213 * Set @a *iprops to a depth-first ordered array of 2214 * #svn_prop_inherited_item_t * structures representing the properties 2215 * inherited by @a local_abspath from the ACTUAL tree above 2216 * @a local_abspath (looking through to the WORKING or BASE tree as 2217 * required), up to and including the root of the working copy and 2218 * any cached inherited properties inherited by the root. 2219 * 2220 * The #svn_prop_inherited_item_t->path_or_url members of the 2221 * #svn_prop_inherited_item_t * structures in @a *iprops are 2222 * paths relative to the repository root URL for cached inherited 2223 * properties and absolute working copy paths otherwise. 2224 * 2225 * If ACTUAL_PROPS is not NULL, then set *ACTUAL_PROPS to ALL the actual 2226 * properties stored on LOCAL_ABSPATH. 2227 * 2228 * Allocate @a *iprops in @a result_pool. Use @a scratch_pool 2229 * for temporary allocations. 2230 */ 2231svn_error_t * 2232svn_wc__db_read_inherited_props(apr_array_header_t **iprops, 2233 apr_hash_t **actual_props, 2234 svn_wc__db_t *db, 2235 const char *local_abspath, 2236 const char *propname, 2237 apr_pool_t *result_pool, 2238 apr_pool_t *scratch_pool); 2239 2240/* Read a BASE node's inherited property information. 2241 2242 Set *IPROPS to to a depth-first ordered array of 2243 svn_prop_inherited_item_t * structures representing the cached 2244 inherited properties for the BASE node at LOCAL_ABSPATH. 2245 2246 If no cached properties are found, then set *IPROPS to NULL. 2247 If LOCAL_ABSPATH represents the root of the repository, then set 2248 *IPROPS to an empty array. 2249 2250 Allocate *IPROPS in RESULT_POOL, use SCRATCH_POOL for temporary 2251 allocations. */ 2252svn_error_t * 2253svn_wc__db_read_cached_iprops(apr_array_header_t **iprops, 2254 svn_wc__db_t *db, 2255 const char *local_abspath, 2256 apr_pool_t *result_pool, 2257 apr_pool_t *scratch_pool); 2258 2259/* Find BASE nodes with cached inherited properties. 2260 2261 Set *IPROPS_PATHS to a hash mapping const char * absolute working copy 2262 paths to the repos_relpath of the path for each path in the working copy 2263 at or below LOCAL_ABSPATH, limited by DEPTH, that has cached inherited 2264 properties for the BASE node of the path. 2265 2266 Allocate *IPROP_PATHS in RESULT_POOL. 2267 Use SCRATCH_POOL for temporary allocations. */ 2268svn_error_t * 2269svn_wc__db_get_children_with_cached_iprops(apr_hash_t **iprop_paths, 2270 svn_depth_t depth, 2271 const char *local_abspath, 2272 svn_wc__db_t *db, 2273 apr_pool_t *result_pool, 2274 apr_pool_t *scratch_pool); 2275 2276/** Obtain a mapping of const char * local_abspaths to const svn_string_t* 2277 * property values in *VALUES, of all PROPNAME properties on LOCAL_ABSPATH 2278 * and its descendants. 2279 * 2280 * Allocate the result in RESULT_POOL, and perform temporary allocations in 2281 * SCRATCH_POOL. 2282 */ 2283svn_error_t * 2284svn_wc__db_prop_retrieve_recursive(apr_hash_t **values, 2285 svn_wc__db_t *db, 2286 const char *local_abspath, 2287 const char *propname, 2288 apr_pool_t *result_pool, 2289 apr_pool_t *scratch_pool); 2290 2291/* Set *CHILDREN to a new array of the (const char *) basenames of the 2292 immediate children of the working node at LOCAL_ABSPATH in DB. 2293 2294 Return every path that refers to a child of the working node at 2295 LOCAL_ABSPATH. Do not include a path just because it was a child of a 2296 deleted directory that existed at LOCAL_ABSPATH if that directory is now 2297 scheduled to be replaced by the working node at LOCAL_ABSPATH. 2298 2299 Allocate *CHILDREN in RESULT_POOL and do temporary allocations in 2300 SCRATCH_POOL. 2301 2302 ### return some basic info for each child? e.g. kind. 2303 ### maybe the data in _read_get_info should be a structure, and this 2304 ### can return a struct for each one. 2305 ### however: _read_get_info can say "not interested", which isn't the 2306 ### case with a struct. thus, a struct requires fetching and/or 2307 ### computing all info. 2308*/ 2309svn_error_t * 2310svn_wc__db_read_children_of_working_node(const apr_array_header_t **children, 2311 svn_wc__db_t *db, 2312 const char *local_abspath, 2313 apr_pool_t *result_pool, 2314 apr_pool_t *scratch_pool); 2315 2316svn_error_t * 2317svn_wc__db_base_read_not_present_children( 2318 const apr_array_header_t **children, 2319 svn_wc__db_t *db, 2320 const char *local_abspath, 2321 apr_pool_t *result_pool, 2322 apr_pool_t *scratch_pool); 2323 2324/* Like svn_wc__db_read_children_of_working_node(), except also include any 2325 path that was a child of a deleted directory that existed at 2326 LOCAL_ABSPATH, even if that directory is now scheduled to be replaced by 2327 the working node at LOCAL_ABSPATH. 2328*/ 2329svn_error_t * 2330svn_wc__db_read_children(const apr_array_header_t **children, 2331 svn_wc__db_t *db, 2332 const char *local_abspath, 2333 apr_pool_t *result_pool, 2334 apr_pool_t *scratch_pool); 2335 2336/* Read into *VICTIMS the basenames of the immediate children of 2337 LOCAL_ABSPATH in DB that are conflicted. 2338 2339 In case of tree conflicts a victim doesn't have to be in the 2340 working copy. 2341 2342 Allocate *VICTIMS in RESULT_POOL and do temporary allocations in 2343 SCRATCH_POOL */ 2344/* ### This function will probably be removed. */ 2345svn_error_t * 2346svn_wc__db_read_conflict_victims(const apr_array_header_t **victims, 2347 svn_wc__db_t *db, 2348 const char *local_abspath, 2349 apr_pool_t *result_pool, 2350 apr_pool_t *scratch_pool); 2351 2352/* Read into *MARKER_FILES the absolute paths of the marker files 2353 of conflicts stored on LOCAL_ABSPATH and its immediate children in DB. 2354 The on-disk files may have been deleted by the user. 2355 2356 Allocate *MARKER_FILES in RESULT_POOL and do temporary allocations 2357 in SCRATCH_POOL */ 2358svn_error_t * 2359svn_wc__db_get_conflict_marker_files(apr_hash_t **markers, 2360 svn_wc__db_t *db, 2361 const char *local_abspath, 2362 apr_pool_t *result_pool, 2363 apr_pool_t *scratch_pool); 2364 2365/* Read the conflict information recorded on LOCAL_ABSPATH in *CONFLICT, 2366 an editable conflict skel. If kind is not NULL, also read the node kind 2367 in *KIND. (SHOW_HIDDEN: false, SHOW_DELETED: true). If props is not NULL 2368 read the actual properties in this value if they exist. (Set to NULL in case 2369 the node is deleted, etc.) 2370 2371 If the node exists, but does not have a conflict set *CONFLICT to NULL, 2372 otherwise return a SVN_ERR_WC_PATH_NOT_FOUND error. 2373 2374 Allocate *CONFLICTS in RESULT_POOL and do temporary allocations in 2375 SCRATCH_POOL */ 2376svn_error_t * 2377svn_wc__db_read_conflict(svn_skel_t **conflict, 2378 svn_node_kind_t *kind, 2379 apr_hash_t **props, 2380 svn_wc__db_t *db, 2381 const char *local_abspath, 2382 apr_pool_t *result_pool, 2383 apr_pool_t *scratch_pool); 2384 2385 2386/* Return the kind of the node in DB at LOCAL_ABSPATH. The WORKING tree will 2387 be examined first, then the BASE tree. If the node is not present in either 2388 tree and ALLOW_MISSING is TRUE, then svn_node_unknown is returned. 2389 If the node is missing and ALLOW_MISSING is FALSE, then it will return 2390 SVN_ERR_WC_PATH_NOT_FOUND. 2391 2392 The SHOW_HIDDEN and SHOW_DELETED flags report certain states as kind none. 2393 2394 When nodes have certain statee they are only reported when: 2395 svn_wc__db_status_not_present when show_hidden && show_deleted 2396 2397 svn_wc__db_status_excluded when show_hidden 2398 svn_wc__db_status_server_excluded when show_hidden 2399 2400 svn_wc__db_status_deleted when show_deleted 2401 2402 In other cases these nodes are reported with *KIND as svn_node_none. 2403 (See also svn_wc_read_kind2()'s documentation) 2404 2405 Uses SCRATCH_POOL for temporary allocations. */ 2406svn_error_t * 2407svn_wc__db_read_kind(svn_node_kind_t *kind, 2408 svn_wc__db_t *db, 2409 const char *local_abspath, 2410 svn_boolean_t allow_missing, 2411 svn_boolean_t show_deleted, 2412 svn_boolean_t show_hidden, 2413 apr_pool_t *scratch_pool); 2414 2415/* Checks if a node replaces a node in a different layer. Also check if it 2416 replaces a BASE (op_depth 0) node or just a node in a higher layer (a copy). 2417 Finally check if this is the root of the replacement, or if the replacement 2418 is initiated by the parent node. 2419 2420 IS_REPLACE_ROOT (if not NULL) is set to TRUE if the node is the root of a 2421 replacement; otherwise to FALSE. 2422 2423 BASE_REPLACE (if not NULL) is set to TRUE if the node directly or indirectly 2424 replaces a node in the BASE tree; otherwise to FALSE. 2425 2426 IS_REPLACE (if not NULL) is set to TRUE if the node directly replaces a node 2427 in a lower layer; otherwise to FALSE. 2428 */ 2429svn_error_t * 2430svn_wc__db_node_check_replace(svn_boolean_t *is_replace_root, 2431 svn_boolean_t *base_replace, 2432 svn_boolean_t *is_replace, 2433 svn_wc__db_t *db, 2434 const char *local_abspath, 2435 apr_pool_t *scratch_pool); 2436 2437/* ### changelists. return an array, or an iterator interface? how big 2438 ### are these things? are we okay with an in-memory array? examine other 2439 ### changelist usage -- we may already assume the list fits in memory. 2440*/ 2441 2442/* The DB-private version of svn_wc__is_wcroot(), which see. 2443 */ 2444svn_error_t * 2445svn_wc__db_is_wcroot(svn_boolean_t *is_wcroot, 2446 svn_wc__db_t *db, 2447 const char *local_abspath, 2448 apr_pool_t *scratch_pool); 2449 2450/* Check whether a node is a working copy root and/or switched. 2451 2452 If LOCAL_ABSPATH is the root of a working copy, set *IS_WC_ROOT to TRUE, 2453 otherwise to FALSE. 2454 2455 If LOCAL_ABSPATH is switched against its parent in the same working copy 2456 set *IS_SWITCHED to TRUE, otherwise to FALSE. 2457 2458 If KIND is not null, set *KIND to the node type of LOCAL_ABSPATH. 2459 2460 Any of the output arguments can be null to specify that the result is not 2461 interesting to the caller. 2462 2463 Use SCRATCH_POOL for temporary allocations. 2464 */ 2465svn_error_t * 2466svn_wc__db_is_switched(svn_boolean_t *is_wcroot, 2467 svn_boolean_t *is_switched, 2468 svn_node_kind_t *kind, 2469 svn_wc__db_t *db, 2470 const char *local_abspath, 2471 apr_pool_t *scratch_pool); 2472 2473 2474/* @} */ 2475 2476 2477/* @defgroup svn_wc__db_global Operations that alter multiple trees 2478 @{ 2479*/ 2480 2481/* Associate LOCAL_DIR_ABSPATH, and all its children with the repository at 2482 at REPOS_ROOT_URL. The relative path to the repos root will not change, 2483 just the repository root. The repos uuid will also remain the same. 2484 This also updates any locks which may exist for the node, as well as any 2485 copyfrom repository information. Finally, the DAV cache (aka 2486 "wcprops") will be reset for affected entries. 2487 2488 Use SCRATCH_POOL for any temporary allocations. 2489 2490 ### local_dir_abspath "should be" the wcroot or a switch root. all URLs 2491 ### under this directory (depth=infinity) will be rewritten. 2492 2493 ### This API had a depth parameter, which was removed, should it be 2494 ### resurrected? What's the purpose if we claim relocate is infinitely 2495 ### recursive? 2496 2497 ### Assuming the future ability to copy across repositories, should we 2498 ### refrain from resetting the copyfrom information in this operation? 2499*/ 2500svn_error_t * 2501svn_wc__db_global_relocate(svn_wc__db_t *db, 2502 const char *local_dir_abspath, 2503 const char *repos_root_url, 2504 apr_pool_t *scratch_pool); 2505 2506 2507/* ### docco 2508 2509 ### collapse the WORKING and ACTUAL tree changes down into BASE, called 2510 for each committed node. 2511 2512 NEW_REVISION must be the revision number of the revision created by 2513 the commit. It will become the BASE node's 'revnum' and 'changed_rev' 2514 values in the BASE_NODE table. 2515 2516 CHANGED_REVISION is the new 'last changed' revision. If the node is 2517 modified its value is equivalent to NEW_REVISION, but in case of a 2518 descendant of a copy/move it can be an older revision. 2519 2520 CHANGED_DATE is the (server-side) date of CHANGED_REVISION. It may be 0 if 2521 the revprop is missing on the revision. 2522 2523 CHANGED_AUTHOR is the (server-side) author of CHANGED_REVISION. It may be 2524 NULL if the revprop is missing on the revision. 2525 2526 WORK_ITEMS will be place into the work queue. 2527*/ 2528svn_error_t * 2529svn_wc__db_global_commit(svn_wc__db_t *db, 2530 const char *local_abspath, 2531 svn_revnum_t new_revision, 2532 svn_revnum_t changed_revision, 2533 apr_time_t changed_date, 2534 const char *changed_author, 2535 const svn_checksum_t *new_checksum, 2536 apr_hash_t *new_dav_cache, 2537 svn_boolean_t keep_changelist, 2538 svn_boolean_t no_unlock, 2539 const svn_skel_t *work_items, 2540 apr_pool_t *scratch_pool); 2541 2542 2543/* ### docco 2544 2545 Perform an "update" operation at this node. It will create/modify a BASE 2546 node, and possibly update the ACTUAL tree's node (e.g put the node into 2547 a conflicted state). 2548 2549 ### there may be cases where we need to tweak an existing WORKING node 2550 2551 ### this operations on a single node, but may affect children 2552 2553 ### the repository cannot be changed with this function, but a "switch" 2554 ### (aka changing repos_relpath) is possible 2555 2556 ### one of NEW_CHILDREN, NEW_CHECKSUM, or NEW_TARGET must be provided. 2557 ### the other two values must be NULL. 2558 ### should this be broken out into an update_(directory|file|symlink) ? 2559 2560 ### how does this differ from base_add_*? just the CONFLICT param. 2561 ### the WORK_ITEMS param is new here, but the base_add_* functions 2562 ### should probably grow that. should we instead just (re)use base_add 2563 ### rather than grow a new function? 2564 2565 ### this does not allow a change of depth 2566 2567 ### we do not update a file's TRANSLATED_SIZE here. at some future point, 2568 ### when the file is installed, then a TRANSLATED_SIZE will be set. 2569*/ 2570svn_error_t * 2571svn_wc__db_global_update(svn_wc__db_t *db, 2572 const char *local_abspath, 2573 svn_node_kind_t new_kind, 2574 const char *new_repos_relpath, 2575 svn_revnum_t new_revision, 2576 const apr_hash_t *new_props, 2577 svn_revnum_t new_changed_rev, 2578 apr_time_t new_changed_date, 2579 const char *new_changed_author, 2580 const apr_array_header_t *new_children, 2581 const svn_checksum_t *new_checksum, 2582 const char *new_target, 2583 const apr_hash_t *new_dav_cache, 2584 const svn_skel_t *conflict, 2585 const svn_skel_t *work_items, 2586 apr_pool_t *scratch_pool); 2587 2588 2589/* Modify the entry of working copy LOCAL_ABSPATH, presumably after an update 2590 of depth DEPTH completes. If LOCAL_ABSPATH doesn't exist, this routine 2591 does nothing. 2592 2593 Set the node's repository relpath, repository root, repository uuid and 2594 revision to NEW_REPOS_RELPATH, NEW_REPOS_ROOT and NEW_REPOS_UUID. If 2595 NEW_REPOS_RELPATH is null, the repository location is untouched; if 2596 NEW_REVISION in invalid, the working revision field is untouched. 2597 The modifications are mutually exclusive. If NEW_REPOS_ROOT is non-NULL, 2598 set the repository root of the entry to NEW_REPOS_ROOT. 2599 2600 If LOCAL_ABSPATH is a directory, then, walk entries below LOCAL_ABSPATH 2601 according to DEPTH thusly: 2602 2603 If DEPTH is svn_depth_infinity, perform the following actions on 2604 every entry below PATH; if svn_depth_immediates, svn_depth_files, 2605 or svn_depth_empty, perform them only on LOCAL_ABSPATH. 2606 2607 If NEW_REVISION is valid, then tweak every entry to have this new 2608 working revision (excluding files that are scheduled for addition 2609 or replacement). Likewise, if BASE_URL is non-null, then rewrite 2610 all urls to be "telescoping" children of the base_url. 2611 2612 EXCLUDE_RELPATHS is a hash containing const char *local_relpath. Nodes 2613 for pathnames contained in EXCLUDE_RELPATHS are not touched by this 2614 function. These pathnames should be paths relative to the wcroot. 2615 2616 If EMPTY_UPDATE is TRUE then no nodes at or below LOCAL_ABSPATH have been 2617 affected by the update/switch yet. 2618 2619 If WCROOT_IPROPS is not NULL it is a hash mapping const char * absolute 2620 working copy paths to depth-first ordered arrays of 2621 svn_prop_inherited_item_t * structures. If LOCAL_ABSPATH exists in 2622 WCROOT_IPROPS, then set the hashed value as the node's inherited 2623 properties. 2624*/ 2625svn_error_t * 2626svn_wc__db_op_bump_revisions_post_update(svn_wc__db_t *db, 2627 const char *local_abspath, 2628 svn_depth_t depth, 2629 const char *new_repos_relpath, 2630 const char *new_repos_root_url, 2631 const char *new_repos_uuid, 2632 svn_revnum_t new_revision, 2633 apr_hash_t *exclude_relpaths, 2634 apr_hash_t *wcroot_iprops, 2635 svn_boolean_t empty_update, 2636 svn_wc_notify_func2_t notify_func, 2637 void *notify_baton, 2638 apr_pool_t *scratch_pool); 2639 2640 2641/* Record the RECORDED_SIZE and RECORDED_TIME for a versioned node. 2642 2643 This function will record the information within the WORKING node, 2644 if present, or within the BASE tree. If neither node is present, then 2645 SVN_ERR_WC_PATH_NOT_FOUND will be returned. 2646 2647 RECORDED_SIZE may be SVN_INVALID_FILESIZE, which will be recorded 2648 as such, implying "unknown size". 2649 2650 RECORDED_TIME may be 0, which will be recorded as such, implying 2651 "unknown last mod time". 2652*/ 2653svn_error_t * 2654svn_wc__db_global_record_fileinfo(svn_wc__db_t *db, 2655 const char *local_abspath, 2656 svn_filesize_t recorded_size, 2657 apr_time_t recorded_time, 2658 apr_pool_t *scratch_pool); 2659 2660 2661/* ### post-commit handling. 2662 ### maybe multiple phases? 2663 ### 1) mark a changelist as being-committed 2664 ### 2) collect ACTUAL content, store for future use as TEXTBASE 2665 ### 3) caller performs commit 2666 ### 4) post-commit, integrate changelist into BASE 2667*/ 2668 2669 2670/* @} */ 2671 2672 2673/* @defgroup svn_wc__db_lock Function to manage the LOCKS table. 2674 @{ 2675*/ 2676 2677/* Add or replace LOCK for LOCAL_ABSPATH to DB. */ 2678svn_error_t * 2679svn_wc__db_lock_add(svn_wc__db_t *db, 2680 const char *local_abspath, 2681 const svn_wc__db_lock_t *lock, 2682 apr_pool_t *scratch_pool); 2683 2684 2685/* Remove any lock for LOCAL_ABSPATH in DB and install WORK_ITEMS 2686 (if not NULL) in DB */ 2687svn_error_t * 2688svn_wc__db_lock_remove(svn_wc__db_t *db, 2689 const char *local_abspath, 2690 svn_skel_t *work_items, 2691 apr_pool_t *scratch_pool); 2692 2693 2694/* @} */ 2695 2696 2697/* @defgroup svn_wc__db_scan Functions to scan up a tree for further data. 2698 @{ 2699*/ 2700 2701/* Scan upwards for information about a known addition to the WORKING tree. 2702 2703 IFF a node's status as returned by svn_wc__db_read_info() is 2704 svn_wc__db_status_added (NOT obstructed_add!), then this function 2705 returns a refined status in *STATUS, which is one of: 2706 2707 svn_wc__db_status_added -- this NODE is a simple add without history. 2708 OP_ROOT_ABSPATH will be set to the topmost node in the added subtree 2709 (implying its parent will be an unshadowed BASE node). The REPOS_* 2710 values will be implied by that ancestor BASE node and this node's 2711 position in the added subtree. ORIGINAL_* will be set to their 2712 NULL values (and SVN_INVALID_REVNUM for ORIGINAL_REVISION). 2713 2714 svn_wc__db_status_copied -- this NODE is the root or child of a copy. 2715 The root of the copy will be stored in OP_ROOT_ABSPATH. Note that 2716 the parent of the operation root could be another WORKING node (from 2717 an add, copy, or move). The REPOS_* values will be implied by the 2718 ancestor unshadowed BASE node. ORIGINAL_* will indicate the source 2719 of the copy. 2720 2721 svn_wc__db_status_incomplete -- this NODE is copied but incomplete. 2722 2723 svn_wc__db_status_moved_here -- this NODE arrived as a result of a move. 2724 The root of the moved nodes will be stored in OP_ROOT_ABSPATH. 2725 Similar to the copied state, its parent may be a WORKING node or a 2726 BASE node. And again, the REPOS_* values are implied by this node's 2727 position in the subtree under the ancestor unshadowed BASE node. 2728 ORIGINAL_* will indicate the source of the move. 2729 2730 All OUT parameters may be NULL to indicate a lack of interest in 2731 that piece of information. 2732 2733 STATUS, OP_ROOT_ABSPATH, and REPOS_* will always be assigned a value 2734 if that information is requested (and assuming a successful return). 2735 2736 ORIGINAL_REPOS_RELPATH will refer to the *root* of the operation. It 2737 does *not* correspond to the node given by LOCAL_ABSPATH. The caller 2738 can use the suffix on LOCAL_ABSPATH (relative to OP_ROOT_ABSPATH) in 2739 order to compute the source node which corresponds to LOCAL_ABSPATH. 2740 2741 If the node given by LOCAL_ABSPATH does not have changes recorded in 2742 the WORKING tree, then SVN_ERR_WC_PATH_NOT_FOUND is returned. If it 2743 doesn't have an "added" status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS 2744 will be returned. 2745 2746 All returned data will be allocated in RESULT_POOL. All temporary 2747 allocations will be made in SCRATCH_POOL. 2748*/ 2749svn_error_t * 2750svn_wc__db_scan_addition(svn_wc__db_status_t *status, 2751 const char **op_root_abspath, 2752 const char **repos_relpath, 2753 const char **repos_root_url, 2754 const char **repos_uuid, 2755 const char **original_repos_relpath, 2756 const char **original_root_url, 2757 const char **original_uuid, 2758 svn_revnum_t *original_revision, 2759 svn_wc__db_t *db, 2760 const char *local_abspath, 2761 apr_pool_t *result_pool, 2762 apr_pool_t *scratch_pool); 2763 2764/* Scan the working copy for move information of the node LOCAL_ABSPATH. 2765 * If LOCAL_ABSPATH is not moved here return an 2766 * SVN_ERR_WC_PATH_UNEXPECTED_STATUS error. 2767 * 2768 * If not NULL *MOVED_FROM_ABSPATH will be set to the previous location 2769 * of LOCAL_ABSPATH, before it or an ancestror was moved. 2770 * 2771 * If not NULL *OP_ROOT_ABSPATH will be set to the new location of the 2772 * path that was actually moved 2773 * 2774 * If not NULL *OP_ROOT_MOVED_FROM_ABSPATH will be set to the old location 2775 * of the path that was actually moved. 2776 * 2777 * If not NULL *MOVED_FROM_DELETE_ABSPATH will be set to the ancestor of the 2778 * moved from location that deletes the original location 2779 * 2780 * Given a working copy 2781 * A/B/C 2782 * svn mv A/B D 2783 * svn rm A 2784 * 2785 * You can call this function on D and D/C. When called on D/C all output 2786 * MOVED_FROM_ABSPATH will be A/B/C 2787 * OP_ROOT_ABSPATH will be D 2788 * OP_ROOT_MOVED_FROM_ABSPATH will be A/B 2789 * MOVED_FROM_DELETE_ABSPATH will be A 2790 */ 2791svn_error_t * 2792svn_wc__db_scan_moved(const char **moved_from_abspath, 2793 const char **op_root_abspath, 2794 const char **op_root_moved_from_abspath, 2795 const char **moved_from_delete_abspath, 2796 svn_wc__db_t *db, 2797 const char *local_abspath, 2798 apr_pool_t *result_pool, 2799 apr_pool_t *scratch_pool); 2800 2801/* Scan upwards for additional information about a deleted node. 2802 2803 When a deleted node is discovered in the WORKING tree, the situation 2804 may be quite complex. This function will provide the information to 2805 resolve the circumstances of the deletion. 2806 2807 For discussion purposes, we will start with the most complex example 2808 and then demonstrate simplified examples. Consider node B/W/D/N has been 2809 found as deleted. B is an unmodified directory (thus, only in BASE). W is 2810 "replacement" content that exists in WORKING, shadowing a similar B/W 2811 directory in BASE. D is a deleted subtree in the WORKING tree, and N is 2812 the deleted node. 2813 2814 In this example, BASE_DEL_ABSPATH will bet set to B/W. That is the root of 2815 the BASE tree (implicitly) deleted by the replacement. WORK_DEL_ABSPATH 2816 will be set to the subtree deleted within the replacement; in this case, 2817 B/W/D. No move-away took place, so MOVED_TO_ABSPATH is set to NULL. 2818 2819 In another scenario, B/W was moved-away before W was put into the WORKING 2820 tree through an add/copy/move-here. MOVED_TO_ABSPATH will indicate where 2821 B/W was moved to. Note that further operations may have been performed 2822 post-move, but that is not known or reported by this function. 2823 2824 If BASE does not have a B/W, then the WORKING B/W is not a replacement, 2825 but a simple add/copy/move-here. BASE_DEL_ABSPATH will be set to NULL. 2826 2827 If B/W/D does not exist in the WORKING tree (we're only talking about a 2828 deletion of nodes of the BASE tree), then deleting B/W/D would have marked 2829 the subtree for deletion. BASE_DEL_ABSPATH will refer to B/W/D, 2830 MOVED_TO_ABSPATH will be NULL, and WORK_DEL_ABSPATH will be NULL. 2831 2832 If the BASE node B/W/D was moved instead of deleted, then MOVED_TO_ABSPATH 2833 would indicate the target location (and other OUT values as above). 2834 2835 When the user deletes B/W/D from the WORKING tree, there are a few 2836 additional considerations. If B/W is a simple addition (not a copy or 2837 a move-here), then the deletion will simply remove the nodes from WORKING 2838 and possibly leave behind "base-delete" markers in the WORKING tree. 2839 If the source is a copy/moved-here, then the nodes are replaced with 2840 deletion markers. 2841 2842 If the user moves-away B/W/D from the WORKING tree, then behavior is 2843 again dependent upon the origination of B/W. For a plain add, the nodes 2844 simply move to the destination; this means that B/W/D ceases to be a 2845 node and so cannot be scanned. For a copy, a deletion is made at B/W/D, 2846 and a new copy (of a subtree of the original source) is made at the 2847 destination. For a move-here, a deletion is made, and a copy is made at 2848 the destination (we do not track multiple moves; the source is moved to 2849 B/W, then B/W/D is deleted; then a copy is made at the destination; 2850 however, note the double-move could have been performed by moving the 2851 subtree first, then moving the source to B/W). 2852 2853 There are three further considerations when resolving a deleted node: 2854 2855 If the BASE B/W/D was deleted explicitly *and* B/W is a replacement, 2856 then the explicit deletion is subsumed by the implicit deletion that 2857 occurred with the B/W replacement. Thus, BASE_DEL_ABSPATH will point 2858 to B/W as the root of the BASE deletion. IOW, we can detect the 2859 explicit move-away, but not an explicit deletion. 2860 2861 If B/W/D/N refers to a node present in the BASE tree, and B/W was 2862 replaced by a shallow subtree, then it is possible for N to be 2863 reported as deleted (from BASE) yet no deletions occurred in the 2864 WORKING tree above N. Thus, WORK_DEL_ABSPATH will be set to NULL. 2865 2866 2867 Summary of OUT parameters: 2868 2869 BASE_DEL_ABSPATH will specify the nearest ancestor of the explicit or 2870 implicit deletion (if any) that applies to the BASE tree. 2871 2872 WORK_DEL_ABSPATH will specify the root of a deleted subtree within 2873 the WORKING tree (note there is no concept of layered delete operations 2874 in WORKING, so there is only one deletion root in the ancestry). 2875 2876 MOVED_TO_ABSPATH will specify the path where this node was moved to 2877 if the node has moved-away. 2878 2879 If the node was moved-away, MOVED_TO_OP_ROOT_ABSPATH will specify the 2880 target path of the root of the move operation. If LOCAL_ABSPATH itself 2881 is the source path of the root of the move operation, then 2882 MOVED_TO_OP_ROOT_ABSPATH equals MOVED_TO_ABSPATH. 2883 2884 All OUT parameters may be set to NULL to indicate a lack of interest in 2885 that piece of information. 2886 2887 If the node given by LOCAL_ABSPATH does not exist, then 2888 SVN_ERR_WC_PATH_NOT_FOUND is returned. If it doesn't have a "deleted" 2889 status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS will be returned. 2890 2891 All returned data will be allocated in RESULT_POOL. All temporary 2892 allocations will be made in SCRATCH_POOL. 2893*/ 2894svn_error_t * 2895svn_wc__db_scan_deletion(const char **base_del_abspath, 2896 const char **moved_to_abspath, 2897 const char **work_del_abspath, 2898 const char **moved_to_op_root_abspath, 2899 svn_wc__db_t *db, 2900 const char *local_abspath, 2901 apr_pool_t *result_pool, 2902 apr_pool_t *scratch_pool); 2903 2904 2905/* @} */ 2906 2907 2908/* @defgroup svn_wc__db_upgrade Functions for upgrading a working copy. 2909 @{ 2910*/ 2911 2912/* Installs or updates Sqlite schema statistics for the current (aka latest) 2913 working copy schema. 2914 2915 This function should be called once on initializing the database and after 2916 an schema update completes */ 2917svn_error_t * 2918svn_wc__db_install_schema_statistics(svn_sqlite__db_t *sdb, 2919 apr_pool_t *scratch_pool); 2920 2921 2922/* Create a new wc.db file for LOCAL_DIR_ABSPATH, which is going to be a 2923 working copy for the repository REPOS_ROOT_URL with uuid REPOS_UUID. 2924 Return the raw sqlite handle, repository id and working copy id 2925 and store the database in WC_DB. 2926 2927 Perform temporary allocations in SCRATCH_POOL. */ 2928svn_error_t * 2929svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb, 2930 apr_int64_t *repos_id, 2931 apr_int64_t *wc_id, 2932 svn_wc__db_t *wc_db, 2933 const char *local_dir_abspath, 2934 const char *repos_root_url, 2935 const char *repos_uuid, 2936 apr_pool_t *scratch_pool); 2937 2938/* Simply insert (or replace) one row in the EXTERNALS table. */ 2939svn_error_t * 2940svn_wc__db_upgrade_insert_external(svn_wc__db_t *db, 2941 const char *local_abspath, 2942 svn_node_kind_t kind, 2943 const char *parent_abspath, 2944 const char *def_local_abspath, 2945 const char *repos_relpath, 2946 const char *repos_root_url, 2947 const char *repos_uuid, 2948 svn_revnum_t def_peg_revision, 2949 svn_revnum_t def_revision, 2950 apr_pool_t *scratch_pool); 2951 2952/* Upgrade the metadata concerning the WC at WCROOT_ABSPATH, in DB, 2953 * to the SVN_WC__VERSION format. 2954 * 2955 * This function is used for upgrading wc-ng working copies to a newer 2956 * wc-ng format. If a pre-1.7 working copy is found, this function 2957 * returns SVN_ERR_WC_UPGRADE_REQUIRED. 2958 * 2959 * Upgrading subdirectories of a working copy is not supported. 2960 * If WCROOT_ABSPATH is not a working copy root SVN_ERR_WC_INVALID_OP_ON_CWD 2961 * is returned. 2962 * 2963 * If BUMPED_FORMAT is not NULL, set *BUMPED_FORMAT to TRUE if the format 2964 * was bumped or to FALSE if the wc was already at the resulting format. 2965 */ 2966svn_error_t * 2967svn_wc__db_bump_format(int *result_format, 2968 svn_boolean_t *bumped_format, 2969 svn_wc__db_t *db, 2970 const char *wcroot_abspath, 2971 apr_pool_t *scratch_pool); 2972 2973/* @} */ 2974 2975 2976/* @defgroup svn_wc__db_wq Work queue manipulation. see workqueue.h 2977 @{ 2978*/ 2979 2980/* In the WCROOT associated with DB and WRI_ABSPATH, add WORK_ITEM to the 2981 wcroot's work queue. Use SCRATCH_POOL for all temporary allocations. */ 2982svn_error_t * 2983svn_wc__db_wq_add(svn_wc__db_t *db, 2984 const char *wri_abspath, 2985 const svn_skel_t *work_item, 2986 apr_pool_t *scratch_pool); 2987 2988 2989/* In the WCROOT associated with DB and WRI_ABSPATH, fetch a work item that 2990 needs to be completed. Its identifier is returned in ID, and the data in 2991 WORK_ITEM. 2992 2993 Items are returned in the same order they were queued. This allows for 2994 (say) queueing work on a parent node to be handled before that of its 2995 children. 2996 2997 If there are no work items to be completed, then ID will be set to zero, 2998 and WORK_ITEM to NULL. 2999 3000 If COMPLETED_ID is not 0, the wq item COMPLETED_ID will be marked as 3001 completed before returning the next item. 3002 3003 RESULT_POOL will be used to allocate WORK_ITEM, and SCRATCH_POOL 3004 will be used for all temporary allocations. */ 3005svn_error_t * 3006svn_wc__db_wq_fetch_next(apr_uint64_t *id, 3007 svn_skel_t **work_item, 3008 svn_wc__db_t *db, 3009 const char *wri_abspath, 3010 apr_uint64_t completed_id, 3011 apr_pool_t *result_pool, 3012 apr_pool_t *scratch_pool); 3013 3014/* Special variant of svn_wc__db_wq_fetch_next(), which in the same transaction 3015 also records timestamps and sizes for one or more nodes */ 3016svn_error_t * 3017svn_wc__db_wq_record_and_fetch_next(apr_uint64_t *id, 3018 svn_skel_t **work_item, 3019 svn_wc__db_t *db, 3020 const char *wri_abspath, 3021 apr_uint64_t completed_id, 3022 apr_hash_t *record_map, 3023 apr_pool_t *result_pool, 3024 apr_pool_t *scratch_pool); 3025 3026 3027/* @} */ 3028 3029 3030/* Note: LEVELS_TO_LOCK is here strictly for backward compat. The access 3031 batons still have the notion of 'levels to lock' and we need to ensure 3032 that they still function correctly, even in the new world. 'levels to 3033 lock' should not be exposed through the wc-ng APIs at all: users either 3034 get to lock the entire tree (rooted at some subdir, of course), or none. 3035 3036 An infinite depth lock is obtained with LEVELS_TO_LOCK set to -1, but until 3037 we move to a single DB only depth 0 is supported. 3038*/ 3039svn_error_t * 3040svn_wc__db_wclock_obtain(svn_wc__db_t *db, 3041 const char *local_abspath, 3042 int levels_to_lock, 3043 svn_boolean_t steal_lock, 3044 apr_pool_t *scratch_pool); 3045 3046/* Set LOCK_ABSPATH to the path of the the directory that owns the 3047 lock on LOCAL_ABSPATH, or NULL, if LOCAL_ABSPATH is not locked. */ 3048svn_error_t* 3049svn_wc__db_wclock_find_root(const char **lock_abspath, 3050 svn_wc__db_t *db, 3051 const char *local_abspath, 3052 apr_pool_t *result_pool, 3053 apr_pool_t *scratch_pool); 3054 3055/* Check if somebody has a wclock on LOCAL_ABSPATH */ 3056svn_error_t * 3057svn_wc__db_wclocked(svn_boolean_t *locked, 3058 svn_wc__db_t *db, 3059 const char *local_abspath, 3060 apr_pool_t *scratch_pool); 3061 3062/* Release the previously obtained lock on LOCAL_ABSPATH */ 3063svn_error_t * 3064svn_wc__db_wclock_release(svn_wc__db_t *db, 3065 const char *local_abspath, 3066 apr_pool_t *scratch_pool); 3067 3068/* Checks whether DB currently owns a lock to operate on LOCAL_ABSPATH. 3069 If EXACT is TRUE only lock roots are checked. */ 3070svn_error_t * 3071svn_wc__db_wclock_owns_lock(svn_boolean_t *own_lock, 3072 svn_wc__db_t *db, 3073 const char *local_abspath, 3074 svn_boolean_t exact, 3075 apr_pool_t *scratch_pool); 3076 3077 3078 3079/* @defgroup svn_wc__db_temp Various temporary functions during transition 3080 3081 ### These functions SHOULD be completely removed before 1.7 3082 3083 @{ 3084*/ 3085 3086/* Removes all references to LOCAL_ABSPATH from DB, while optionally leaving 3087 a not present node. 3088 3089 This operation always recursively removes all nodes at and below 3090 LOCAL_ABSPATH from NODES and ACTUAL. 3091 3092 If DESTROY_WC is TRUE, this operation *installs* workqueue operations to 3093 update the local filesystem after the database operation. If DESTROY_CHANGES 3094 is FALSE, modified and unversioned files are left after running this 3095 operation (and the WQ). If DESTROY_CHANGES and DESTROY_WC are TRUE, 3096 LOCAL_ABSPATH and everything below it will be removed by the WQ. 3097 3098 3099 Note: Unlike many similar functions it is a valid scenario for this 3100 function to be called on a wcroot! In this case it will just leave the root 3101 record in BASE 3102 */ 3103svn_error_t * 3104svn_wc__db_op_remove_node(svn_boolean_t *left_changes, 3105 svn_wc__db_t *db, 3106 const char *local_abspath, 3107 svn_boolean_t destroy_wc, 3108 svn_boolean_t destroy_changes, 3109 const svn_skel_t *conflict, 3110 const svn_skel_t *work_items, 3111 svn_cancel_func_t cancel_func, 3112 void *cancel_baton, 3113 apr_pool_t *scratch_pool); 3114 3115/* Sets the depth of LOCAL_ABSPATH in its working copy to DEPTH using DB. 3116 3117 Returns SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not a BASE directory 3118 */ 3119svn_error_t * 3120svn_wc__db_op_set_base_depth(svn_wc__db_t *db, 3121 const char *local_abspath, 3122 svn_depth_t depth, 3123 apr_pool_t *scratch_pool); 3124 3125/* ### temp function. return the FORMAT for the directory LOCAL_ABSPATH. */ 3126svn_error_t * 3127svn_wc__db_temp_get_format(int *format, 3128 svn_wc__db_t *db, 3129 const char *local_dir_abspath, 3130 apr_pool_t *scratch_pool); 3131 3132/* ### temp functions to manage/store access batons within the DB. */ 3133svn_wc_adm_access_t * 3134svn_wc__db_temp_get_access(svn_wc__db_t *db, 3135 const char *local_dir_abspath, 3136 apr_pool_t *scratch_pool); 3137void 3138svn_wc__db_temp_set_access(svn_wc__db_t *db, 3139 const char *local_dir_abspath, 3140 svn_wc_adm_access_t *adm_access, 3141 apr_pool_t *scratch_pool); 3142svn_error_t * 3143svn_wc__db_temp_close_access(svn_wc__db_t *db, 3144 const char *local_dir_abspath, 3145 svn_wc_adm_access_t *adm_access, 3146 apr_pool_t *scratch_pool); 3147void 3148svn_wc__db_temp_clear_access(svn_wc__db_t *db, 3149 const char *local_dir_abspath, 3150 apr_pool_t *scratch_pool); 3151 3152/* ### shallow hash: abspath -> svn_wc_adm_access_t * */ 3153apr_hash_t * 3154svn_wc__db_temp_get_all_access(svn_wc__db_t *db, 3155 apr_pool_t *result_pool); 3156 3157/* ### temp function to open the sqlite database to the appropriate location, 3158 ### then borrow it for a bit. 3159 ### The *only* reason for this function is because entries.c still 3160 ### manually hacks the sqlite database. 3161 3162 ### No matter how tempted you may be DO NOT USE THIS FUNCTION! 3163 ### (if you do, gstein will hunt you down and burn your knee caps off 3164 ### in the middle of the night) 3165 ### "Bet on it." --gstein 3166*/ 3167svn_error_t * 3168svn_wc__db_temp_borrow_sdb(svn_sqlite__db_t **sdb, 3169 svn_wc__db_t *db, 3170 const char *local_dir_abspath, 3171 apr_pool_t *scratch_pool); 3172 3173 3174/* Return a directory in *TEMP_DIR_ABSPATH that is suitable for temporary 3175 files which may need to be moved (atomically and same-device) into the 3176 working copy indicated by WRI_ABSPATH. */ 3177svn_error_t * 3178svn_wc__db_temp_wcroot_tempdir(const char **temp_dir_abspath, 3179 svn_wc__db_t *db, 3180 const char *wri_abspath, 3181 apr_pool_t *result_pool, 3182 apr_pool_t *scratch_pool); 3183 3184/* Update the BASE_NODE of directory LOCAL_ABSPATH to be NEW_REPOS_RELPATH 3185 at revision NEW_REV with status incomplete. */ 3186svn_error_t * 3187svn_wc__db_temp_op_start_directory_update(svn_wc__db_t *db, 3188 const char *local_abspath, 3189 const char *new_repos_relpath, 3190 svn_revnum_t new_rev, 3191 apr_pool_t *scratch_pool); 3192 3193/* Marks a directory update started with 3194 svn_wc__db_temp_op_start_directory_update as completed, by removing 3195 the incomplete status */ 3196svn_error_t * 3197svn_wc__db_temp_op_end_directory_update(svn_wc__db_t *db, 3198 const char *local_dir_abspath, 3199 apr_pool_t *scratch_pool); 3200 3201 3202/* When local_abspath has no WORKING layer, copy the base tree at 3203 LOCAL_ABSPATH into the working tree as copy, leaving any subtree 3204 additions and copies as-is. This may introduce multiple layers if 3205 the tree is mixed revision. 3206 3207 When local_abspath has a WORKING node, but is not an op-root, copy 3208 all descendants at the same op-depth to the op-depth of local_abspath, 3209 thereby turning this node in a copy of what was already there. 3210 3211 Fails with a SVN_ERR_WC_PATH_UNEXPECTED_STATUS error if LOCAL_RELPATH 3212 is already an op-root (as in that case it can't be copied as that 3213 would overwrite what is already there). 3214 3215 After this operation the copied layer (E.g. BASE) can be removed, without 3216 the WORKING nodes chaning. Typical usecase: tree conflict handling */ 3217svn_error_t * 3218svn_wc__db_op_make_copy(svn_wc__db_t *db, 3219 const char *local_abspath, 3220 const svn_skel_t *conflicts, 3221 const svn_skel_t *work_items, 3222 apr_pool_t *scratch_pool); 3223 3224/* Close the wc root LOCAL_ABSPATH and remove any per-directory 3225 handles associated with it. */ 3226svn_error_t * 3227svn_wc__db_drop_root(svn_wc__db_t *db, 3228 const char *local_abspath, 3229 apr_pool_t *scratch_pool); 3230 3231/* Return the OP_DEPTH for LOCAL_RELPATH. */ 3232int 3233svn_wc__db_op_depth_for_upgrade(const char *local_relpath); 3234 3235/* Set *HAVE_WORK TRUE if there is a working layer below the top layer and 3236 *HAVE_BASE if there is a base layer. Set *STATUS to the status of the 3237 highest layer below WORKING */ 3238svn_error_t * 3239svn_wc__db_info_below_working(svn_boolean_t *have_base, 3240 svn_boolean_t *have_work, 3241 svn_wc__db_status_t *status, 3242 svn_wc__db_t *db, 3243 const char *local_abspath, 3244 apr_pool_t *scratch_pool); 3245 3246 3247/* Gets an array of const char *local_relpaths of descendants of LOCAL_ABSPATH, 3248 * which itself must be the op root of an addition, copy or move. 3249 * The descendants returned are at the same op_depth, but are to be deleted 3250 * by the commit processing because they are not present in the local copy. 3251 */ 3252svn_error_t * 3253svn_wc__db_get_not_present_descendants(const apr_array_header_t **descendants, 3254 svn_wc__db_t *db, 3255 const char *local_abspath, 3256 apr_pool_t *result_pool, 3257 apr_pool_t *scratch_pool); 3258 3259/* Gather revision status information about a working copy using DB. 3260 * 3261 * Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision 3262 * numbers found within LOCAL_ABSPATH. 3263 * Only nodes with op_depth zero and presence 'normal' or 'incomplete' 3264 * are considered, so that added, deleted or excluded nodes do not affect 3265 * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION 3266 * to the lowest and highest committed (i.e. "last changed") revision numbers, 3267 * respectively. 3268 * 3269 * Indicate in *IS_SPARSE_CHECKOUT whether any of the nodes within 3270 * LOCAL_ABSPATH is sparse. 3271 * Indicate in *IS_MODIFIED whether the working copy has local modifications 3272 * recorded for it in DB. 3273 * 3274 * Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH 3275 * is switched. If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH 3276 * itself is switched. It should be any trailing portion of LOCAL_ABSPATH's 3277 * expected URL, long enough to include any parts that the caller considers 3278 * might be changed by a switch. If it does not match the end of WC_PATH's 3279 * actual URL, then report a "switched" status. 3280 * 3281 * See also the functions below which provide a subset of this functionality. 3282 */ 3283svn_error_t * 3284svn_wc__db_revision_status(svn_revnum_t *min_revision, 3285 svn_revnum_t *max_revision, 3286 svn_boolean_t *is_sparse_checkout, 3287 svn_boolean_t *is_modified, 3288 svn_boolean_t *is_switched, 3289 svn_wc__db_t *db, 3290 const char *local_abspath, 3291 const char *trail_url, 3292 svn_boolean_t committed, 3293 apr_pool_t *scratch_pool); 3294 3295/* Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision 3296 * numbers found within LOCAL_ABSPATH in the working copy using DB. 3297 * Only nodes with op_depth zero and presence 'normal' or 'incomplete' 3298 * are considered, so that added, deleted or excluded nodes do not affect 3299 * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION 3300 * to the lowest and highest committed (i.e. "last changed") revision numbers, 3301 * respectively. Use SCRATCH_POOL for temporary allocations. 3302 * 3303 * Either of MIN_REVISION and MAX_REVISION may be passed as NULL if 3304 * the caller doesn't care about that return value. 3305 * 3306 * This function provides a subset of the functionality of 3307 * svn_wc__db_revision_status() and is more efficient if the caller 3308 * doesn't need all information returned by svn_wc__db_revision_status(). */ 3309svn_error_t * 3310svn_wc__db_min_max_revisions(svn_revnum_t *min_revision, 3311 svn_revnum_t *max_revision, 3312 svn_wc__db_t *db, 3313 const char *local_abspath, 3314 svn_boolean_t committed, 3315 apr_pool_t *scratch_pool); 3316 3317/* Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH 3318 * is switched, using DB. Use SCRATCH_POOL for temporary allocations. 3319 * 3320 * If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH itself 3321 * is switched. It should be any trailing portion of LOCAL_ABSPATH's 3322 * expected URL, long enough to include any parts that the caller considers 3323 * might be changed by a switch. If it does not match the end of WC_PATH's 3324 * actual URL, then report a "switched" status. 3325 * 3326 * This function provides a subset of the functionality of 3327 * svn_wc__db_revision_status() and is more efficient if the caller 3328 * doesn't need all information returned by svn_wc__db_revision_status(). */ 3329svn_error_t * 3330svn_wc__db_has_switched_subtrees(svn_boolean_t *is_switched, 3331 svn_wc__db_t *db, 3332 const char *local_abspath, 3333 const char *trail_url, 3334 apr_pool_t *scratch_pool); 3335 3336/* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt> 3337 * local absolute paths to <tt>const char *</tt> local absolute paths for 3338 * every path under @a local_abspath in @a db which are excluded by 3339 * the server (e.g. due to authz), or user. If no such paths are found then 3340 * @a *server_excluded_subtrees is set to @c NULL. 3341 * Allocate the hash and all items therein from @a result_pool. 3342 */ 3343svn_error_t * 3344svn_wc__db_get_excluded_subtrees(apr_hash_t **server_excluded_subtrees, 3345 svn_wc__db_t *db, 3346 const char *local_abspath, 3347 apr_pool_t *result_pool, 3348 apr_pool_t *scratch_pool); 3349 3350/* Indicate in *IS_MODIFIED whether the working copy has local modifications, 3351 * using DB. Use SCRATCH_POOL for temporary allocations. 3352 * 3353 * This function does not check the working copy state, but is a lot more 3354 * efficient than a full status walk. */ 3355svn_error_t * 3356svn_wc__db_has_db_mods(svn_boolean_t *is_modified, 3357 svn_wc__db_t *db, 3358 const char *local_abspath, 3359 apr_pool_t *scratch_pool); 3360 3361 3362/* Verify the consistency of metadata concerning the WC that contains 3363 * WRI_ABSPATH, in DB. Return an error if any problem is found. */ 3364svn_error_t * 3365svn_wc__db_verify(svn_wc__db_t *db, 3366 const char *wri_abspath, 3367 apr_pool_t *scratch_pool); 3368 3369 3370/* Possibly need two structures, one with relpaths and with abspaths? 3371 * Only exposed for testing at present. */ 3372struct svn_wc__db_moved_to_t { 3373 const char *local_relpath; /* moved-to destination */ 3374 int op_depth; /* op-root of source */ 3375}; 3376 3377/* Set *FINAL_ABSPATH to an array of svn_wc__db_moved_to_t for 3378 * LOCAL_ABSPATH after following any and all nested moves. 3379 * Only exposed for testing at present. */ 3380svn_error_t * 3381svn_wc__db_follow_moved_to(apr_array_header_t **moved_tos, 3382 svn_wc__db_t *db, 3383 const char *local_abspath, 3384 apr_pool_t *result_pool, 3385 apr_pool_t *scratch_pool); 3386 3387/* Update a moved-away tree conflict victim LOCAL_ABSPATH, deleted in 3388 DELETE_OP_ABSPATH with changes from the original location. */ 3389svn_error_t * 3390svn_wc__db_update_moved_away_conflict_victim(svn_wc__db_t *db, 3391 const char *local_abspath, 3392 const char *delete_op_abspath, 3393 svn_wc_operation_t operation, 3394 svn_wc_conflict_action_t action, 3395 svn_wc_conflict_reason_t reason, 3396 svn_cancel_func_t cancel_func, 3397 void *cancel_baton, 3398 svn_wc_notify_func2_t notify_func, 3399 void *notify_baton, 3400 apr_pool_t *scratch_pool); 3401 3402/* LOCAL_ABSPATH is moved to MOVE_DST_ABSPATH. MOVE_SRC_ROOT_ABSPATH 3403 * is the root of the move to MOVE_DST_OP_ROOT_ABSPATH. 3404 * DELETE_ABSPATH is the op-root of the move; it's the same 3405 * as MOVE_SRC_ROOT_ABSPATH except for moves inside deletes when it is 3406 * the op-root of the delete. */ 3407svn_error_t * 3408svn_wc__db_base_moved_to(const char **move_dst_abspath, 3409 const char **move_dst_op_root_abspath, 3410 const char **move_src_root_abspath, 3411 const char **delete_abspath, 3412 svn_wc__db_t *db, 3413 const char *local_abspath, 3414 apr_pool_t *result_pool, 3415 apr_pool_t *scratch_pool); 3416 3417/* Recover space from the database file for LOCAL_ABSPATH by running 3418 * the "vacuum" command. */ 3419svn_error_t * 3420svn_wc__db_vacuum(svn_wc__db_t *db, 3421 const char *local_abspath, 3422 apr_pool_t *scratch_pool); 3423 3424/* This raises move-edit tree-conflicts on any moves inside the 3425 delete-edit conflict on LOCAL_ABSPATH. This is experimental: see 3426 comment in resolve_conflict_on_node about combining with another 3427 function. */ 3428svn_error_t * 3429svn_wc__db_op_raise_moved_away(svn_wc__db_t *db, 3430 const char *local_abspath, 3431 svn_wc_notify_func2_t notify_func, 3432 void *notify_baton, 3433 apr_pool_t *scratch_pool); 3434 3435/* Breaks all moves of nodes that exist at or below LOCAL_ABSPATH as 3436 shadowed (read: deleted) by the opration rooted at 3437 delete_op_root_abspath. 3438 */ 3439svn_error_t * 3440svn_wc__db_op_break_moved_away(svn_wc__db_t *db, 3441 const char *local_abspath, 3442 const char *delete_op_root_abspath, 3443 svn_boolean_t mark_tc_resolved, 3444 svn_wc_notify_func2_t notify_func, 3445 void *notify_baton, 3446 apr_pool_t *scratch_pool); 3447 3448/* Set *REQUIRED_ABSPATH to the path that should be locked to ensure 3449 * that the lock covers all paths affected by resolving the conflicts 3450 * in the tree LOCAL_ABSPATH. */ 3451svn_error_t * 3452svn_wc__required_lock_for_resolve(const char **required_abspath, 3453 svn_wc__db_t *db, 3454 const char *local_abspath, 3455 apr_pool_t *result_pool, 3456 apr_pool_t *scratch_pool); 3457/* @} */ 3458 3459typedef svn_error_t * (*svn_wc__db_verify_cb_t)(void *baton, 3460 const char *wc_abspath, 3461 const char *local_relpath, 3462 int op_depth, 3463 int id, 3464 const char *description, 3465 apr_pool_t *scratch_pool); 3466 3467/* Checks the database for FULL-correctness according to the spec. 3468 3469 Note that typical 1.7-1.9 databases WILL PRODUCE warnings. 3470 3471 This is mainly useful for WC-NG developers, as there will be 3472 warnings without the database being corrupt 3473*/ 3474svn_error_t * 3475svn_wc__db_verify_db_full(svn_wc__db_t *db, 3476 const char *wri_abspath, 3477 svn_wc__db_verify_cb_t callback, 3478 void *baton, 3479 apr_pool_t *scratch_pool); 3480 3481 3482#ifdef __cplusplus 3483} 3484#endif /* __cplusplus */ 3485 3486#endif /* SVN_WC_DB_H */ 3487