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 svn_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 53 extern "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. */ 128 typedef struct svn_wc__db_t svn_wc__db_t; 129 130 131 /* Enumerated values describing the state of a node. */ 132 typedef 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. */ 191 typedef 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 */ 258 svn_error_t * 259 svn_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. */ 268 svn_error_t * 269 svn_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 */ 292 svn_error_t * 293 svn_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 */ 323 svn_error_t * 324 svn_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 */ 344 svn_error_t * 345 svn_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 */ 357 svn_error_t * 358 svn_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 CONFLICT is not NULL, then it describes a conflict for this node. The 416 node will be record as conflicted (in ACTUAL). 417 418 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 419 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 420 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 421 ACTUAL, to mark the properties unmodified. 422 423 If NEW_IPROPS is not NULL, then it is a depth-first ordered array of 424 svn_prop_inherited_item_t * structures that is set as the base node's 425 inherited_properties. 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 */ 432 svn_error_t * 433 svn_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 const svn_skel_t *conflict, 448 svn_boolean_t update_actual_props, 449 apr_hash_t *new_actual_props, 450 apr_array_header_t *new_iprops, 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 */ 459 svn_error_t * 460 svn_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 */ 508 svn_error_t * 509 svn_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 */ 591 svn_error_t * 592 svn_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 */ 636 svn_error_t * 637 svn_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 */ 667 svn_error_t * 668 svn_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 680 /* Remove a node and all its descendants from the BASE tree. This handles 681 the deletion of a tree from the update editor and some file external 682 scenarios. 683 684 The node to remove is indicated by LOCAL_ABSPATH from the local 685 filesystem. 686 687 This operation *installs* workqueue operations to update the local 688 filesystem after the database operation. 689 690 To maintain a consistent database this function will also remove 691 any working node that marks LOCAL_ABSPATH as base-deleted. If this 692 results in there being no working node for LOCAL_ABSPATH then any 693 actual node will be removed if the actual node does not mark a 694 conflict. 695 696 If KEEP_AS_WORKING is TRUE, then the base tree is copied to higher 697 layers as a copy of itself before deleting the BASE nodes. 698 699 If KEEP_AS_WORKING is FALSE, and QUEUE_DELETES is TRUE, also queue 700 workqueue items to delete all in-wc representations that aren't 701 shadowed by higher layers. 702 (With KEEP_AS_WORKING TRUE, this is a no-op, as everything is 703 automatically shadowed by the created copy) 704 705 If REMOVE_LOCKS is TRUE, all locks of this node and any subnodes 706 are also removed. This is to be done during commit of deleted nodes. 707 708 If NOT_PRESENT_REVISION specifies a valid revision a not-present 709 node is installed in BASE node with kind NOT_PRESENT_KIND after 710 deleting. 711 712 If CONFLICT and/or WORK_ITEMS are passed they are installed as part 713 of the operation, after the work items inserted by the operation 714 itself. 715 */ 716 svn_error_t * 717 svn_wc__db_base_remove(svn_wc__db_t *db, 718 const char *local_abspath, 719 svn_boolean_t keep_as_working, 720 svn_boolean_t queue_deletes, 721 svn_boolean_t remove_locks, 722 svn_revnum_t not_present_revision, 723 svn_skel_t *conflict, 724 svn_skel_t *work_items, 725 apr_pool_t *scratch_pool); 726 727 728 /* Retrieve information about a node in the BASE tree. 729 730 For the BASE node implied by LOCAL_ABSPATH from the local filesystem, 731 return information in the provided OUT parameters. Each OUT parameter 732 may be NULL, indicating that specific item is not requested. 733 734 If there is no information about this node, then SVN_ERR_WC_PATH_NOT_FOUND 735 will be returned. 736 737 The OUT parameters, and their "not available" values are: 738 STATUS n/a (always available) 739 KIND n/a (always available) 740 REVISION SVN_INVALID_REVNUM 741 REPOS_RELPATH NULL (caller should scan up) 742 REPOS_ROOT_URL NULL (caller should scan up) 743 REPOS_UUID NULL (caller should scan up) 744 CHANGED_REV SVN_INVALID_REVNUM 745 CHANGED_DATE 0 746 CHANGED_AUTHOR NULL 747 DEPTH svn_depth_unknown 748 CHECKSUM NULL 749 TARGET NULL 750 LOCK NULL 751 752 HAD_PROPS FALSE 753 PROPS NULL 754 755 UPDATE_ROOT FALSE 756 757 If the STATUS is normal, the REPOS_* values will be non-NULL. 758 759 If DEPTH is requested, and the node is NOT a directory, then the 760 value will be set to svn_depth_unknown. If LOCAL_ABSPATH is a link, 761 it's up to the caller to resolve depth for the link's target. 762 763 If CHECKSUM is requested, and the node is NOT a file, then it will 764 be set to NULL. 765 766 If TARGET is requested, and the node is NOT a symlink, then it will 767 be set to NULL. 768 769 *PROPS maps "const char *" names to "const svn_string_t *" values. If 770 the base node is capable of having properties but has none, set 771 *PROPS to an empty hash. If its status is such that it cannot have 772 properties, set *PROPS to NULL. 773 774 If UPDATE_ROOT is requested, set it to TRUE if the node should only 775 be updated when it is the root of an update (e.g. file externals). 776 777 All returned data will be allocated in RESULT_POOL. All temporary 778 allocations will be made in SCRATCH_POOL. 779 */ 780 svn_error_t * 781 svn_wc__db_base_get_info(svn_wc__db_status_t *status, 782 svn_node_kind_t *kind, 783 svn_revnum_t *revision, 784 const char **repos_relpath, 785 const char **repos_root_url, 786 const char **repos_uuid, 787 svn_revnum_t *changed_rev, 788 apr_time_t *changed_date, 789 const char **changed_author, 790 svn_depth_t *depth, 791 const svn_checksum_t **checksum, 792 const char **target, 793 svn_wc__db_lock_t **lock, 794 svn_boolean_t *had_props, 795 apr_hash_t **props, 796 svn_boolean_t *update_root, 797 svn_wc__db_t *db, 798 const char *local_abspath, 799 apr_pool_t *result_pool, 800 apr_pool_t *scratch_pool); 801 802 /* Structure returned by svn_wc__db_base_get_children_info. Only has the 803 fields needed by the adm crawler. */ 804 struct svn_wc__db_base_info_t { 805 svn_wc__db_status_t status; 806 svn_node_kind_t kind; 807 svn_revnum_t revnum; 808 const char *repos_relpath; 809 const char *repos_root_url; 810 svn_depth_t depth; 811 svn_boolean_t update_root; 812 svn_wc__db_lock_t *lock; 813 }; 814 815 /* Return in *NODES a hash mapping name->struct svn_wc__db_base_info_t for 816 the children of DIR_ABSPATH at op_depth 0. 817 */ 818 svn_error_t * 819 svn_wc__db_base_get_children_info(apr_hash_t **nodes, 820 svn_wc__db_t *db, 821 const char *dir_abspath, 822 apr_pool_t *result_pool, 823 apr_pool_t *scratch_pool); 824 825 826 /* Set *PROPS to the properties of the node LOCAL_ABSPATH in the BASE tree. 827 828 *PROPS maps "const char *" names to "const svn_string_t *" values. 829 If the node has no properties, set *PROPS to an empty hash. 830 *PROPS will never be set to NULL. 831 If the node is not present in the BASE tree (with presence 'normal' 832 or 'incomplete'), return an error. 833 Allocate *PROPS and its keys and values in RESULT_POOL. 834 */ 835 svn_error_t * 836 svn_wc__db_base_get_props(apr_hash_t **props, 837 svn_wc__db_t *db, 838 const char *local_abspath, 839 apr_pool_t *result_pool, 840 apr_pool_t *scratch_pool); 841 842 843 /* Return a list of the BASE tree node's children's names. 844 845 For the node indicated by LOCAL_ABSPATH, this function will return 846 the names of all of its children in the array CHILDREN. The array 847 elements are const char * values. 848 849 If the node is not a directory, then SVN_ERR_WC_NOT_WORKING_COPY will 850 be returned. 851 852 All returned data will be allocated in RESULT_POOL. All temporary 853 allocations will be made in SCRATCH_POOL. 854 */ 855 svn_error_t * 856 svn_wc__db_base_get_children(const apr_array_header_t **children, 857 svn_wc__db_t *db, 858 const char *local_abspath, 859 apr_pool_t *result_pool, 860 apr_pool_t *scratch_pool); 861 862 863 /* Set the dav cache for LOCAL_ABSPATH to PROPS. Use SCRATCH_POOL for 864 temporary allocations. */ 865 svn_error_t * 866 svn_wc__db_base_set_dav_cache(svn_wc__db_t *db, 867 const char *local_abspath, 868 const apr_hash_t *props, 869 apr_pool_t *scratch_pool); 870 871 872 /* Retrieve the dav cache for LOCAL_ABSPATH into *PROPS, allocated in 873 RESULT_POOL. Use SCRATCH_POOL for temporary allocations. Return 874 SVN_ERR_WC_PATH_NOT_FOUND if no dav cache can be located for 875 LOCAL_ABSPATH in DB. */ 876 svn_error_t * 877 svn_wc__db_base_get_dav_cache(apr_hash_t **props, 878 svn_wc__db_t *db, 879 const char *local_abspath, 880 apr_pool_t *result_pool, 881 apr_pool_t *scratch_pool); 882 883 /* Recursively clear the dav cache for LOCAL_ABSPATH. Use 884 SCRATCH_POOL for temporary allocations. */ 885 svn_error_t * 886 svn_wc__db_base_clear_dav_cache_recursive(svn_wc__db_t *db, 887 const char *local_abspath, 888 apr_pool_t *scratch_pool); 889 890 /* Set LOCK_TOKENS to a hash mapping const char * full URLs to const char * 891 * lock tokens for every base node at or under LOCAL_ABSPATH in DB which has 892 * such a lock token set on it. 893 * Allocate the hash and all items therein from RESULT_POOL. */ 894 svn_error_t * 895 svn_wc__db_base_get_lock_tokens_recursive(apr_hash_t **lock_tokens, 896 svn_wc__db_t *db, 897 const char *local_abspath, 898 apr_pool_t *result_pool, 899 apr_pool_t *scratch_pool); 900 901 /* ### anything else needed for maintaining the BASE tree? */ 902 903 904 /* @} */ 905 906 /* @defgroup svn_wc__db_pristine Pristine ("text base") management 907 @{ 908 */ 909 910 /* Set *PRISTINE_ABSPATH to the path to the pristine text file 911 identified by SHA1_CHECKSUM. Error if it does not exist. 912 913 ### This is temporary - callers should not be looking at the file 914 directly. 915 916 Allocate the path in RESULT_POOL. */ 917 svn_error_t * 918 svn_wc__db_pristine_get_path(const char **pristine_abspath, 919 svn_wc__db_t *db, 920 const char *wri_abspath, 921 const svn_checksum_t *checksum, 922 apr_pool_t *result_pool, 923 apr_pool_t *scratch_pool); 924 925 /* Set *PRISTINE_ABSPATH to the path under WCROOT_ABSPATH that will be 926 used by the pristine text identified by SHA1_CHECKSUM. The file 927 need not exist. 928 */ 929 svn_error_t * 930 svn_wc__db_pristine_get_future_path(const char **pristine_abspath, 931 const char *wcroot_abspath, 932 const svn_checksum_t *sha1_checksum, 933 apr_pool_t *result_pool, 934 apr_pool_t *scratch_pool); 935 936 937 /* If requested set *CONTENTS to a readable stream that will yield the pristine 938 text identified by SHA1_CHECKSUM (must be a SHA-1 checksum) within the WC 939 identified by WRI_ABSPATH in DB. 940 941 If requested set *SIZE to the size of the pristine stream in bytes, 942 943 Even if the pristine text is removed from the store while it is being 944 read, the stream will remain valid and readable until it is closed. 945 946 Allocate the stream in RESULT_POOL. */ 947 svn_error_t * 948 svn_wc__db_pristine_read(svn_stream_t **contents, 949 svn_filesize_t *size, 950 svn_wc__db_t *db, 951 const char *wri_abspath, 952 const svn_checksum_t *sha1_checksum, 953 apr_pool_t *result_pool, 954 apr_pool_t *scratch_pool); 955 956 957 /* Set *TEMP_DIR_ABSPATH to a directory in which the caller should create 958 a uniquely named file for later installation as a pristine text file. 959 960 The directory is guaranteed to be one that svn_wc__db_pristine_install() 961 can use: specifically, one from which it can atomically move the file. 962 963 Allocate *TEMP_DIR_ABSPATH in RESULT_POOL. */ 964 svn_error_t * 965 svn_wc__db_pristine_get_tempdir(const char **temp_dir_abspath, 966 svn_wc__db_t *db, 967 const char *wri_abspath, 968 apr_pool_t *result_pool, 969 apr_pool_t *scratch_pool); 970 971 972 /* Install the file TEMPFILE_ABSPATH (which is sitting in a directory given by 973 svn_wc__db_pristine_get_tempdir()) into the pristine data store, to be 974 identified by the SHA-1 checksum of its contents, SHA1_CHECKSUM, and whose 975 MD-5 checksum is MD5_CHECKSUM. */ 976 svn_error_t * 977 svn_wc__db_pristine_install(svn_wc__db_t *db, 978 const char *tempfile_abspath, 979 const svn_checksum_t *sha1_checksum, 980 const svn_checksum_t *md5_checksum, 981 apr_pool_t *scratch_pool); 982 983 984 /* Set *MD5_CHECKSUM to the MD-5 checksum of a pristine text 985 identified by its SHA-1 checksum SHA1_CHECKSUM. Return an error 986 if the pristine text does not exist or its MD5 checksum is not found. 987 988 Allocate *MD5_CHECKSUM in RESULT_POOL. */ 989 svn_error_t * 990 svn_wc__db_pristine_get_md5(const svn_checksum_t **md5_checksum, 991 svn_wc__db_t *db, 992 const char *wri_abspath, 993 const svn_checksum_t *sha1_checksum, 994 apr_pool_t *result_pool, 995 apr_pool_t *scratch_pool); 996 997 998 /* Set *SHA1_CHECKSUM to the SHA-1 checksum of a pristine text 999 identified by its MD-5 checksum MD5_CHECKSUM. Return an error 1000 if the pristine text does not exist or its SHA-1 checksum is not found. 1001 1002 Note: The MD-5 checksum is not strictly guaranteed to be unique in the 1003 database table, although duplicates are expected to be extremely rare. 1004 ### TODO: The behaviour is currently unspecified if the MD-5 checksum is 1005 not unique. Need to see whether this function is going to stay in use, 1006 and, if so, address this somehow. 1007 1008 Allocate *SHA1_CHECKSUM in RESULT_POOL. */ 1009 svn_error_t * 1010 svn_wc__db_pristine_get_sha1(const svn_checksum_t **sha1_checksum, 1011 svn_wc__db_t *db, 1012 const char *wri_abspath, 1013 const svn_checksum_t *md5_checksum, 1014 apr_pool_t *result_pool, 1015 apr_pool_t *scratch_pool); 1016 1017 1018 /* If necessary transfers the PRISTINE files of the tree rooted at 1019 SRC_LOCAL_ABSPATH to the working copy identified by DST_WRI_ABSPATH. */ 1020 svn_error_t * 1021 svn_wc__db_pristine_transfer(svn_wc__db_t *db, 1022 const char *src_local_abspath, 1023 const char *dst_wri_abspath, 1024 svn_cancel_func_t cancel_func, 1025 void *cancel_baton, 1026 apr_pool_t *scratch_pool); 1027 1028 /* Remove the pristine text with SHA-1 checksum SHA1_CHECKSUM from the 1029 * pristine store, iff it is not referenced by any of the (other) WC DB 1030 * tables. */ 1031 svn_error_t * 1032 svn_wc__db_pristine_remove(svn_wc__db_t *db, 1033 const char *wri_abspath, 1034 const svn_checksum_t *sha1_checksum, 1035 apr_pool_t *scratch_pool); 1036 1037 1038 /* Remove all unreferenced pristines in the WC of WRI_ABSPATH in DB. */ 1039 svn_error_t * 1040 svn_wc__db_pristine_cleanup(svn_wc__db_t *db, 1041 const char *wri_abspath, 1042 apr_pool_t *scratch_pool); 1043 1044 1045 /* Set *PRESENT to true if the pristine store for WRI_ABSPATH in DB contains 1046 a pristine text with SHA-1 checksum SHA1_CHECKSUM, and to false otherwise. 1047 */ 1048 svn_error_t * 1049 svn_wc__db_pristine_check(svn_boolean_t *present, 1050 svn_wc__db_t *db, 1051 const char *wri_abspath, 1052 const svn_checksum_t *sha1_checksum, 1053 apr_pool_t *scratch_pool); 1054 1055 /* @defgroup svn_wc__db_external External management 1056 @{ */ 1057 1058 /* Adds (or overwrites) a file external LOCAL_ABSPATH to the working copy 1059 identified by WRI_ABSPATH. 1060 1061 It updates both EXTERNALS and NODES in one atomic step. 1062 */ 1063 svn_error_t * 1064 svn_wc__db_external_add_file(svn_wc__db_t *db, 1065 const char *local_abspath, 1066 const char *wri_abspath, 1067 1068 const char *repos_relpath, 1069 const char *repos_root_url, 1070 const char *repos_uuid, 1071 svn_revnum_t revision, 1072 1073 const apr_hash_t *props, 1074 apr_array_header_t *iprops, 1075 1076 svn_revnum_t changed_rev, 1077 apr_time_t changed_date, 1078 const char *changed_author, 1079 1080 const svn_checksum_t *checksum, 1081 1082 const apr_hash_t *dav_cache, 1083 1084 const char *record_ancestor_abspath, 1085 const char *recorded_repos_relpath, 1086 svn_revnum_t recorded_peg_revision, 1087 svn_revnum_t recorded_revision, 1088 1089 svn_boolean_t update_actual_props, 1090 apr_hash_t *new_actual_props, 1091 1092 svn_boolean_t keep_recorded_info, 1093 const svn_skel_t *conflict, 1094 const svn_skel_t *work_items, 1095 apr_pool_t *scratch_pool); 1096 1097 /* Adds (or overwrites) a symlink external LOCAL_ABSPATH to the working copy 1098 identified by WRI_ABSPATH. 1099 */ 1100 svn_error_t * 1101 svn_wc__db_external_add_symlink(svn_wc__db_t *db, 1102 const char *local_abspath, 1103 const char *wri_abspath, 1104 1105 const char *repos_relpath, 1106 const char *repos_root_url, 1107 const char *repos_uuid, 1108 svn_revnum_t revision, 1109 1110 const apr_hash_t *props, 1111 1112 svn_revnum_t changed_rev, 1113 apr_time_t changed_date, 1114 const char *changed_author, 1115 1116 const char *target, 1117 1118 const apr_hash_t *dav_cache, 1119 1120 const char *record_ancestor_abspath, 1121 const char *recorded_repos_relpath, 1122 svn_revnum_t recorded_peg_revision, 1123 svn_revnum_t recorded_revision, 1124 1125 svn_boolean_t update_actual_props, 1126 apr_hash_t *new_actual_props, 1127 1128 svn_boolean_t keep_recorded_info, 1129 const svn_skel_t *work_items, 1130 apr_pool_t *scratch_pool); 1131 1132 /* Adds (or overwrites) a directory external LOCAL_ABSPATH to the working copy 1133 identified by WRI_ABSPATH. 1134 1135 Directory externals are stored in their own working copy, so one should use 1136 the normal svn_wc__db functions to access the normal working copy 1137 information. 1138 */ 1139 svn_error_t * 1140 svn_wc__db_external_add_dir(svn_wc__db_t *db, 1141 const char *local_abspath, 1142 const char *wri_abspath, 1143 1144 const char *repos_root_url, 1145 const char *repos_uuid, 1146 1147 const char *record_ancestor_abspath, 1148 const char *recorded_repos_relpath, 1149 svn_revnum_t recorded_peg_revision, 1150 svn_revnum_t recorded_revision, 1151 1152 const svn_skel_t *work_items, 1153 apr_pool_t *scratch_pool); 1154 1155 /* Remove a registered external LOCAL_ABSPATH from the working copy identified 1156 by WRI_ABSPATH. 1157 */ 1158 svn_error_t * 1159 svn_wc__db_external_remove(svn_wc__db_t *db, 1160 const char *local_abspath, 1161 const char *wri_abspath, 1162 1163 const svn_skel_t *work_items, 1164 apr_pool_t *scratch_pool); 1165 1166 1167 /* Reads information on the external LOCAL_ABSPATH as stored in the working 1168 copy identified with WRI_ABSPATH (If NULL the parent directory of 1169 LOCAL_ABSPATH is taken as WRI_ABSPATH). 1170 1171 Return SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not an external in 1172 this working copy. 1173 1174 When STATUS is requested it has one of these values 1175 svn_wc__db_status_normal The external is available 1176 svn_wc__db_status_excluded The external is user excluded 1177 1178 When KIND is requested then the value will be set to the kind of external. 1179 1180 If DEFINING_ABSPATH is requested, then the value will be set to the 1181 absolute path of the directory which originally defined the external. 1182 (The path with the svn:externals property) 1183 1184 If REPOS_ROOT_URL is requested, then the value will be set to the 1185 repository root of the external. 1186 1187 If REPOS_UUID is requested, then the value will be set to the 1188 repository uuid of the external. 1189 1190 If RECORDED_REPOS_RELPATH is requested, then the value will be set to the 1191 original repository relative path inside REPOS_ROOT_URL of the external. 1192 1193 If RECORDED_PEG_REVISION is requested, then the value will be set to the 1194 original recorded operational (peg) revision of the external. 1195 1196 If RECORDED_REVISION is requested, then the value will be set to the 1197 original recorded revision of the external. 1198 1199 Allocate the result in RESULT_POOL and perform temporary allocations in 1200 SCRATCH_POOL. 1201 */ 1202 svn_error_t * 1203 svn_wc__db_external_read(svn_wc__db_status_t *status, 1204 svn_node_kind_t *kind, 1205 const char **defining_abspath, 1206 1207 const char **repos_root_url, 1208 const char **repos_uuid, 1209 1210 const char **recorded_repos_relpath, 1211 svn_revnum_t *recorded_peg_revision, 1212 svn_revnum_t *recorded_revision, 1213 1214 svn_wc__db_t *db, 1215 const char *local_abspath, 1216 const char *wri_abspath, 1217 apr_pool_t *result_pool, 1218 apr_pool_t *scratch_pool); 1219 1220 /* Return in *EXTERNALS a list of svn_wc__committable_external_info_t * 1221 * containing info on externals defined to be checked out below LOCAL_ABSPATH, 1222 * returning only those externals that are not fixed to a specific revision. 1223 * 1224 * If IMMEDIATES_ONLY is TRUE, only those externals defined to be checked out 1225 * as immediate children of LOCAL_ABSPATH are returned (this is useful for 1226 * treating user requested depth < infinity). 1227 * 1228 * If there are no externals to be returned, set *EXTERNALS to NULL. Otherwise 1229 * set *EXTERNALS to an APR array newly cleated in RESULT_POOL. 1230 * 1231 * NOTE: This only returns the externals known by the immediate WC root for 1232 * LOCAL_ABSPATH; i.e.: 1233 * - If there is a further parent WC "above" the immediate WC root, and if 1234 * that parent WC defines externals to live somewhere within this WC, these 1235 * externals will appear to be foreign/unversioned and won't be picked up. 1236 * - Likewise, only the topmost level of externals nestings (externals 1237 * defined within a checked out external dir) is picked up by this function. 1238 * (For recursion, see svn_wc__committable_externals_below().) 1239 * 1240 * ###TODO: Add a WRI_ABSPATH (wc root indicator) separate from LOCAL_ABSPATH, 1241 * to allow searching any wc-root for externals under LOCAL_ABSPATH, not only 1242 * LOCAL_ABSPATH's most immediate wc-root. */ 1243 svn_error_t * 1244 svn_wc__db_committable_externals_below(apr_array_header_t **externals, 1245 svn_wc__db_t *db, 1246 const char *local_abspath, 1247 svn_boolean_t immediates_only, 1248 apr_pool_t *result_pool, 1249 apr_pool_t *scratch_pool); 1250 1251 /* Gets a mapping from const char * local abspaths of externals to the const 1252 char * local abspath of where they are defined for all externals defined 1253 at or below LOCAL_ABSPATH. 1254 1255 ### Returns NULL in *EXTERNALS until we bumped to format 29. 1256 1257 Allocate the result in RESULT_POOL and perform temporary allocations in 1258 SCRATCH_POOL. */ 1259 svn_error_t * 1260 svn_wc__db_externals_defined_below(apr_hash_t **externals, 1261 svn_wc__db_t *db, 1262 const char *local_abspath, 1263 apr_pool_t *result_pool, 1264 apr_pool_t *scratch_pool); 1265 1266 /* Gather all svn:externals property values from the actual properties on 1267 directories below LOCAL_ABSPATH as a mapping of const char *local_abspath 1268 to const char * property values. 1269 1270 If DEPTHS is not NULL, set *depths to an apr_hash_t* mapping the same 1271 local_abspaths to the const char * ambient depth of the node. 1272 1273 Allocate the result in RESULT_POOL and perform temporary allocations in 1274 SCRATCH_POOL. */ 1275 svn_error_t * 1276 svn_wc__db_externals_gather_definitions(apr_hash_t **externals, 1277 apr_hash_t **depths, 1278 svn_wc__db_t *db, 1279 const char *local_abspath, 1280 apr_pool_t *result_pool, 1281 apr_pool_t *scratch_pool); 1282 1283 /* @} */ 1284 1285 /* @defgroup svn_wc__db_op Operations on WORKING tree 1286 @{ 1287 */ 1288 1289 /* Copy the node at SRC_ABSPATH (in NODES and ACTUAL_NODE tables) to 1290 * DST_ABSPATH, both in DB but not necessarily in the same WC. The parent 1291 * of DST_ABSPATH must be a versioned directory. 1292 * 1293 * This copy is NOT recursive. It simply establishes this one node, plus 1294 * incomplete nodes for the children. 1295 * 1296 * If IS_MOVE is TRUE, mark this copy operation as the copy-half of 1297 * a move. The delete-half of the move needs to be created separately 1298 * with svn_wc__db_op_delete(). 1299 * 1300 * Add WORK_ITEMS to the work queue. */ 1301 svn_error_t * 1302 svn_wc__db_op_copy(svn_wc__db_t *db, 1303 const char *src_abspath, 1304 const char *dst_abspath, 1305 const char *dst_op_root_abspath, 1306 svn_boolean_t is_move, 1307 const svn_skel_t *work_items, 1308 apr_pool_t *scratch_pool); 1309 1310 /* Checks if LOCAL_ABSPATH represents a move back to its original location, 1311 * and if it is reverts the move while keeping local changes after it has been 1312 * moved from MOVED_FROM_ABSPATH. 1313 * 1314 * If MOVED_BACK is not NULL, set *MOVED_BACK to TRUE when a move was reverted, 1315 * otherwise to FALSE. 1316 */ 1317 svn_error_t * 1318 svn_wc__db_op_handle_move_back(svn_boolean_t *moved_back, 1319 svn_wc__db_t *db, 1320 const char *local_abspath, 1321 const char *moved_from_abspath, 1322 const svn_skel_t *work_items, 1323 apr_pool_t *scratch_pool); 1324 1325 1326 /* Copy the leaves of the op_depth layer directly shadowed by the operation 1327 * of SRC_ABSPATH (so SRC_ABSPATH must be an op_root) to dst_abspaths 1328 * parents layer. 1329 * 1330 * This operation is recursive. It copies all the descendants at the lower 1331 * layer and adds base-deleted nodes on dst_abspath layer to mark these nodes 1332 * properly deleted. 1333 * 1334 * Usually this operation is directly followed by a call to svn_wc__db_op_copy 1335 * which performs the real copy from src_abspath to dst_abspath. 1336 */ 1337 svn_error_t * 1338 svn_wc__db_op_copy_shadowed_layer(svn_wc__db_t *db, 1339 const char *src_abspath, 1340 const char *dst_abspath, 1341 svn_boolean_t is_move, 1342 apr_pool_t *scratch_pool); 1343 1344 1345 /* Record a copy at LOCAL_ABSPATH from a repository directory. 1346 1347 This copy is NOT recursive. It simply establishes this one node. 1348 CHILDREN must be provided, and incomplete nodes will be constructed 1349 for them. 1350 1351 ### arguments docco. */ 1352 svn_error_t * 1353 svn_wc__db_op_copy_dir(svn_wc__db_t *db, 1354 const char *local_abspath, 1355 const apr_hash_t *props, 1356 svn_revnum_t changed_rev, 1357 apr_time_t changed_date, 1358 const char *changed_author, 1359 const char *original_repos_relpath, 1360 const char *original_root_url, 1361 const char *original_uuid, 1362 svn_revnum_t original_revision, 1363 const apr_array_header_t *children, 1364 svn_boolean_t is_move, 1365 svn_depth_t depth, 1366 const svn_skel_t *conflict, 1367 const svn_skel_t *work_items, 1368 apr_pool_t *scratch_pool); 1369 1370 1371 /* Record a copy at LOCAL_ABSPATH from a repository file. 1372 1373 ### arguments docco. */ 1374 svn_error_t * 1375 svn_wc__db_op_copy_file(svn_wc__db_t *db, 1376 const char *local_abspath, 1377 const apr_hash_t *props, 1378 svn_revnum_t changed_rev, 1379 apr_time_t changed_date, 1380 const char *changed_author, 1381 const char *original_repos_relpath, 1382 const char *original_root_url, 1383 const char *original_uuid, 1384 svn_revnum_t original_revision, 1385 const svn_checksum_t *checksum, 1386 svn_boolean_t update_actual_props, 1387 const apr_hash_t *new_actual_props, 1388 svn_boolean_t is_move, 1389 const svn_skel_t *conflict, 1390 const svn_skel_t *work_items, 1391 apr_pool_t *scratch_pool); 1392 1393 1394 svn_error_t * 1395 svn_wc__db_op_copy_symlink(svn_wc__db_t *db, 1396 const char *local_abspath, 1397 const apr_hash_t *props, 1398 svn_revnum_t changed_rev, 1399 apr_time_t changed_date, 1400 const char *changed_author, 1401 const char *original_repos_relpath, 1402 const char *original_root_url, 1403 const char *original_uuid, 1404 svn_revnum_t original_revision, 1405 const char *target, 1406 const svn_skel_t *conflict, 1407 const svn_skel_t *work_items, 1408 apr_pool_t *scratch_pool); 1409 1410 1411 /* ### do we need svn_wc__db_op_copy_server_excluded() ?? */ 1412 1413 1414 /* ### add a new versioned directory. a list of children is NOT passed 1415 ### since they are added in future, distinct calls to db_op_add_*. 1416 PROPS gives the properties; empty or NULL means none. */ 1417 /* ### do we need a CONFLICTS param? */ 1418 svn_error_t * 1419 svn_wc__db_op_add_directory(svn_wc__db_t *db, 1420 const char *local_abspath, 1421 const apr_hash_t *props, 1422 const svn_skel_t *work_items, 1423 apr_pool_t *scratch_pool); 1424 1425 1426 /* Add a file. 1427 PROPS gives the properties; empty or NULL means none. 1428 ### this file has no "pristine" 1429 ### contents, so a checksum [reference] is not required. */ 1430 /* ### do we need a CONFLICTS param? */ 1431 svn_error_t * 1432 svn_wc__db_op_add_file(svn_wc__db_t *db, 1433 const char *local_abspath, 1434 const apr_hash_t *props, 1435 const svn_skel_t *work_items, 1436 apr_pool_t *scratch_pool); 1437 1438 1439 /* Add a symlink. 1440 PROPS gives the properties; empty or NULL means none. */ 1441 /* ### do we need a CONFLICTS param? */ 1442 svn_error_t * 1443 svn_wc__db_op_add_symlink(svn_wc__db_t *db, 1444 const char *local_abspath, 1445 const char *target, 1446 const apr_hash_t *props, 1447 const svn_skel_t *work_items, 1448 apr_pool_t *scratch_pool); 1449 1450 1451 /* Set the properties of the node LOCAL_ABSPATH in the ACTUAL tree to 1452 PROPS. 1453 1454 PROPS maps "const char *" names to "const svn_string_t *" values. 1455 To specify no properties, PROPS must be an empty hash, not NULL. 1456 If the node is not present, return an error. 1457 1458 If PROPS is NULL, set the properties to be the same as the pristine 1459 properties. 1460 1461 If CONFLICT is not NULL, it is used to register a conflict on this 1462 node at the same time the properties are changed. 1463 1464 WORK_ITEMS are inserted into the work queue, as additional things that 1465 need to be completed before the working copy is stable. 1466 1467 1468 If CLEAR_RECORDED_INFO is true, the recorded information for the node 1469 is cleared. (commonly used when updating svn:* magic properties). 1470 1471 NOTE: This will overwrite ALL working properties the node currently 1472 has. There is no db_op_set_prop() function. Callers must read all the 1473 properties, change one, and write all the properties. 1474 ### ugh. this has poor transaction semantics... 1475 1476 1477 NOTE: This will create an entry in the ACTUAL table for the node if it 1478 does not yet have one. 1479 */ 1480 svn_error_t * 1481 svn_wc__db_op_set_props(svn_wc__db_t *db, 1482 const char *local_abspath, 1483 apr_hash_t *props, 1484 svn_boolean_t clear_recorded_info, 1485 const svn_skel_t *conflict, 1486 const svn_skel_t *work_items, 1487 apr_pool_t *scratch_pool); 1488 1489 /* Mark LOCAL_ABSPATH, and all children, for deletion. 1490 * 1491 * This function removes the file externals (and if DELETE_DIR_EXTERNALS is 1492 * TRUE also the directory externals) registered below LOCAL_ABSPATH. 1493 * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes) 1494 * 1495 * If MOVED_TO_ABSPATH is not NULL, mark the deletion of LOCAL_ABSPATH 1496 * as the delete-half of a move from LOCAL_ABSPATH to MOVED_TO_ABSPATH. 1497 * 1498 * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON) 1499 * for each node deleted. While this processing occurs, if CANCEL_FUNC is 1500 * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation 1501 * during the processing. 1502 * 1503 * Note: the notification (and cancellation) occur outside of a SQLite 1504 * transaction. 1505 */ 1506 svn_error_t * 1507 svn_wc__db_op_delete(svn_wc__db_t *db, 1508 const char *local_abspath, 1509 const char *moved_to_abspath, 1510 svn_boolean_t delete_dir_externals, 1511 svn_skel_t *conflict, 1512 svn_skel_t *work_items, 1513 svn_cancel_func_t cancel_func, 1514 void *cancel_baton, 1515 svn_wc_notify_func2_t notify_func, 1516 void *notify_baton, 1517 apr_pool_t *scratch_pool); 1518 1519 1520 /* Mark all LOCAL_ABSPATH in the TARGETS array, and all of their children, 1521 * for deletion. 1522 * 1523 * This function is more efficient than svn_wc__db_op_delete() because 1524 * only one sqlite transaction is used for all targets. 1525 * It currently lacks support for moves (though this could be changed, 1526 * at which point svn_wc__db_op_delete() becomes redundant). 1527 * 1528 * This function removes the file externals (and if DELETE_DIR_EXTERNALS is 1529 * TRUE also the directory externals) registered below the targets. 1530 * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes) 1531 * 1532 * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON) 1533 * for each node deleted. While this processing occurs, if CANCEL_FUNC is 1534 * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation 1535 * during the processing. 1536 * 1537 * Note: the notification (and cancellation) occur outside of a SQLite 1538 * transaction. 1539 */ 1540 svn_error_t * 1541 svn_wc__db_op_delete_many(svn_wc__db_t *db, 1542 apr_array_header_t *targets, 1543 svn_boolean_t delete_dir_externals, 1544 const svn_skel_t *conflict, 1545 svn_cancel_func_t cancel_func, 1546 void *cancel_baton, 1547 svn_wc_notify_func2_t notify_func, 1548 void *notify_baton, 1549 apr_pool_t *scratch_pool); 1550 1551 1552 /* ### mark PATH as (possibly) modified. "svn edit" ... right API here? */ 1553 svn_error_t * 1554 svn_wc__db_op_modified(svn_wc__db_t *db, 1555 const char *local_abspath, 1556 apr_pool_t *scratch_pool); 1557 1558 1559 /* ### use NULL to remove from a changelist. 1560 1561 ### NOTE: only depth=svn_depth_empty is supported right now. 1562 */ 1563 svn_error_t * 1564 svn_wc__db_op_set_changelist(svn_wc__db_t *db, 1565 const char *local_abspath, 1566 const char *new_changelist, 1567 const apr_array_header_t *changelist_filter, 1568 svn_depth_t depth, 1569 /* ### flip to CANCEL, then NOTIFY. precedent. */ 1570 svn_wc_notify_func2_t notify_func, 1571 void *notify_baton, 1572 svn_cancel_func_t cancel_func, 1573 void *cancel_baton, 1574 apr_pool_t *scratch_pool); 1575 1576 /* Record CONFLICT on LOCAL_ABSPATH, potentially replacing other conflicts 1577 recorded on LOCAL_ABSPATH. 1578 1579 Users should in most cases pass CONFLICT to another WC_DB call instead of 1580 calling svn_wc__db_op_mark_conflict() directly outside a transaction, to 1581 allow recording atomically with the operation involved. 1582 1583 Any work items that are necessary as part of marking this node conflicted 1584 can be passed in WORK_ITEMS. 1585 */ 1586 svn_error_t * 1587 svn_wc__db_op_mark_conflict(svn_wc__db_t *db, 1588 const char *local_abspath, 1589 const svn_skel_t *conflict, 1590 const svn_skel_t *work_items, 1591 apr_pool_t *scratch_pool); 1592 1593 1594 /* ### caller maintains ACTUAL, and how the resolution occurred. we're just 1595 ### recording state. 1596 ### 1597 ### I'm not sure that these three values are the best way to do this, 1598 ### but they're handy for now. */ 1599 svn_error_t * 1600 svn_wc__db_op_mark_resolved(svn_wc__db_t *db, 1601 const char *local_abspath, 1602 svn_boolean_t resolved_text, 1603 svn_boolean_t resolved_props, 1604 svn_boolean_t resolved_tree, 1605 const svn_skel_t *work_items, 1606 apr_pool_t *scratch_pool); 1607 1608 1609 /* Revert all local changes which are being maintained in the database, 1610 * including conflict storage, properties and text modification status. 1611 * 1612 * Returns SVN_ERR_WC_INVALID_OPERATION_DEPTH if the revert is not 1613 * possible, e.g. copy/delete but not a root, or a copy root with 1614 * children. 1615 * 1616 * At present only depth=empty and depth=infinity are supported. 1617 * 1618 * This function populates the revert list that can be queried to 1619 * determine what was reverted. 1620 */ 1621 svn_error_t * 1622 svn_wc__db_op_revert(svn_wc__db_t *db, 1623 const char *local_abspath, 1624 svn_depth_t depth, 1625 apr_pool_t *result_pool, 1626 apr_pool_t *scratch_pool); 1627 1628 /* Query the revert list for LOCAL_ABSPATH and set *REVERTED if the 1629 * path was reverted. Set *MARKER_FILES to a const char *list of 1630 * marker files if any were recorded on LOCAL_ABSPATH. 1631 * 1632 * Set *COPIED_HERE if the reverted node was copied here and is the 1633 * operation root of the copy. 1634 * Set *KIND to the node kind of the reverted node. 1635 * 1636 * Removes the row for LOCAL_ABSPATH from the revert list. 1637 */ 1638 svn_error_t * 1639 svn_wc__db_revert_list_read(svn_boolean_t *reverted, 1640 const apr_array_header_t **marker_files, 1641 svn_boolean_t *copied_here, 1642 svn_node_kind_t *kind, 1643 svn_wc__db_t *db, 1644 const char *local_abspath, 1645 apr_pool_t *result_pool, 1646 apr_pool_t *scratch_pool); 1647 1648 /* The type of elements in the array returned by 1649 * svn_wc__db_revert_list_read_copied_children(). */ 1650 typedef struct svn_wc__db_revert_list_copied_child_info_t { 1651 const char *abspath; 1652 svn_node_kind_t kind; 1653 } svn_wc__db_revert_list_copied_child_info_t ; 1654 1655 /* Return in *CHILDREN a list of reverted copied nodes at or within 1656 * LOCAL_ABSPATH (which is a reverted file or a reverted directory). 1657 * Allocate *COPIED_CHILDREN and its elements in RESULT_POOL. 1658 * The elements are of type svn_wc__db_revert_list_copied_child_info_t. */ 1659 svn_error_t * 1660 svn_wc__db_revert_list_read_copied_children(const apr_array_header_t **children, 1661 svn_wc__db_t *db, 1662 const char *local_abspath, 1663 apr_pool_t *result_pool, 1664 apr_pool_t *scratch_pool); 1665 1666 1667 /* Make revert notifications for all paths in the revert list that are 1668 * equal to LOCAL_ABSPATH or below LOCAL_ABSPATH. 1669 * 1670 * Removes all the corresponding rows from the revert list. 1671 * 1672 * ### Pass in cancel_func? 1673 */ 1674 svn_error_t * 1675 svn_wc__db_revert_list_notify(svn_wc_notify_func2_t notify_func, 1676 void *notify_baton, 1677 svn_wc__db_t *db, 1678 const char *local_abspath, 1679 apr_pool_t *scratch_pool); 1680 1681 /* Clean up after svn_wc__db_op_revert by removing the revert list. 1682 */ 1683 svn_error_t * 1684 svn_wc__db_revert_list_done(svn_wc__db_t *db, 1685 const char *local_abspath, 1686 apr_pool_t *scratch_pool); 1687 1688 /* ### status */ 1689 1690 1691 /* @} */ 1692 1693 /* @defgroup svn_wc__db_read Read operations on the BASE/WORKING tree 1694 @{ 1695 1696 These functions query information about nodes in ACTUAL, and returns 1697 the requested information from the appropriate ACTUAL, WORKING, or 1698 BASE tree. 1699 1700 For example, asking for the checksum of the pristine version will 1701 return the one recorded in WORKING, or if no WORKING node exists, then 1702 the checksum comes from BASE. 1703 */ 1704 1705 /* Retrieve information about a node. 1706 1707 For the node implied by LOCAL_ABSPATH from the local filesystem, return 1708 information in the provided OUT parameters. Each OUT parameter may be 1709 NULL, indicating that specific item is not requested. 1710 1711 The information returned comes from the BASE tree, as possibly modified 1712 by the WORKING and ACTUAL trees. 1713 1714 If there is no information about the node, then SVN_ERR_WC_PATH_NOT_FOUND 1715 will be returned. 1716 1717 The OUT parameters, and their "not available" values are: 1718 STATUS n/a (always available) 1719 KIND svn_node_unknown (For ACTUAL only nodes) 1720 REVISION SVN_INVALID_REVNUM 1721 REPOS_RELPATH NULL 1722 REPOS_ROOT_URL NULL 1723 REPOS_UUID NULL 1724 CHANGED_REV SVN_INVALID_REVNUM 1725 CHANGED_DATE 0 1726 CHANGED_AUTHOR NULL 1727 DEPTH svn_depth_unknown 1728 CHECKSUM NULL 1729 TARGET NULL 1730 1731 ORIGINAL_REPOS_RELPATH NULL 1732 ORIGINAL_ROOT_URL NULL 1733 ORIGINAL_UUID NULL 1734 ORIGINAL_REVISION SVN_INVALID_REVNUM 1735 1736 LOCK NULL 1737 1738 RECORDED_SIZE SVN_INVALID_FILESIZE 1739 RECORDED_TIME 0 1740 1741 CHANGELIST NULL 1742 CONFLICTED FALSE 1743 1744 OP_ROOT FALSE 1745 HAD_PROPS FALSE 1746 PROPS_MOD FALSE 1747 1748 HAVE_BASE FALSE 1749 HAVE_MORE_WORK FALSE 1750 HAVE_WORK FALSE 1751 1752 When STATUS is requested, then it will be one of these values: 1753 1754 svn_wc__db_status_normal 1755 A plain BASE node, with no local changes. 1756 1757 svn_wc__db_status_added 1758 A node has been added/copied/moved to here. See HAVE_BASE to see 1759 if this change overwrites a BASE node. Use scan_addition() to resolve 1760 whether this has been added, copied, or moved, and the details of the 1761 operation (this function only looks at LOCAL_ABSPATH, but resolving 1762 the details requires scanning one or more ancestor nodes). 1763 1764 svn_wc__db_status_deleted 1765 This node has been deleted or moved away. It may be a delete/move of 1766 a BASE node, or a child node of a subtree that was copied/moved to 1767 an ancestor location. Call scan_deletion() to determine the full 1768 details of the operations upon this node. 1769 1770 svn_wc__db_status_server_excluded 1771 The node is versioned/known by the server, but the server has 1772 decided not to provide further information about the node. This 1773 is a BASE node (since changes are not allowed to this node). 1774 1775 svn_wc__db_status_excluded 1776 The node has been excluded from the working copy tree. This may 1777 be an exclusion from the BASE tree, or an exclusion in the 1778 WORKING tree for a child node of a copied/moved parent. 1779 1780 svn_wc__db_status_not_present 1781 This is a node from the BASE tree, has been marked as "not-present" 1782 within this mixed-revision working copy. This node is at a revision 1783 that is not in the tree, contrary to its inclusion in the parent 1784 node's revision. 1785 1786 svn_wc__db_status_incomplete 1787 The BASE is incomplete due to an interrupted operation. An 1788 incomplete WORKING node will be svn_wc__db_status_added. 1789 1790 If REVISION is requested, it will be set to the revision of the 1791 unmodified (BASE) node, or to SVN_INVALID_REVNUM if any structural 1792 changes have been made to that node (that is, if the node has a row in 1793 the WORKING table). 1794 1795 If DEPTH is requested, and the node is NOT a directory, then 1796 the value will be set to svn_depth_unknown. 1797 1798 If CHECKSUM is requested, and the node is NOT a file, then it will 1799 be set to NULL. 1800 1801 If TARGET is requested, and the node is NOT a symlink, then it will 1802 be set to NULL. 1803 1804 If TRANSLATED_SIZE is requested, and the node is NOT a file, then 1805 it will be set to SVN_INVALID_FILESIZE. 1806 1807 If HAVE_WORK is TRUE, the returned information is from the highest WORKING 1808 layer. In that case HAVE_MORE_WORK and HAVE_BASE provide information about 1809 what other layers exist for this node. 1810 1811 If HAVE_WORK is FALSE and HAVE_BASE is TRUE then the information is from 1812 the BASE tree. 1813 1814 If HAVE_WORK and HAVE_BASE are both FALSE and when retrieving CONFLICTED, 1815 then the node doesn't exist at all. 1816 1817 If OP_ROOT is requested and the node has a WORKING layer, OP_ROOT will be 1818 set to true if this node is the op_root for this layer. 1819 1820 If HAD_PROPS is requested and the node has pristine props, the value will 1821 be set to TRUE. 1822 1823 If PROPS_MOD is requested and the node has property modification the value 1824 will be set to TRUE. 1825 1826 ### add information about the need to scan upwards to get a complete 1827 ### picture of the state of this node. 1828 1829 ### add some documentation about OUT parameter values based on STATUS ?? 1830 1831 ### the TEXT_MOD may become an enumerated value at some point to 1832 ### indicate different states of knowledge about text modifications. 1833 ### for example, an "svn edit" command in the future might set a 1834 ### flag indicating administratively-defined modification. and/or we 1835 ### might have a status indicating that we saw it was modified while 1836 ### performing a filesystem traversal. 1837 1838 All returned data will be allocated in RESULT_POOL. All temporary 1839 allocations will be made in SCRATCH_POOL. 1840 */ 1841 /* ### old docco. needs to be incorporated as appropriate. there is 1842 ### some pending, potential changes to the definition of this API, 1843 ### so not worrying about it just yet. 1844 1845 ### if the node has not been committed (after adding): 1846 ### revision will be SVN_INVALID_REVNUM 1847 ### repos_* will be NULL 1848 ### changed_rev will be SVN_INVALID_REVNUM 1849 ### changed_date will be 0 1850 ### changed_author will be NULL 1851 ### status will be svn_wc__db_status_added 1852 ### text_mod will be TRUE 1853 ### prop_mod will be TRUE if any props have been set 1854 ### base_shadowed will be FALSE 1855 1856 ### if the node is not a copy, or a move destination: 1857 ### original_repos_path will be NULL 1858 ### original_root_url will be NULL 1859 ### original_uuid will be NULL 1860 ### original_revision will be SVN_INVALID_REVNUM 1861 1862 ### note that @a base_shadowed can be derived. if the status specifies 1863 ### an add/copy/move *and* there is a corresponding node in BASE, then 1864 ### the BASE has been deleted to open the way for this node. 1865 */ 1866 svn_error_t * 1867 svn_wc__db_read_info(svn_wc__db_status_t *status, /* ### derived */ 1868 svn_node_kind_t *kind, 1869 svn_revnum_t *revision, 1870 const char **repos_relpath, 1871 const char **repos_root_url, 1872 const char **repos_uuid, 1873 svn_revnum_t *changed_rev, 1874 apr_time_t *changed_date, 1875 const char **changed_author, 1876 svn_depth_t *depth, /* dirs only */ 1877 const svn_checksum_t **checksum, /* files only */ 1878 const char **target, /* symlinks only */ 1879 1880 /* ### the following fields if copied/moved (history) */ 1881 const char **original_repos_relpath, 1882 const char **original_root_url, 1883 const char **original_uuid, 1884 svn_revnum_t *original_revision, 1885 1886 /* For BASE nodes */ 1887 svn_wc__db_lock_t **lock, 1888 1889 /* Recorded for files present in the working copy */ 1890 svn_filesize_t *recorded_size, 1891 apr_time_t *recorded_time, 1892 1893 /* From ACTUAL */ 1894 const char **changelist, 1895 svn_boolean_t *conflicted, 1896 1897 /* ### the followed are derived fields */ 1898 svn_boolean_t *op_root, 1899 1900 svn_boolean_t *had_props, 1901 svn_boolean_t *props_mod, 1902 1903 svn_boolean_t *have_base, 1904 svn_boolean_t *have_more_work, 1905 svn_boolean_t *have_work, 1906 1907 svn_wc__db_t *db, 1908 const char *local_abspath, 1909 apr_pool_t *result_pool, 1910 apr_pool_t *scratch_pool); 1911 1912 /* Structure used as linked list in svn_wc__db_info_t to describe all nodes 1913 in this location that were moved to another location */ 1914 struct svn_wc__db_moved_to_info_t 1915 { 1916 const char *moved_to_abspath; 1917 const char *shadow_op_root_abspath; 1918 1919 struct svn_wc__db_moved_to_info_t *next; 1920 }; 1921 1922 /* Structure returned by svn_wc__db_read_children_info. Only has the 1923 fields needed by status. */ 1924 struct svn_wc__db_info_t { 1925 svn_wc__db_status_t status; 1926 svn_node_kind_t kind; 1927 svn_revnum_t revnum; 1928 const char *repos_relpath; 1929 const char *repos_root_url; 1930 const char *repos_uuid; 1931 svn_revnum_t changed_rev; 1932 const char *changed_author; 1933 apr_time_t changed_date; 1934 svn_depth_t depth; 1935 1936 svn_filesize_t recorded_size; 1937 apr_time_t recorded_time; 1938 1939 const char *changelist; 1940 svn_boolean_t conflicted; 1941 #ifdef HAVE_SYMLINK 1942 svn_boolean_t special; 1943 #endif 1944 svn_boolean_t op_root; 1945 1946 svn_boolean_t has_checksum; 1947 svn_boolean_t copied; 1948 svn_boolean_t had_props; 1949 svn_boolean_t props_mod; 1950 1951 svn_boolean_t have_base; 1952 svn_boolean_t have_more_work; 1953 1954 svn_boolean_t locked; /* WC directory lock */ 1955 svn_wc__db_lock_t *lock; /* Repository file lock */ 1956 svn_boolean_t incomplete; /* TRUE if a working node is incomplete */ 1957 1958 struct svn_wc__db_moved_to_info_t *moved_to; /* A linked list of locations 1959 where nodes at this path 1960 are moved to. Highest layers 1961 first */ 1962 svn_boolean_t moved_here; /* Only on op-roots. */ 1963 1964 svn_boolean_t file_external; 1965 }; 1966 1967 /* Return in *NODES a hash mapping name->struct svn_wc__db_info_t for 1968 the children of DIR_ABSPATH, and in *CONFLICTS a hash of names in 1969 conflict. 1970 1971 The results include any path that was a child of a deleted directory that 1972 existed at LOCAL_ABSPATH, even if that directory is now scheduled to be 1973 replaced by the working node at LOCAL_ABSPATH. 1974 */ 1975 svn_error_t * 1976 svn_wc__db_read_children_info(apr_hash_t **nodes, 1977 apr_hash_t **conflicts, 1978 svn_wc__db_t *db, 1979 const char *dir_abspath, 1980 apr_pool_t *result_pool, 1981 apr_pool_t *scratch_pool); 1982 1983 /* Like svn_wc__db_read_children_info, but only gets an info node for the root 1984 element. */ 1985 svn_error_t * 1986 svn_wc__db_read_single_info(const struct svn_wc__db_info_t **info, 1987 svn_wc__db_t *db, 1988 const char *local_abspath, 1989 apr_pool_t *result_pool, 1990 apr_pool_t *scratch_pool); 1991 1992 /* Structure returned by svn_wc__db_read_walker_info. Only has the 1993 fields needed by svn_wc__internal_walk_children(). */ 1994 struct svn_wc__db_walker_info_t { 1995 svn_wc__db_status_t status; 1996 svn_node_kind_t kind; 1997 }; 1998 1999 /* When a node is deleted in WORKING, some of its information is no longer 2000 available. But in some cases it might still be relevant to obtain this 2001 information even when the information isn't stored in the BASE tree. 2002 2003 This function allows access to that specific information. 2004 2005 When a node is not deleted, this node returns the same information 2006 as svn_wc__db_read_info(). 2007 2008 All output arguments are optional and behave in the same way as when 2009 calling svn_wc__db_read_info(). 2010 2011 (All other information (like original_*) can be obtained via other apis). 2012 2013 *PROPS maps "const char *" names to "const svn_string_t *" values. If 2014 the pristine node is capable of having properties but has none, set 2015 *PROPS to an empty hash. If its status is such that it cannot have 2016 properties, set *PROPS to NULL. 2017 */ 2018 svn_error_t * 2019 svn_wc__db_read_pristine_info(svn_wc__db_status_t *status, 2020 svn_node_kind_t *kind, 2021 svn_revnum_t *changed_rev, 2022 apr_time_t *changed_date, 2023 const char **changed_author, 2024 svn_depth_t *depth, /* dirs only */ 2025 const svn_checksum_t **checksum, /* files only */ 2026 const char **target, /* symlinks only */ 2027 svn_boolean_t *had_props, 2028 apr_hash_t **props, 2029 svn_wc__db_t *db, 2030 const char *local_abspath, 2031 apr_pool_t *result_pool, 2032 apr_pool_t *scratch_pool); 2033 2034 /* Gets the information required to install a pristine file to the working copy 2035 2036 Set WCROOT_ABSPATH to the working copy root, SHA1_CHECKSUM to the 2037 checksum of the node (a valid reference into the pristine store) 2038 and PRISTINE_PROPS to the node's pristine properties (to use for 2039 installing the file). 2040 2041 If WRI_ABSPATH is not NULL, check for information in the working copy 2042 identified by WRI_ABSPATH. 2043 */ 2044 svn_error_t * 2045 svn_wc__db_read_node_install_info(const char **wcroot_abspath, 2046 const svn_checksum_t **sha1_checksum, 2047 apr_hash_t **pristine_props, 2048 apr_time_t *changed_date, 2049 svn_wc__db_t *db, 2050 const char *local_abspath, 2051 const char *wri_abspath, 2052 apr_pool_t *result_pool, 2053 apr_pool_t *scratch_pool); 2054 2055 /* Return in *NODES a hash mapping name->struct svn_wc__db_walker_info_t for 2056 the children of DIR_ABSPATH. "name" is the child's name relative to 2057 DIR_ABSPATH, not an absolute path. */ 2058 svn_error_t * 2059 svn_wc__db_read_children_walker_info(apr_hash_t **nodes, 2060 svn_wc__db_t *db, 2061 const char *dir_abspath, 2062 apr_pool_t *result_pool, 2063 apr_pool_t *scratch_pool); 2064 2065 2066 /** 2067 * Set *URL to the corresponding url for LOCAL_ABSPATH. 2068 * If the node is added, return the url it will have in the repository. 2069 */ 2070 svn_error_t * 2071 svn_wc__db_read_url(const char **url, 2072 svn_wc__db_t *db, 2073 const char *local_abspath, 2074 apr_pool_t *result_pool, 2075 apr_pool_t *scratch_pool); 2076 2077 2078 /* Set *PROPS to the properties of the node LOCAL_ABSPATH in the ACTUAL 2079 tree (looking through to the WORKING or BASE tree as required). 2080 2081 ### *PROPS will be set to NULL in the following situations: 2082 ### ... tbd 2083 2084 PROPS maps "const char *" names to "const svn_string_t *" values. 2085 If the node has no properties, set *PROPS to an empty hash. 2086 If the node is not present, return an error. 2087 Allocate *PROPS and its keys and values in RESULT_POOL. 2088 */ 2089 svn_error_t * 2090 svn_wc__db_read_props(apr_hash_t **props, 2091 svn_wc__db_t *db, 2092 const char *local_abspath, 2093 apr_pool_t *result_pool, 2094 apr_pool_t *scratch_pool); 2095 2096 /* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and 2097 * a hash table mapping <tt>char *</tt> names onto svn_string_t * 2098 * values for any properties of child nodes of LOCAL_ABSPATH (up to DEPTH). 2099 * 2100 * If PRISTINE is FALSE, read the properties from the WORKING layer (highest 2101 * op_depth); if PRISTINE is FALSE, local modifications will be visible. 2102 */ 2103 svn_error_t * 2104 svn_wc__db_read_props_streamily(svn_wc__db_t *db, 2105 const char *local_abspath, 2106 svn_depth_t depth, 2107 svn_boolean_t pristine, 2108 const apr_array_header_t *changelists, 2109 svn_wc__proplist_receiver_t receiver_func, 2110 void *receiver_baton, 2111 svn_cancel_func_t cancel_func, 2112 void *cancel_baton, 2113 apr_pool_t *scratch_pool); 2114 2115 2116 /* Set *PROPS to the properties of the node LOCAL_ABSPATH in the WORKING 2117 tree (looking through to the BASE tree as required). 2118 2119 ### *PROPS will set set to NULL in the following situations: 2120 ### ... tbd. see props.c:svn_wc__get_pristine_props() 2121 2122 *PROPS maps "const char *" names to "const svn_string_t *" values. 2123 If the node has no properties, set *PROPS to an empty hash. 2124 If the node is not present, return an error. 2125 Allocate *PROPS and its keys and values in RESULT_POOL. 2126 */ 2127 svn_error_t * 2128 svn_wc__db_read_pristine_props(apr_hash_t **props, 2129 svn_wc__db_t *db, 2130 const char *local_abspath, 2131 apr_pool_t *result_pool, 2132 apr_pool_t *scratch_pool); 2133 2134 2135 /** 2136 * Set @a *iprops to a depth-first ordered array of 2137 * #svn_prop_inherited_item_t * structures representing the properties 2138 * inherited by @a local_abspath from the ACTUAL tree above 2139 * @a local_abspath (looking through to the WORKING or BASE tree as 2140 * required), up to and including the root of the working copy and 2141 * any cached inherited properties inherited by the root. 2142 * 2143 * The #svn_prop_inherited_item_t->path_or_url members of the 2144 * #svn_prop_inherited_item_t * structures in @a *iprops are 2145 * paths relative to the repository root URL for cached inherited 2146 * properties and absolute working copy paths otherwise. 2147 * 2148 * If ACTUAL_PROPS is not NULL, then set *ACTUAL_PROPS to the actual 2149 * properties stored on LOCAL_ABSPATH. 2150 * 2151 * Allocate @a *iprops in @a result_pool. Use @a scratch_pool 2152 * for temporary allocations. 2153 */ 2154 svn_error_t * 2155 svn_wc__db_read_inherited_props(apr_array_header_t **iprops, 2156 apr_hash_t **actual_props, 2157 svn_wc__db_t *db, 2158 const char *local_abspath, 2159 const char *propname, 2160 apr_pool_t *result_pool, 2161 apr_pool_t *scratch_pool); 2162 2163 /* Read a BASE node's inherited property information. 2164 2165 Set *IPROPS to to a depth-first ordered array of 2166 svn_prop_inherited_item_t * structures representing the cached 2167 inherited properties for the BASE node at LOCAL_ABSPATH. 2168 2169 If no cached properties are found, then set *IPROPS to NULL. 2170 If LOCAL_ABSPATH represents the root of the repository, then set 2171 *IPROPS to an empty array. 2172 2173 Allocate *IPROPS in RESULT_POOL, use SCRATCH_POOL for temporary 2174 allocations. */ 2175 svn_error_t * 2176 svn_wc__db_read_cached_iprops(apr_array_header_t **iprops, 2177 svn_wc__db_t *db, 2178 const char *local_abspath, 2179 apr_pool_t *result_pool, 2180 apr_pool_t *scratch_pool); 2181 2182 /* Find BASE nodes with cached inherited properties. 2183 2184 Set *IPROPS_PATHS to a hash mapping const char * absolute working copy 2185 paths to the repos_relpath of the path for each path in the working copy 2186 at or below LOCAL_ABSPATH, limited by DEPTH, that has cached inherited 2187 properties for the BASE node of the path. 2188 2189 Allocate *IPROP_PATHS in RESULT_POOL. 2190 Use SCRATCH_POOL for temporary allocations. */ 2191 svn_error_t * 2192 svn_wc__db_get_children_with_cached_iprops(apr_hash_t **iprop_paths, 2193 svn_depth_t depth, 2194 const char *local_abspath, 2195 svn_wc__db_t *db, 2196 apr_pool_t *result_pool, 2197 apr_pool_t *scratch_pool); 2198 2199 /** Obtain a mapping of const char * local_abspaths to const svn_string_t* 2200 * property values in *VALUES, of all PROPNAME properties on LOCAL_ABSPATH 2201 * and its descendants. 2202 * 2203 * Allocate the result in RESULT_POOL, and perform temporary allocations in 2204 * SCRATCH_POOL. 2205 */ 2206 svn_error_t * 2207 svn_wc__db_prop_retrieve_recursive(apr_hash_t **values, 2208 svn_wc__db_t *db, 2209 const char *local_abspath, 2210 const char *propname, 2211 apr_pool_t *result_pool, 2212 apr_pool_t *scratch_pool); 2213 2214 /* Set *CHILDREN to a new array of the (const char *) basenames of the 2215 immediate children of the working node at LOCAL_ABSPATH in DB. 2216 2217 Return every path that refers to a child of the working node at 2218 LOCAL_ABSPATH. Do not include a path just because it was a child of a 2219 deleted directory that existed at LOCAL_ABSPATH if that directory is now 2220 scheduled to be replaced by the working node at LOCAL_ABSPATH. 2221 2222 Allocate *CHILDREN in RESULT_POOL and do temporary allocations in 2223 SCRATCH_POOL. 2224 2225 ### return some basic info for each child? e.g. kind. 2226 ### maybe the data in _read_get_info should be a structure, and this 2227 ### can return a struct for each one. 2228 ### however: _read_get_info can say "not interested", which isn't the 2229 ### case with a struct. thus, a struct requires fetching and/or 2230 ### computing all info. 2231 */ 2232 svn_error_t * 2233 svn_wc__db_read_children_of_working_node(const apr_array_header_t **children, 2234 svn_wc__db_t *db, 2235 const char *local_abspath, 2236 apr_pool_t *result_pool, 2237 apr_pool_t *scratch_pool); 2238 2239 /* Like svn_wc__db_read_children_of_working_node(), except also include any 2240 path that was a child of a deleted directory that existed at 2241 LOCAL_ABSPATH, even if that directory is now scheduled to be replaced by 2242 the working node at LOCAL_ABSPATH. 2243 */ 2244 svn_error_t * 2245 svn_wc__db_read_children(const apr_array_header_t **children, 2246 svn_wc__db_t *db, 2247 const char *local_abspath, 2248 apr_pool_t *result_pool, 2249 apr_pool_t *scratch_pool); 2250 2251 /* Read into *VICTIMS the basenames of the immediate children of 2252 LOCAL_ABSPATH in DB that are conflicted. 2253 2254 In case of tree conflicts a victim doesn't have to be in the 2255 working copy. 2256 2257 Allocate *VICTIMS in RESULT_POOL and do temporary allocations in 2258 SCRATCH_POOL */ 2259 /* ### This function will probably be removed. */ 2260 svn_error_t * 2261 svn_wc__db_read_conflict_victims(const apr_array_header_t **victims, 2262 svn_wc__db_t *db, 2263 const char *local_abspath, 2264 apr_pool_t *result_pool, 2265 apr_pool_t *scratch_pool); 2266 2267 /* Read into *MARKER_FILES the absolute paths of the marker files 2268 of conflicts stored on LOCAL_ABSPATH and its immediate children in DB. 2269 The on-disk files may have been deleted by the user. 2270 2271 Allocate *MARKER_FILES in RESULT_POOL and do temporary allocations 2272 in SCRATCH_POOL */ 2273 svn_error_t * 2274 svn_wc__db_get_conflict_marker_files(apr_hash_t **markers, 2275 svn_wc__db_t *db, 2276 const char *local_abspath, 2277 apr_pool_t *result_pool, 2278 apr_pool_t *scratch_pool); 2279 2280 /* Read the conflict information recorded on LOCAL_ABSPATH in *CONFLICT, 2281 an editable conflict skel. 2282 2283 If the node exists, but does not have a conflict set *CONFLICT to NULL, 2284 otherwise return a SVN_ERR_WC_PATH_NOT_FOUND error. 2285 2286 Allocate *CONFLICTS in RESULT_POOL and do temporary allocations in 2287 SCRATCH_POOL */ 2288 svn_error_t * 2289 svn_wc__db_read_conflict(svn_skel_t **conflict, 2290 svn_wc__db_t *db, 2291 const char *local_abspath, 2292 apr_pool_t *result_pool, 2293 apr_pool_t *scratch_pool); 2294 2295 2296 /* Return the kind of the node in DB at LOCAL_ABSPATH. The WORKING tree will 2297 be examined first, then the BASE tree. If the node is not present in either 2298 tree and ALLOW_MISSING is TRUE, then svn_node_unknown is returned. 2299 If the node is missing and ALLOW_MISSING is FALSE, then it will return 2300 SVN_ERR_WC_PATH_NOT_FOUND. 2301 2302 The SHOW_HIDDEN and SHOW_DELETED flags report certain states as kind none. 2303 2304 When nodes have certain statee they are only reported when: 2305 svn_wc__db_status_not_present when show_hidden && show_deleted 2306 2307 svn_wc__db_status_excluded when show_hidden 2308 svn_wc__db_status_server_excluded when show_hidden 2309 2310 svn_wc__db_status_deleted when show_deleted 2311 2312 In other cases these nodes are reported with *KIND as svn_node_none. 2313 (See also svn_wc_read_kind2()'s documentation) 2314 2315 Uses SCRATCH_POOL for temporary allocations. */ 2316 svn_error_t * 2317 svn_wc__db_read_kind(svn_node_kind_t *kind, 2318 svn_wc__db_t *db, 2319 const char *local_abspath, 2320 svn_boolean_t allow_missing, 2321 svn_boolean_t show_deleted, 2322 svn_boolean_t show_hidden, 2323 apr_pool_t *scratch_pool); 2324 2325 2326 /* An analog to svn_wc__entry_is_hidden(). Set *HIDDEN to TRUE if 2327 LOCAL_ABSPATH in DB "is not present, and I haven't scheduled something 2328 over the top of it." */ 2329 svn_error_t * 2330 svn_wc__db_node_hidden(svn_boolean_t *hidden, 2331 svn_wc__db_t *db, 2332 const char *local_abspath, 2333 apr_pool_t *scratch_pool); 2334 2335 /* Checks if a node replaces a node in a different layer. Also check if it 2336 replaces a BASE (op_depth 0) node or just a node in a higher layer (a copy). 2337 Finally check if this is the root of the replacement, or if the replacement 2338 is initiated by the parent node. 2339 2340 IS_REPLACE_ROOT (if not NULL) is set to TRUE if the node is the root of a 2341 replacement; otherwise to FALSE. 2342 2343 BASE_REPLACE (if not NULL) is set to TRUE if the node directly or indirectly 2344 replaces a node in the BASE tree; otherwise to FALSE. 2345 2346 IS_REPLACE (if not NULL) is set to TRUE if the node directly replaces a node 2347 in a lower layer; otherwise to FALSE. 2348 */ 2349 svn_error_t * 2350 svn_wc__db_node_check_replace(svn_boolean_t *is_replace_root, 2351 svn_boolean_t *base_replace, 2352 svn_boolean_t *is_replace, 2353 svn_wc__db_t *db, 2354 const char *local_abspath, 2355 apr_pool_t *scratch_pool); 2356 2357 /* ### changelists. return an array, or an iterator interface? how big 2358 ### are these things? are we okay with an in-memory array? examine other 2359 ### changelist usage -- we may already assume the list fits in memory. 2360 */ 2361 2362 /* The DB-private version of svn_wc__is_wcroot(), which see. 2363 */ 2364 svn_error_t * 2365 svn_wc__db_is_wcroot(svn_boolean_t *is_wcroot, 2366 svn_wc__db_t *db, 2367 const char *local_abspath, 2368 apr_pool_t *scratch_pool); 2369 2370 /* Check whether a node is a working copy root and/or switched. 2371 2372 If LOCAL_ABSPATH is the root of a working copy, set *IS_WC_ROOT to TRUE, 2373 otherwise to FALSE. 2374 2375 If LOCAL_ABSPATH is switched against its parent in the same working copy 2376 set *IS_SWITCHED to TRUE, otherwise to FALSE. 2377 2378 If KIND is not null, set *KIND to the node type of LOCAL_ABSPATH. 2379 2380 Any of the output arguments can be null to specify that the result is not 2381 interesting to the caller. 2382 2383 Use SCRATCH_POOL for temporary allocations. 2384 */ 2385 svn_error_t * 2386 svn_wc__db_is_switched(svn_boolean_t *is_wcroot, 2387 svn_boolean_t *is_switched, 2388 svn_node_kind_t *kind, 2389 svn_wc__db_t *db, 2390 const char *local_abspath, 2391 apr_pool_t *scratch_pool); 2392 2393 2394 /* @} */ 2395 2396 2397 /* @defgroup svn_wc__db_global Operations that alter multiple trees 2398 @{ 2399 */ 2400 2401 /* Associate LOCAL_DIR_ABSPATH, and all its children with the repository at 2402 at REPOS_ROOT_URL. The relative path to the repos root will not change, 2403 just the repository root. The repos uuid will also remain the same. 2404 This also updates any locks which may exist for the node, as well as any 2405 copyfrom repository information. Finally, the DAV cache (aka 2406 "wcprops") will be reset for affected entries. 2407 2408 Use SCRATCH_POOL for any temporary allocations. 2409 2410 ### local_dir_abspath "should be" the wcroot or a switch root. all URLs 2411 ### under this directory (depth=infinity) will be rewritten. 2412 2413 ### This API had a depth parameter, which was removed, should it be 2414 ### resurrected? What's the purpose if we claim relocate is infinitely 2415 ### recursive? 2416 2417 ### Assuming the future ability to copy across repositories, should we 2418 ### refrain from resetting the copyfrom information in this operation? 2419 */ 2420 svn_error_t * 2421 svn_wc__db_global_relocate(svn_wc__db_t *db, 2422 const char *local_dir_abspath, 2423 const char *repos_root_url, 2424 apr_pool_t *scratch_pool); 2425 2426 2427 /* ### docco 2428 2429 ### collapse the WORKING and ACTUAL tree changes down into BASE, called 2430 for each committed node. 2431 2432 NEW_REVISION must be the revision number of the revision created by 2433 the commit. It will become the BASE node's 'revnum' and 'changed_rev' 2434 values in the BASE_NODE table. 2435 2436 CHANGED_REVISION is the new 'last changed' revision. If the node is 2437 modified its value is equivalent to NEW_REVISION, but in case of a 2438 descendant of a copy/move it can be an older revision. 2439 2440 CHANGED_DATE is the (server-side) date of CHANGED_REVISION. It may be 0 if 2441 the revprop is missing on the revision. 2442 2443 CHANGED_AUTHOR is the (server-side) author of CHANGED_REVISION. It may be 2444 NULL if the revprop is missing on the revision. 2445 2446 One or both of NEW_CHECKSUM and NEW_CHILDREN should be NULL. For new: 2447 files: NEW_CHILDREN should be NULL 2448 dirs: NEW_CHECKSUM should be NULL 2449 symlinks: both should be NULL 2450 2451 WORK_ITEMS will be place into the work queue. 2452 */ 2453 svn_error_t * 2454 svn_wc__db_global_commit(svn_wc__db_t *db, 2455 const char *local_abspath, 2456 svn_revnum_t new_revision, 2457 svn_revnum_t changed_revision, 2458 apr_time_t changed_date, 2459 const char *changed_author, 2460 const svn_checksum_t *new_checksum, 2461 const apr_array_header_t *new_children, 2462 apr_hash_t *new_dav_cache, 2463 svn_boolean_t keep_changelist, 2464 svn_boolean_t no_unlock, 2465 const svn_skel_t *work_items, 2466 apr_pool_t *scratch_pool); 2467 2468 2469 /* ### docco 2470 2471 Perform an "update" operation at this node. It will create/modify a BASE 2472 node, and possibly update the ACTUAL tree's node (e.g put the node into 2473 a conflicted state). 2474 2475 ### there may be cases where we need to tweak an existing WORKING node 2476 2477 ### this operations on a single node, but may affect children 2478 2479 ### the repository cannot be changed with this function, but a "switch" 2480 ### (aka changing repos_relpath) is possible 2481 2482 ### one of NEW_CHILDREN, NEW_CHECKSUM, or NEW_TARGET must be provided. 2483 ### the other two values must be NULL. 2484 ### should this be broken out into an update_(directory|file|symlink) ? 2485 2486 ### how does this differ from base_add_*? just the CONFLICT param. 2487 ### the WORK_ITEMS param is new here, but the base_add_* functions 2488 ### should probably grow that. should we instead just (re)use base_add 2489 ### rather than grow a new function? 2490 2491 ### this does not allow a change of depth 2492 2493 ### we do not update a file's TRANSLATED_SIZE here. at some future point, 2494 ### when the file is installed, then a TRANSLATED_SIZE will be set. 2495 */ 2496 svn_error_t * 2497 svn_wc__db_global_update(svn_wc__db_t *db, 2498 const char *local_abspath, 2499 svn_node_kind_t new_kind, 2500 const char *new_repos_relpath, 2501 svn_revnum_t new_revision, 2502 const apr_hash_t *new_props, 2503 svn_revnum_t new_changed_rev, 2504 apr_time_t new_changed_date, 2505 const char *new_changed_author, 2506 const apr_array_header_t *new_children, 2507 const svn_checksum_t *new_checksum, 2508 const char *new_target, 2509 const apr_hash_t *new_dav_cache, 2510 const svn_skel_t *conflict, 2511 const svn_skel_t *work_items, 2512 apr_pool_t *scratch_pool); 2513 2514 2515 /* Modify the entry of working copy LOCAL_ABSPATH, presumably after an update 2516 of depth DEPTH completes. If LOCAL_ABSPATH doesn't exist, this routine 2517 does nothing. 2518 2519 Set the node's repository relpath, repository root, repository uuid and 2520 revision to NEW_REPOS_RELPATH, NEW_REPOS_ROOT and NEW_REPOS_UUID. If 2521 NEW_REPOS_RELPATH is null, the repository location is untouched; if 2522 NEW_REVISION in invalid, the working revision field is untouched. 2523 The modifications are mutually exclusive. If NEW_REPOS_ROOT is non-NULL, 2524 set the repository root of the entry to NEW_REPOS_ROOT. 2525 2526 If LOCAL_ABSPATH is a directory, then, walk entries below LOCAL_ABSPATH 2527 according to DEPTH thusly: 2528 2529 If DEPTH is svn_depth_infinity, perform the following actions on 2530 every entry below PATH; if svn_depth_immediates, svn_depth_files, 2531 or svn_depth_empty, perform them only on LOCAL_ABSPATH. 2532 2533 If NEW_REVISION is valid, then tweak every entry to have this new 2534 working revision (excluding files that are scheduled for addition 2535 or replacement). Likewise, if BASE_URL is non-null, then rewrite 2536 all urls to be "telescoping" children of the base_url. 2537 2538 EXCLUDE_RELPATHS is a hash containing const char *local_relpath. Nodes 2539 for pathnames contained in EXCLUDE_RELPATHS are not touched by this 2540 function. These pathnames should be paths relative to the wcroot. 2541 2542 If WCROOT_IPROPS is not NULL it is a hash mapping const char * absolute 2543 working copy paths to depth-first ordered arrays of 2544 svn_prop_inherited_item_t * structures. If LOCAL_ABSPATH exists in 2545 WCROOT_IPROPS, then set the hashed value as the node's inherited 2546 properties. 2547 */ 2548 svn_error_t * 2549 svn_wc__db_op_bump_revisions_post_update(svn_wc__db_t *db, 2550 const char *local_abspath, 2551 svn_depth_t depth, 2552 const char *new_repos_relpath, 2553 const char *new_repos_root_url, 2554 const char *new_repos_uuid, 2555 svn_revnum_t new_revision, 2556 apr_hash_t *exclude_relpaths, 2557 apr_hash_t *wcroot_iprops, 2558 svn_wc_notify_func2_t notify_func, 2559 void *notify_baton, 2560 apr_pool_t *scratch_pool); 2561 2562 2563 /* Record the RECORDED_SIZE and RECORDED_TIME for a versioned node. 2564 2565 This function will record the information within the WORKING node, 2566 if present, or within the BASE tree. If neither node is present, then 2567 SVN_ERR_WC_PATH_NOT_FOUND will be returned. 2568 2569 RECORDED_SIZE may be SVN_INVALID_FILESIZE, which will be recorded 2570 as such, implying "unknown size". 2571 2572 RECORDED_TIME may be 0, which will be recorded as such, implying 2573 "unknown last mod time". 2574 */ 2575 svn_error_t * 2576 svn_wc__db_global_record_fileinfo(svn_wc__db_t *db, 2577 const char *local_abspath, 2578 svn_filesize_t recorded_size, 2579 apr_time_t recorded_time, 2580 apr_pool_t *scratch_pool); 2581 2582 2583 /* ### post-commit handling. 2584 ### maybe multiple phases? 2585 ### 1) mark a changelist as being-committed 2586 ### 2) collect ACTUAL content, store for future use as TEXTBASE 2587 ### 3) caller performs commit 2588 ### 4) post-commit, integrate changelist into BASE 2589 */ 2590 2591 2592 /* @} */ 2593 2594 2595 /* @defgroup svn_wc__db_lock Function to manage the LOCKS table. 2596 @{ 2597 */ 2598 2599 /* Add or replace LOCK for LOCAL_ABSPATH to DB. */ 2600 svn_error_t * 2601 svn_wc__db_lock_add(svn_wc__db_t *db, 2602 const char *local_abspath, 2603 const svn_wc__db_lock_t *lock, 2604 apr_pool_t *scratch_pool); 2605 2606 2607 /* Remove any lock for LOCAL_ABSPATH in DB. */ 2608 svn_error_t * 2609 svn_wc__db_lock_remove(svn_wc__db_t *db, 2610 const char *local_abspath, 2611 apr_pool_t *scratch_pool); 2612 2613 2614 /* @} */ 2615 2616 2617 /* @defgroup svn_wc__db_scan Functions to scan up a tree for further data. 2618 @{ 2619 */ 2620 2621 /* Read a BASE node's repository information. 2622 2623 For the BASE node implied by LOCAL_ABSPATH, its location in the repository 2624 returned in *REPOS_ROOT_URL and *REPOS_UUID will be returned in 2625 *REPOS_RELPATH. Any of the OUT parameters may be NULL, indicating no 2626 interest in that piece of information. 2627 2628 All returned data will be allocated in RESULT_POOL. All temporary 2629 allocations will be made in SCRATCH_POOL. 2630 2631 ### Either delete this function and use _base_get_info instead, or 2632 ### add a 'revision' output to make a complete repository node location 2633 ### and rename to not say 'scan', because it doesn't. 2634 */ 2635 svn_error_t * 2636 svn_wc__db_scan_base_repos(const char **repos_relpath, 2637 const char **repos_root_url, 2638 const char **repos_uuid, 2639 svn_wc__db_t *db, 2640 const char *local_abspath, 2641 apr_pool_t *result_pool, 2642 apr_pool_t *scratch_pool); 2643 2644 2645 /* Scan upwards for information about a known addition to the WORKING tree. 2646 2647 IFF a node's status as returned by svn_wc__db_read_info() is 2648 svn_wc__db_status_added (NOT obstructed_add!), then this function 2649 returns a refined status in *STATUS, which is one of: 2650 2651 svn_wc__db_status_added -- this NODE is a simple add without history. 2652 OP_ROOT_ABSPATH will be set to the topmost node in the added subtree 2653 (implying its parent will be an unshadowed BASE node). The REPOS_* 2654 values will be implied by that ancestor BASE node and this node's 2655 position in the added subtree. ORIGINAL_* will be set to their 2656 NULL values (and SVN_INVALID_REVNUM for ORIGINAL_REVISION). 2657 2658 svn_wc__db_status_copied -- this NODE is the root or child of a copy. 2659 The root of the copy will be stored in OP_ROOT_ABSPATH. Note that 2660 the parent of the operation root could be another WORKING node (from 2661 an add, copy, or move). The REPOS_* values will be implied by the 2662 ancestor unshadowed BASE node. ORIGINAL_* will indicate the source 2663 of the copy. 2664 2665 svn_wc__db_status_incomplete -- this NODE is copied but incomplete. 2666 2667 svn_wc__db_status_moved_here -- this NODE arrived as a result of a move. 2668 The root of the moved nodes will be stored in OP_ROOT_ABSPATH. 2669 Similar to the copied state, its parent may be a WORKING node or a 2670 BASE node. And again, the REPOS_* values are implied by this node's 2671 position in the subtree under the ancestor unshadowed BASE node. 2672 ORIGINAL_* will indicate the source of the move. 2673 2674 All OUT parameters may be NULL to indicate a lack of interest in 2675 that piece of information. 2676 2677 STATUS, OP_ROOT_ABSPATH, and REPOS_* will always be assigned a value 2678 if that information is requested (and assuming a successful return). 2679 2680 ORIGINAL_REPOS_RELPATH will refer to the *root* of the operation. It 2681 does *not* correspond to the node given by LOCAL_ABSPATH. The caller 2682 can use the suffix on LOCAL_ABSPATH (relative to OP_ROOT_ABSPATH) in 2683 order to compute the source node which corresponds to LOCAL_ABSPATH. 2684 2685 If the node given by LOCAL_ABSPATH does not have changes recorded in 2686 the WORKING tree, then SVN_ERR_WC_PATH_NOT_FOUND is returned. If it 2687 doesn't have an "added" status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS 2688 will be returned. 2689 2690 All returned data will be allocated in RESULT_POOL. All temporary 2691 allocations will be made in SCRATCH_POOL. 2692 */ 2693 svn_error_t * 2694 svn_wc__db_scan_addition(svn_wc__db_status_t *status, 2695 const char **op_root_abspath, 2696 const char **repos_relpath, 2697 const char **repos_root_url, 2698 const char **repos_uuid, 2699 const char **original_repos_relpath, 2700 const char **original_root_url, 2701 const char **original_uuid, 2702 svn_revnum_t *original_revision, 2703 svn_wc__db_t *db, 2704 const char *local_abspath, 2705 apr_pool_t *result_pool, 2706 apr_pool_t *scratch_pool); 2707 2708 /* Scan the working copy for move information of the node LOCAL_ABSPATH. 2709 * If LOCAL_ABSPATH return a SVN_ERR_WC_PATH_UNEXPECTED_STATUS error. 2710 * 2711 * If not NULL *MOVED_FROM_ABSPATH will be set to the previous location 2712 * of LOCAL_ABSPATH, before it or an ancestror was moved. 2713 * 2714 * If not NULL *OP_ROOT_ABSPATH will be set to the new location of the 2715 * path that was actually moved 2716 * 2717 * If not NULL *OP_ROOT_MOVED_FROM_ABSPATH will be set to the old location 2718 * of the path that was actually moved. 2719 * 2720 * If not NULL *MOVED_FROM_DELETE_ABSPATH will be set to the ancestor of the 2721 * moved from location that deletes the original location 2722 * 2723 * Given a working copy 2724 * A/B/C 2725 * svn mv A/B D 2726 * svn rm A 2727 * 2728 * You can call this function on D and D/C. When called on D/C all output 2729 * MOVED_FROM_ABSPATH will be A/B/C 2730 * OP_ROOT_ABSPATH will be D 2731 * OP_ROOT_MOVED_FROM_ABSPATH will be A/B 2732 * MOVED_FROM_DELETE_ABSPATH will be A 2733 */ 2734 svn_error_t * 2735 svn_wc__db_scan_moved(const char **moved_from_abspath, 2736 const char **op_root_abspath, 2737 const char **op_root_moved_from_abspath, 2738 const char **moved_from_delete_abspath, 2739 svn_wc__db_t *db, 2740 const char *local_abspath, 2741 apr_pool_t *result_pool, 2742 apr_pool_t *scratch_pool); 2743 2744 /* Scan upwards for additional information about a deleted node. 2745 2746 When a deleted node is discovered in the WORKING tree, the situation 2747 may be quite complex. This function will provide the information to 2748 resolve the circumstances of the deletion. 2749 2750 For discussion purposes, we will start with the most complex example 2751 and then demonstrate simplified examples. Consider node B/W/D/N has been 2752 found as deleted. B is an unmodified directory (thus, only in BASE). W is 2753 "replacement" content that exists in WORKING, shadowing a similar B/W 2754 directory in BASE. D is a deleted subtree in the WORKING tree, and N is 2755 the deleted node. 2756 2757 In this example, BASE_DEL_ABSPATH will bet set to B/W. That is the root of 2758 the BASE tree (implicitly) deleted by the replacement. WORK_DEL_ABSPATH 2759 will be set to the subtree deleted within the replacement; in this case, 2760 B/W/D. No move-away took place, so MOVED_TO_ABSPATH is set to NULL. 2761 2762 In another scenario, B/W was moved-away before W was put into the WORKING 2763 tree through an add/copy/move-here. MOVED_TO_ABSPATH will indicate where 2764 B/W was moved to. Note that further operations may have been performed 2765 post-move, but that is not known or reported by this function. 2766 2767 If BASE does not have a B/W, then the WORKING B/W is not a replacement, 2768 but a simple add/copy/move-here. BASE_DEL_ABSPATH will be set to NULL. 2769 2770 If B/W/D does not exist in the WORKING tree (we're only talking about a 2771 deletion of nodes of the BASE tree), then deleting B/W/D would have marked 2772 the subtree for deletion. BASE_DEL_ABSPATH will refer to B/W/D, 2773 MOVED_TO_ABSPATH will be NULL, and WORK_DEL_ABSPATH will be NULL. 2774 2775 If the BASE node B/W/D was moved instead of deleted, then MOVED_TO_ABSPATH 2776 would indicate the target location (and other OUT values as above). 2777 2778 When the user deletes B/W/D from the WORKING tree, there are a few 2779 additional considerations. If B/W is a simple addition (not a copy or 2780 a move-here), then the deletion will simply remove the nodes from WORKING 2781 and possibly leave behind "base-delete" markers in the WORKING tree. 2782 If the source is a copy/moved-here, then the nodes are replaced with 2783 deletion markers. 2784 2785 If the user moves-away B/W/D from the WORKING tree, then behavior is 2786 again dependent upon the origination of B/W. For a plain add, the nodes 2787 simply move to the destination; this means that B/W/D ceases to be a 2788 node and so cannot be scanned. For a copy, a deletion is made at B/W/D, 2789 and a new copy (of a subtree of the original source) is made at the 2790 destination. For a move-here, a deletion is made, and a copy is made at 2791 the destination (we do not track multiple moves; the source is moved to 2792 B/W, then B/W/D is deleted; then a copy is made at the destination; 2793 however, note the double-move could have been performed by moving the 2794 subtree first, then moving the source to B/W). 2795 2796 There are three further considerations when resolving a deleted node: 2797 2798 If the BASE B/W/D was deleted explicitly *and* B/W is a replacement, 2799 then the explicit deletion is subsumed by the implicit deletion that 2800 occurred with the B/W replacement. Thus, BASE_DEL_ABSPATH will point 2801 to B/W as the root of the BASE deletion. IOW, we can detect the 2802 explicit move-away, but not an explicit deletion. 2803 2804 If B/W/D/N refers to a node present in the BASE tree, and B/W was 2805 replaced by a shallow subtree, then it is possible for N to be 2806 reported as deleted (from BASE) yet no deletions occurred in the 2807 WORKING tree above N. Thus, WORK_DEL_ABSPATH will be set to NULL. 2808 2809 2810 Summary of OUT parameters: 2811 2812 BASE_DEL_ABSPATH will specify the nearest ancestor of the explicit or 2813 implicit deletion (if any) that applies to the BASE tree. 2814 2815 WORK_DEL_ABSPATH will specify the root of a deleted subtree within 2816 the WORKING tree (note there is no concept of layered delete operations 2817 in WORKING, so there is only one deletion root in the ancestry). 2818 2819 MOVED_TO_ABSPATH will specify the path where this node was moved to 2820 if the node has moved-away. 2821 2822 If the node was moved-away, MOVED_TO_OP_ROOT_ABSPATH will specify the 2823 target path of the root of the move operation. If LOCAL_ABSPATH itself 2824 is the source path of the root of the move operation, then 2825 MOVED_TO_OP_ROOT_ABSPATH equals MOVED_TO_ABSPATH. 2826 2827 All OUT parameters may be set to NULL to indicate a lack of interest in 2828 that piece of information. 2829 2830 If the node given by LOCAL_ABSPATH does not exist, then 2831 SVN_ERR_WC_PATH_NOT_FOUND is returned. If it doesn't have a "deleted" 2832 status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS will be returned. 2833 2834 All returned data will be allocated in RESULT_POOL. All temporary 2835 allocations will be made in SCRATCH_POOL. 2836 */ 2837 svn_error_t * 2838 svn_wc__db_scan_deletion(const char **base_del_abspath, 2839 const char **moved_to_abspath, 2840 const char **work_del_abspath, 2841 const char **moved_to_op_root_abspath, 2842 svn_wc__db_t *db, 2843 const char *local_abspath, 2844 apr_pool_t *result_pool, 2845 apr_pool_t *scratch_pool); 2846 2847 2848 /* @} */ 2849 2850 2851 /* @defgroup svn_wc__db_upgrade Functions for upgrading a working copy. 2852 @{ 2853 */ 2854 2855 /* Installs or updates Sqlite schema statistics for the current (aka latest) 2856 working copy schema. 2857 2858 This function should be called once on initializing the database and after 2859 an schema update completes */ 2860 svn_error_t * 2861 svn_wc__db_install_schema_statistics(svn_sqlite__db_t *sdb, 2862 apr_pool_t *scratch_pool); 2863 2864 2865 /* Create a new wc.db file for LOCAL_DIR_ABSPATH, which is going to be a 2866 working copy for the repository REPOS_ROOT_URL with uuid REPOS_UUID. 2867 Return the raw sqlite handle, repository id and working copy id 2868 and store the database in WC_DB. 2869 2870 Perform temporary allocations in SCRATCH_POOL. */ 2871 svn_error_t * 2872 svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb, 2873 apr_int64_t *repos_id, 2874 apr_int64_t *wc_id, 2875 svn_wc__db_t *wc_db, 2876 const char *local_dir_abspath, 2877 const char *repos_root_url, 2878 const char *repos_uuid, 2879 apr_pool_t *scratch_pool); 2880 2881 2882 svn_error_t * 2883 svn_wc__db_upgrade_apply_dav_cache(svn_sqlite__db_t *sdb, 2884 const char *dir_relpath, 2885 apr_hash_t *cache_values, 2886 apr_pool_t *scratch_pool); 2887 2888 2889 /* ### need much more docco 2890 2891 ### this function should be called within a sqlite transaction. it makes 2892 ### assumptions around this fact. 2893 2894 Apply the various sets of properties to the database nodes based on 2895 their existence/presence, the current state of the node, and the original 2896 format of the working copy which provided these property sets. 2897 */ 2898 svn_error_t * 2899 svn_wc__db_upgrade_apply_props(svn_sqlite__db_t *sdb, 2900 const char *dir_abspath, 2901 const char *local_relpath, 2902 apr_hash_t *base_props, 2903 apr_hash_t *revert_props, 2904 apr_hash_t *working_props, 2905 int original_format, 2906 apr_int64_t wc_id, 2907 apr_pool_t *scratch_pool); 2908 2909 /* Simply insert (or replace) one row in the EXTERNALS table. */ 2910 svn_error_t * 2911 svn_wc__db_upgrade_insert_external(svn_wc__db_t *db, 2912 const char *local_abspath, 2913 svn_node_kind_t kind, 2914 const char *parent_abspath, 2915 const char *def_local_abspath, 2916 const char *repos_relpath, 2917 const char *repos_root_url, 2918 const char *repos_uuid, 2919 svn_revnum_t def_peg_revision, 2920 svn_revnum_t def_revision, 2921 apr_pool_t *scratch_pool); 2922 2923 /* Get the repository identifier corresponding to REPOS_ROOT_URL from the 2924 database in SDB. The value is returned in *REPOS_ID. All allocations 2925 are allocated in SCRATCH_POOL. 2926 2927 NOTE: the row in REPOSITORY must exist. If not, then SVN_ERR_WC_DB_ERROR 2928 is returned. 2929 2930 ### unclear on whether/how this interface will stay/evolve. */ 2931 svn_error_t * 2932 svn_wc__db_upgrade_get_repos_id(apr_int64_t *repos_id, 2933 svn_sqlite__db_t *sdb, 2934 const char *repos_root_url, 2935 apr_pool_t *scratch_pool); 2936 2937 /* Upgrade the metadata concerning the WC at WCROOT_ABSPATH, in DB, 2938 * to the SVN_WC__VERSION format. 2939 * 2940 * This function is used for upgrading wc-ng working copies to a newer 2941 * wc-ng format. If a pre-1.7 working copy is found, this function 2942 * returns SVN_ERR_WC_UPGRADE_REQUIRED. 2943 * 2944 * Upgrading subdirectories of a working copy is not supported. 2945 * If WCROOT_ABSPATH is not a working copy root SVN_ERR_WC_INVALID_OP_ON_CWD 2946 * is returned. 2947 * 2948 * If BUMPED_FORMAT is not NULL, set *BUMPED_FORMAT to TRUE if the format 2949 * was bumped or to FALSE if the wc was already at the resulting format. 2950 */ 2951 svn_error_t * 2952 svn_wc__db_bump_format(int *result_format, 2953 svn_boolean_t *bumped_format, 2954 svn_wc__db_t *db, 2955 const char *wcroot_abspath, 2956 apr_pool_t *scratch_pool); 2957 2958 /* @} */ 2959 2960 2961 /* @defgroup svn_wc__db_wq Work queue manipulation. see workqueue.h 2962 @{ 2963 */ 2964 2965 /* In the WCROOT associated with DB and WRI_ABSPATH, add WORK_ITEM to the 2966 wcroot's work queue. Use SCRATCH_POOL for all temporary allocations. */ 2967 svn_error_t * 2968 svn_wc__db_wq_add(svn_wc__db_t *db, 2969 const char *wri_abspath, 2970 const svn_skel_t *work_item, 2971 apr_pool_t *scratch_pool); 2972 2973 2974 /* In the WCROOT associated with DB and WRI_ABSPATH, fetch a work item that 2975 needs to be completed. Its identifier is returned in ID, and the data in 2976 WORK_ITEM. 2977 2978 Items are returned in the same order they were queued. This allows for 2979 (say) queueing work on a parent node to be handled before that of its 2980 children. 2981 2982 If there are no work items to be completed, then ID will be set to zero, 2983 and WORK_ITEM to NULL. 2984 2985 If COMPLETED_ID is not 0, the wq item COMPLETED_ID will be marked as 2986 completed before returning the next item. 2987 2988 RESULT_POOL will be used to allocate WORK_ITEM, and SCRATCH_POOL 2989 will be used for all temporary allocations. */ 2990 svn_error_t * 2991 svn_wc__db_wq_fetch_next(apr_uint64_t *id, 2992 svn_skel_t **work_item, 2993 svn_wc__db_t *db, 2994 const char *wri_abspath, 2995 apr_uint64_t completed_id, 2996 apr_pool_t *result_pool, 2997 apr_pool_t *scratch_pool); 2998 2999 /* Special variant of svn_wc__db_wq_fetch_next(), which in the same transaction 3000 also records timestamps and sizes for one or more nodes */ 3001 svn_error_t * 3002 svn_wc__db_wq_record_and_fetch_next(apr_uint64_t *id, 3003 svn_skel_t **work_item, 3004 svn_wc__db_t *db, 3005 const char *wri_abspath, 3006 apr_uint64_t completed_id, 3007 apr_hash_t *record_map, 3008 apr_pool_t *result_pool, 3009 apr_pool_t *scratch_pool); 3010 3011 3012 /* @} */ 3013 3014 3015 /* Note: LEVELS_TO_LOCK is here strictly for backward compat. The access 3016 batons still have the notion of 'levels to lock' and we need to ensure 3017 that they still function correctly, even in the new world. 'levels to 3018 lock' should not be exposed through the wc-ng APIs at all: users either 3019 get to lock the entire tree (rooted at some subdir, of course), or none. 3020 3021 An infinite depth lock is obtained with LEVELS_TO_LOCK set to -1, but until 3022 we move to a single DB only depth 0 is supported. 3023 */ 3024 svn_error_t * 3025 svn_wc__db_wclock_obtain(svn_wc__db_t *db, 3026 const char *local_abspath, 3027 int levels_to_lock, 3028 svn_boolean_t steal_lock, 3029 apr_pool_t *scratch_pool); 3030 3031 /* Set LOCK_ABSPATH to the path of the the directory that owns the 3032 lock on LOCAL_ABSPATH, or NULL, if LOCAL_ABSPATH is not locked. */ 3033 svn_error_t* 3034 svn_wc__db_wclock_find_root(const char **lock_abspath, 3035 svn_wc__db_t *db, 3036 const char *local_abspath, 3037 apr_pool_t *result_pool, 3038 apr_pool_t *scratch_pool); 3039 3040 /* Check if somebody has a wclock on LOCAL_ABSPATH */ 3041 svn_error_t * 3042 svn_wc__db_wclocked(svn_boolean_t *locked, 3043 svn_wc__db_t *db, 3044 const char *local_abspath, 3045 apr_pool_t *scratch_pool); 3046 3047 /* Release the previously obtained lock on LOCAL_ABSPATH */ 3048 svn_error_t * 3049 svn_wc__db_wclock_release(svn_wc__db_t *db, 3050 const char *local_abspath, 3051 apr_pool_t *scratch_pool); 3052 3053 /* Checks whether DB currently owns a lock to operate on LOCAL_ABSPATH. 3054 If EXACT is TRUE only lock roots are checked. */ 3055 svn_error_t * 3056 svn_wc__db_wclock_owns_lock(svn_boolean_t *own_lock, 3057 svn_wc__db_t *db, 3058 const char *local_abspath, 3059 svn_boolean_t exact, 3060 apr_pool_t *scratch_pool); 3061 3062 3063 3064 /* @defgroup svn_wc__db_temp Various temporary functions during transition 3065 3066 ### These functions SHOULD be completely removed before 1.7 3067 3068 @{ 3069 */ 3070 3071 /* Removes all references to LOCAL_ABSPATH from DB, while optionally leaving 3072 a not present node. 3073 3074 This operation always recursively removes all nodes at and below 3075 LOCAL_ABSPATH from NODES and ACTUAL. 3076 3077 If NOT_PRESENT_REVISION specifies a valid revision, leave a not_present 3078 BASE node at local_abspath of the specified status and kind. 3079 (Requires an existing BASE node before removing) 3080 3081 If DESTROY_WC is TRUE, this operation *installs* workqueue operations to 3082 update the local filesystem after the database operation. If DESTROY_CHANGES 3083 is FALSE, modified and unversioned files are left after running this 3084 operation (and the WQ). If DESTROY_CHANGES and DESTROY_WC are TRUE, 3085 LOCAL_ABSPATH and everything below it will be removed by the WQ. 3086 3087 3088 Note: Unlike many similar functions it is a valid scenario for this 3089 function to be called on a wcroot! In this case it will just leave the root 3090 record in BASE 3091 */ 3092 svn_error_t * 3093 svn_wc__db_op_remove_node(svn_boolean_t *left_changes, 3094 svn_wc__db_t *db, 3095 const char *local_abspath, 3096 svn_boolean_t destroy_wc, 3097 svn_boolean_t destroy_changes, 3098 svn_revnum_t not_present_revision, 3099 svn_wc__db_status_t not_present_status, 3100 svn_node_kind_t not_present_kind, 3101 const svn_skel_t *conflict, 3102 const svn_skel_t *work_items, 3103 svn_cancel_func_t cancel_func, 3104 void *cancel_baton, 3105 apr_pool_t *scratch_pool); 3106 3107 /* Sets the depth of LOCAL_ABSPATH in its working copy to DEPTH using DB. 3108 3109 Returns SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not a BASE directory 3110 */ 3111 svn_error_t * 3112 svn_wc__db_op_set_base_depth(svn_wc__db_t *db, 3113 const char *local_abspath, 3114 svn_depth_t depth, 3115 apr_pool_t *scratch_pool); 3116 3117 /* ### temp function. return the FORMAT for the directory LOCAL_ABSPATH. */ 3118 svn_error_t * 3119 svn_wc__db_temp_get_format(int *format, 3120 svn_wc__db_t *db, 3121 const char *local_dir_abspath, 3122 apr_pool_t *scratch_pool); 3123 3124 /* ### temp functions to manage/store access batons within the DB. */ 3125 svn_wc_adm_access_t * 3126 svn_wc__db_temp_get_access(svn_wc__db_t *db, 3127 const char *local_dir_abspath, 3128 apr_pool_t *scratch_pool); 3129 void 3130 svn_wc__db_temp_set_access(svn_wc__db_t *db, 3131 const char *local_dir_abspath, 3132 svn_wc_adm_access_t *adm_access, 3133 apr_pool_t *scratch_pool); 3134 svn_error_t * 3135 svn_wc__db_temp_close_access(svn_wc__db_t *db, 3136 const char *local_dir_abspath, 3137 svn_wc_adm_access_t *adm_access, 3138 apr_pool_t *scratch_pool); 3139 void 3140 svn_wc__db_temp_clear_access(svn_wc__db_t *db, 3141 const char *local_dir_abspath, 3142 apr_pool_t *scratch_pool); 3143 3144 /* ### shallow hash: abspath -> svn_wc_adm_access_t * */ 3145 apr_hash_t * 3146 svn_wc__db_temp_get_all_access(svn_wc__db_t *db, 3147 apr_pool_t *result_pool); 3148 3149 /* ### temp function to open the sqlite database to the appropriate location, 3150 ### then borrow it for a bit. 3151 ### The *only* reason for this function is because entries.c still 3152 ### manually hacks the sqlite database. 3153 3154 ### No matter how tempted you may be DO NOT USE THIS FUNCTION! 3155 ### (if you do, gstein will hunt you down and burn your knee caps off 3156 ### in the middle of the night) 3157 ### "Bet on it." --gstein 3158 */ 3159 svn_error_t * 3160 svn_wc__db_temp_borrow_sdb(svn_sqlite__db_t **sdb, 3161 svn_wc__db_t *db, 3162 const char *local_dir_abspath, 3163 apr_pool_t *scratch_pool); 3164 3165 3166 /* Return a directory in *TEMP_DIR_ABSPATH that is suitable for temporary 3167 files which may need to be moved (atomically and same-device) into the 3168 working copy indicated by WRI_ABSPATH. */ 3169 svn_error_t * 3170 svn_wc__db_temp_wcroot_tempdir(const char **temp_dir_abspath, 3171 svn_wc__db_t *db, 3172 const char *wri_abspath, 3173 apr_pool_t *result_pool, 3174 apr_pool_t *scratch_pool); 3175 3176 /* Update the BASE_NODE of directory LOCAL_ABSPATH to be NEW_REPOS_RELPATH 3177 at revision NEW_REV with status incomplete. */ 3178 svn_error_t * 3179 svn_wc__db_temp_op_start_directory_update(svn_wc__db_t *db, 3180 const char *local_abspath, 3181 const char *new_repos_relpath, 3182 svn_revnum_t new_rev, 3183 apr_pool_t *scratch_pool); 3184 3185 /* Marks a directory update started with 3186 svn_wc__db_temp_op_start_directory_update as completed, by removing 3187 the incomplete status */ 3188 svn_error_t * 3189 svn_wc__db_temp_op_end_directory_update(svn_wc__db_t *db, 3190 const char *local_dir_abspath, 3191 apr_pool_t *scratch_pool); 3192 3193 3194 /* Copy the base tree at LOCAL_ABSPATH into the working tree as copy, 3195 leaving any subtree additions and copies as-is. This allows the 3196 base node tree to be removed. */ 3197 svn_error_t * 3198 svn_wc__db_op_make_copy(svn_wc__db_t *db, 3199 const char *local_abspath, 3200 const svn_skel_t *conflicts, 3201 const svn_skel_t *work_items, 3202 apr_pool_t *scratch_pool); 3203 3204 /* Close the wc root LOCAL_ABSPATH and remove any per-directory 3205 handles associated with it. */ 3206 svn_error_t * 3207 svn_wc__db_drop_root(svn_wc__db_t *db, 3208 const char *local_abspath, 3209 apr_pool_t *scratch_pool); 3210 3211 /* Return the OP_DEPTH for LOCAL_RELPATH. */ 3212 int 3213 svn_wc__db_op_depth_for_upgrade(const char *local_relpath); 3214 3215 /* Set *HAVE_WORK TRUE if there is a working layer below the top layer and 3216 *HAVE_BASE if there is a base layer. Set *STATUS to the status of the 3217 highest layer below WORKING */ 3218 svn_error_t * 3219 svn_wc__db_info_below_working(svn_boolean_t *have_base, 3220 svn_boolean_t *have_work, 3221 svn_wc__db_status_t *status, 3222 svn_wc__db_t *db, 3223 const char *local_abspath, 3224 apr_pool_t *scratch_pool); 3225 3226 3227 /* Gets an array of const char *local_relpaths of descendants of LOCAL_ABSPATH, 3228 * which itself must be the op root of an addition, copy or move. 3229 * The descendants returned are at the same op_depth, but are to be deleted 3230 * by the commit processing because they are not present in the local copy. 3231 */ 3232 svn_error_t * 3233 svn_wc__db_get_not_present_descendants(const apr_array_header_t **descendants, 3234 svn_wc__db_t *db, 3235 const char *local_abspath, 3236 apr_pool_t *result_pool, 3237 apr_pool_t *scratch_pool); 3238 3239 /* Gather revision status information about a working copy using DB. 3240 * 3241 * Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision 3242 * numbers found within LOCAL_ABSPATH. 3243 * Only nodes with op_depth zero and presence 'normal' or 'incomplete' 3244 * are considered, so that added, deleted or excluded nodes do not affect 3245 * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION 3246 * to the lowest and highest committed (i.e. "last changed") revision numbers, 3247 * respectively. 3248 * 3249 * Indicate in *IS_SPARSE_CHECKOUT whether any of the nodes within 3250 * LOCAL_ABSPATH is sparse. 3251 * Indicate in *IS_MODIFIED whether the working copy has local modifications. 3252 * 3253 * Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH 3254 * is switched. If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH 3255 * itself is switched. It should be any trailing portion of LOCAL_ABSPATH's 3256 * expected URL, long enough to include any parts that the caller considers 3257 * might be changed by a switch. If it does not match the end of WC_PATH's 3258 * actual URL, then report a "switched" status. 3259 * 3260 * See also the functions below which provide a subset of this functionality. 3261 */ 3262 svn_error_t * 3263 svn_wc__db_revision_status(svn_revnum_t *min_revision, 3264 svn_revnum_t *max_revision, 3265 svn_boolean_t *is_sparse_checkout, 3266 svn_boolean_t *is_modified, 3267 svn_boolean_t *is_switched, 3268 svn_wc__db_t *db, 3269 const char *local_abspath, 3270 const char *trail_url, 3271 svn_boolean_t committed, 3272 svn_cancel_func_t cancel_func, 3273 void *cancel_baton, 3274 apr_pool_t *scratch_pool); 3275 3276 /* Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision 3277 * numbers found within LOCAL_ABSPATH in the working copy using DB. 3278 * Only nodes with op_depth zero and presence 'normal' or 'incomplete' 3279 * are considered, so that added, deleted or excluded nodes do not affect 3280 * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION 3281 * to the lowest and highest committed (i.e. "last changed") revision numbers, 3282 * respectively. Use SCRATCH_POOL for temporary allocations. 3283 * 3284 * Either of MIN_REVISION and MAX_REVISION may be passed as NULL if 3285 * the caller doesn't care about that return value. 3286 * 3287 * This function provides a subset of the functionality of 3288 * svn_wc__db_revision_status() and is more efficient if the caller 3289 * doesn't need all information returned by svn_wc__db_revision_status(). */ 3290 svn_error_t * 3291 svn_wc__db_min_max_revisions(svn_revnum_t *min_revision, 3292 svn_revnum_t *max_revision, 3293 svn_wc__db_t *db, 3294 const char *local_abspath, 3295 svn_boolean_t committed, 3296 apr_pool_t *scratch_pool); 3297 3298 /* Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH 3299 * is switched, using DB. Use SCRATCH_POOL for temporary allocations. 3300 * 3301 * If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH itself 3302 * is switched. It should be any trailing portion of LOCAL_ABSPATH's 3303 * expected URL, long enough to include any parts that the caller considers 3304 * might be changed by a switch. If it does not match the end of WC_PATH's 3305 * actual URL, then report a "switched" status. 3306 * 3307 * This function provides a subset of the functionality of 3308 * svn_wc__db_revision_status() and is more efficient if the caller 3309 * doesn't need all information returned by svn_wc__db_revision_status(). */ 3310 svn_error_t * 3311 svn_wc__db_has_switched_subtrees(svn_boolean_t *is_switched, 3312 svn_wc__db_t *db, 3313 const char *local_abspath, 3314 const char *trail_url, 3315 apr_pool_t *scratch_pool); 3316 3317 /* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt> 3318 * local absolute paths to <tt>const char *</tt> local absolute paths for 3319 * every path under @a local_abspath in @a db which are excluded by 3320 * the server (e.g. due to authz), or user. If no such paths are found then 3321 * @a *server_excluded_subtrees is set to @c NULL. 3322 * Allocate the hash and all items therein from @a result_pool. 3323 */ 3324 svn_error_t * 3325 svn_wc__db_get_excluded_subtrees(apr_hash_t **server_excluded_subtrees, 3326 svn_wc__db_t *db, 3327 const char *local_abspath, 3328 apr_pool_t *result_pool, 3329 apr_pool_t *scratch_pool); 3330 3331 /* Indicate in *IS_MODIFIED whether the working copy has local modifications, 3332 * using DB. Use SCRATCH_POOL for temporary allocations. 3333 * 3334 * This function provides a subset of the functionality of 3335 * svn_wc__db_revision_status() and is more efficient if the caller 3336 * doesn't need all information returned by svn_wc__db_revision_status(). */ 3337 svn_error_t * 3338 svn_wc__db_has_local_mods(svn_boolean_t *is_modified, 3339 svn_wc__db_t *db, 3340 const char *local_abspath, 3341 svn_cancel_func_t cancel_func, 3342 void *cancel_baton, 3343 apr_pool_t *scratch_pool); 3344 3345 3346 /* Verify the consistency of metadata concerning the WC that contains 3347 * WRI_ABSPATH, in DB. Return an error if any problem is found. */ 3348 svn_error_t * 3349 svn_wc__db_verify(svn_wc__db_t *db, 3350 const char *wri_abspath, 3351 apr_pool_t *scratch_pool); 3352 3353 3354 /* Possibly need two structures, one with relpaths and with abspaths? 3355 * Only exposed for testing at present. */ 3356 struct svn_wc__db_moved_to_t { 3357 const char *local_relpath; /* moved-to destination */ 3358 int op_depth; /* op-root of source */ 3359 }; 3360 3361 /* Set *FINAL_ABSPATH to an array of svn_wc__db_moved_to_t for 3362 * LOCAL_ABSPATH after following any and all nested moves. 3363 * Only exposed for testing at present. */ 3364 svn_error_t * 3365 svn_wc__db_follow_moved_to(apr_array_header_t **moved_tos, 3366 svn_wc__db_t *db, 3367 const char *local_abspath, 3368 apr_pool_t *result_pool, 3369 apr_pool_t *scratch_pool); 3370 3371 /* Update a moved-away tree conflict victim at VICTIM_ABSPATH with changes 3372 * brought in by the update operation which flagged the tree conflict. */ 3373 svn_error_t * 3374 svn_wc__db_update_moved_away_conflict_victim(svn_wc__db_t *db, 3375 const char *victim_abspath, 3376 svn_wc_notify_func2_t notify_func, 3377 void *notify_baton, 3378 svn_cancel_func_t cancel_func, 3379 void *cancel_baton, 3380 apr_pool_t *scratch_pool); 3381 3382 /* LOCAL_ABSPATH is moved to MOVE_DST_ABSPATH. MOVE_SRC_ROOT_ABSPATH 3383 * is the root of the move to MOVE_DST_OP_ROOT_ABSPATH. 3384 * MOVE_SRC_OP_ROOT_ABSPATH is the op-root of the move; it's the same 3385 * as MOVE_SRC_ROOT_ABSPATH except for moves inside deletes when it is 3386 * the op-root of the delete. */ 3387 svn_error_t * 3388 svn_wc__db_base_moved_to(const char **move_dst_abspath, 3389 const char **move_dst_op_root_abspath, 3390 const char **move_src_root_abspath, 3391 const char **move_src_op_root_abspath, 3392 svn_wc__db_t *db, 3393 const char *local_abspath, 3394 apr_pool_t *result_pool, 3395 apr_pool_t *scratch_pool); 3396 3397 /* Recover space from the database file for LOCAL_ABSPATH by running 3398 * the "vacuum" command. */ 3399 svn_error_t * 3400 svn_wc__db_vacuum(svn_wc__db_t *db, 3401 const char *local_abspath, 3402 apr_pool_t *scratch_pool); 3403 3404 /* This raises move-edit tree-conflicts on any moves inside the 3405 delete-edit conflict on LOCAL_ABSPATH. This is experimental: see 3406 comment in resolve_conflict_on_node about combining with another 3407 function. */ 3408 svn_error_t * 3409 svn_wc__db_resolve_delete_raise_moved_away(svn_wc__db_t *db, 3410 const char *local_abspath, 3411 svn_wc_notify_func2_t notify_func, 3412 void *notify_baton, 3413 apr_pool_t *scratch_pool); 3414 3415 /* Like svn_wc__db_resolve_delete_raise_moved_away this should be 3416 combined. 3417 3418 ### LOCAL_ABSPATH specifies the move origin, but the move origin 3419 ### is not necessary unique enough. This function needs an op_root_abspath 3420 ### argument to differentiate between different origins. 3421 3422 ### See move_tests.py: move_many_update_delete for an example case. 3423 */ 3424 svn_error_t * 3425 svn_wc__db_resolve_break_moved_away(svn_wc__db_t *db, 3426 const char *local_abspath, 3427 svn_wc_notify_func2_t notify_func, 3428 void *notify_baton, 3429 apr_pool_t *scratch_pool); 3430 3431 /* Break moves for all moved-away children of LOCAL_ABSPATH, within 3432 * a single transaction. 3433 * 3434 * ### Like svn_wc__db_resolve_delete_raise_moved_away this should be 3435 * combined. */ 3436 svn_error_t * 3437 svn_wc__db_resolve_break_moved_away_children(svn_wc__db_t *db, 3438 const char *local_abspath, 3439 svn_wc_notify_func2_t notify_func, 3440 void *notify_baton, 3441 apr_pool_t *scratch_pool); 3442 3443 /* Set *REQUIRED_ABSPATH to the path that should be locked to ensure 3444 * that the lock covers all paths affected by resolving the conflicts 3445 * in the tree LOCAL_ABSPATH. */ 3446 svn_error_t * 3447 svn_wc__required_lock_for_resolve(const char **required_abspath, 3448 svn_wc__db_t *db, 3449 const char *local_abspath, 3450 apr_pool_t *result_pool, 3451 apr_pool_t *scratch_pool); 3452 /* @} */ 3453 3454 3455 #ifdef __cplusplus 3456 } 3457 #endif /* __cplusplus */ 3458 3459 #endif /* SVN_WC_DB_H */ 3460