wc_db.h revision 262253
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 53extern "C" { 54#endif /* __cplusplus */ 55 56/* INTERFACE CONVENTIONS 57 58 "OUT" PARAMETERS 59 60 There are numerous functions within this API which take a (large) number 61 of "out" parameters. These are listed individually, rather than combined 62 into a struct, so that a caller can be fine-grained about the which 63 pieces of information are being requested. In many cases, only a subset 64 is required, so the implementation can perform various optimizations 65 to fulfill the limited request for information. 66 67 68 POOLS 69 70 wc_db uses the dual-pool paradigm for all of its functions. Any OUT 71 parameter will be allocated within the result pool, and all temporary 72 allocations will be performed within the scratch pool. 73 74 The pool that DB is allocated within (the "state" pool) is only used 75 for a few, limited allocations to track each of the working copy roots 76 that the DB is asked to operate upon. The memory usage on this pool 77 is O(# wcroots), which should normally be one or a few. Custom clients 78 which hold open structures over a significant period of time should 79 pay particular attention to the number of roots touched, and the 80 resulting impact on memory consumption (which should still be minimal). 81 82 83 PARAMETER CONVENTIONS 84 85 * Parameter Order 86 - any output arguments 87 - DB 88 - LOCAL_ABSPATH 89 - any other input arguments 90 - RESULT_POOL 91 - SCRATCH_POOL 92 93 * DB 94 This parameter is the primary context for all operations on the 95 metadata for working copies. This parameter is passed to almost every 96 function, and maintains information and state about every working 97 copy "touched" by any of the APIs in this interface. 98 99 * *_ABSPATH 100 All *_ABSPATH parameters in this API are absolute paths in the local 101 filesystem, represented in Subversion internal canonical form. 102 103 * LOCAL_ABSPATH 104 This parameter specifies a particular *versioned* node in the local 105 filesystem. From this node, a working copy root is implied, and will 106 be used for the given API operation. 107 108 * LOCAL_DIR_ABSPATH 109 This parameter is similar to LOCAL_ABSPATH, but the semantics of the 110 parameter and operation require the node to be a directory within 111 the working copy. 112 113 * WRI_ABSPATH 114 This is a "Working copy Root Indicator" path. This refers to a location 115 in the local filesystem that is anywhere inside a working copy. The given 116 operation will be performed within the context of the root of that 117 working copy. This does not necessarily need to refer to a specific 118 versioned node or the root of a working copy (although it can) -- any 119 location, existing or not, is sufficient, as long as it is inside a 120 working copy. 121 ### TODO: Define behaviour for switches and externals. 122 ### Preference has been stated that WRI_ABSPATH should imply the root 123 ### of the parent WC of all switches and externals, but that may 124 ### not play out well, especially with multiple repositories involved. 125*/ 126 127/* Context data structure for interacting with the administrative data. */ 128typedef struct svn_wc__db_t svn_wc__db_t; 129 130 131/* Enumerated values describing the state of a node. */ 132typedef enum svn_wc__db_status_t { 133 /* The node is present and has no known modifications applied to it. */ 134 svn_wc__db_status_normal, 135 136 /* The node has been added (potentially obscuring a delete or move of 137 the BASE node; see HAVE_BASE param [### What param? This is an enum 138 not a function.] ). The text will be marked as 139 modified, and if properties exist, they will be marked as modified. 140 141 In many cases svn_wc__db_status_added means any of added, moved-here 142 or copied-here. See individual functions for clarification and 143 svn_wc__db_scan_addition() to get more details. */ 144 svn_wc__db_status_added, 145 146 /* This node has been added with history, based on the move source. 147 Text and property modifications are based on whether changes have 148 been made against their pristine versions. */ 149 svn_wc__db_status_moved_here, 150 151 /* This node has been added with history, based on the copy source. 152 Text and property modifications are based on whether changes have 153 been made against their pristine versions. */ 154 svn_wc__db_status_copied, 155 156 /* This node has been deleted. No text or property modifications 157 will be present. */ 158 svn_wc__db_status_deleted, 159 160 /* This node was named by the server, but no information was provided. */ 161 svn_wc__db_status_server_excluded, 162 163 /* This node has been administratively excluded. */ 164 svn_wc__db_status_excluded, 165 166 /* This node is not present in this revision. This typically happens 167 when a node is deleted and committed without updating its parent. 168 The parent revision indicates it should be present, but this node's 169 revision states otherwise. */ 170 svn_wc__db_status_not_present, 171 172 /* This node is known, but its information is incomplete. Generally, 173 it should be treated similar to the other missing status values 174 until some (later) process updates the node with its data. 175 176 When the incomplete status applies to a directory, the list of 177 children and the list of its base properties as recorded in the 178 working copy do not match their working copy versions. 179 The update editor can complete a directory by using a different 180 update algorithm. */ 181 svn_wc__db_status_incomplete, 182 183 /* The BASE node has been marked as deleted. Only used as an internal 184 status in wc_db.c and entries.c. */ 185 svn_wc__db_status_base_deleted 186 187} svn_wc__db_status_t; 188 189/* Lock information. We write/read it all as one, so let's use a struct 190 for convenience. */ 191typedef struct svn_wc__db_lock_t { 192 /* The lock token */ 193 const char *token; 194 195 /* The owner of the lock, possibly NULL */ 196 const char *owner; 197 198 /* A comment about the lock, possibly NULL */ 199 const char *comment; 200 201 /* The date the lock was created */ 202 apr_time_t date; 203} svn_wc__db_lock_t; 204 205 206/* ### NOTE: I have not provided docstrings for most of this file at this 207 ### point in time. The shape and extent of this API is still in massive 208 ### flux. I'm iterating in public, but do not want to doc until it feels 209 ### like it is "Right". 210*/ 211 212/* ### where/how to handle: text_time, locks, working_size */ 213 214 215/* 216 @defgroup svn_wc__db_admin General administrative functions 217 @{ 218*/ 219 220/* Open a working copy administrative database context. 221 222 This context is (initially) not associated with any particular working 223 copy directory or working copy root (wcroot). As operations are performed, 224 this context will load the appropriate wcroot information. 225 226 The context is returned in DB. 227 228 CONFIG should hold the various configuration options that may apply to 229 the administrative operation. It should live at least as long as the 230 RESULT_POOL parameter. 231 232 When OPEN_WITHOUT_UPGRADE is TRUE, then the working copy databases will 233 be opened even when an old database format is found/detected during 234 the operation of a wc_db API). If open_without_upgrade is FALSE and an 235 upgrade is required, then SVN_ERR_WC_UPGRADE_REQUIRED will be returned 236 from that API. 237 Passing TRUE will allow a bare minimum of APIs to function (most notably, 238 the temp_get_format() function will always return a value) since most of 239 these APIs expect a current-format database to be present. 240 241 If ENFORCE_EMPTY_WQ is TRUE, then any databases with stale work items in 242 their work queue will raise an error when they are opened. The operation 243 will raise SVN_ERR_WC_CLEANUP_REQUIRED. Passing FALSE for this routine 244 means that the work queue is being processed (via 'svn cleanup') and all 245 operations should be allowed. 246 247 The DB will be closed when RESULT_POOL is cleared. It may also be closed 248 manually using svn_wc__db_close(). In particular, this will close any 249 SQLite databases that have been opened and cached. 250 251 The context is allocated in RESULT_POOL. This pool is *retained* and used 252 for future allocations within the DB. Be forewarned about unbounded 253 memory growth if this DB is used across an unbounded number of wcroots 254 and versioned directories. 255 256 Temporary allocations will be made in SCRATCH_POOL. 257*/ 258svn_error_t * 259svn_wc__db_open(svn_wc__db_t **db, 260 svn_config_t *config, 261 svn_boolean_t open_without_upgrade, 262 svn_boolean_t enforce_empty_wq, 263 apr_pool_t *result_pool, 264 apr_pool_t *scratch_pool); 265 266 267/* Close DB. */ 268svn_error_t * 269svn_wc__db_close(svn_wc__db_t *db); 270 271 272/* Initialize the SDB for LOCAL_ABSPATH, which should be a working copy path. 273 274 A REPOSITORY row will be constructed for the repository identified by 275 REPOS_ROOT_URL and REPOS_UUID. Neither of these may be NULL. 276 277 A BASE_NODE row will be created for the directory at REPOS_RELPATH at 278 revision INITIAL_REV. 279 If INITIAL_REV is greater than zero, then the node will be marked as 280 "incomplete" because we don't know its children. Contrary, if the 281 INITIAL_REV is zero, then this directory should represent the root and 282 we know it has no children, so the node is complete. 283 284 ### Is there any benefit to marking it 'complete' if rev==0? Seems like 285 ### an unnecessary special case. 286 287 DEPTH is the initial depth of the working copy; it must be a definite 288 depth, not svn_depth_unknown. 289 290 Use SCRATCH_POOL for temporary allocations. 291*/ 292svn_error_t * 293svn_wc__db_init(svn_wc__db_t *db, 294 const char *local_abspath, 295 const char *repos_relpath, 296 const char *repos_root_url, 297 const char *repos_uuid, 298 svn_revnum_t initial_rev, 299 svn_depth_t depth, 300 apr_pool_t *scratch_pool); 301 302 303/* Compute the LOCAL_RELPATH for the given LOCAL_ABSPATH, relative 304 from wri_abspath. 305 306 The LOCAL_RELPATH is a relative path to the working copy's root. That 307 root will be located by this function, and the path will be relative to 308 that location. If LOCAL_ABSPATH is the wcroot directory, then "" will 309 be returned. 310 311 The LOCAL_RELPATH should ONLY be used for persisting paths to disk. 312 Those paths should not be abspaths, otherwise the working copy cannot 313 be moved. The working copy library should not make these paths visible 314 in its API (which should all be abspaths), and it should not be using 315 relpaths for other processing. 316 317 LOCAL_RELPATH will be allocated in RESULT_POOL. All other (temporary) 318 allocations will be made in SCRATCH_POOL. 319 320 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 321 option. 322*/ 323svn_error_t * 324svn_wc__db_to_relpath(const char **local_relpath, 325 svn_wc__db_t *db, 326 const char *wri_abspath, 327 const char *local_abspath, 328 apr_pool_t *result_pool, 329 apr_pool_t *scratch_pool); 330 331 332/* Compute the LOCAL_ABSPATH for a LOCAL_RELPATH located within the working 333 copy identified by WRI_ABSPATH. 334 335 This is the reverse of svn_wc__db_to_relpath. It should be used for 336 returning a persisted relpath back into an abspath. 337 338 LOCAL_ABSPATH will be allocated in RESULT_POOL. All other (temporary) 339 allocations will be made in SCRATCH_POOL. 340 341 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 342 option. 343 */ 344svn_error_t * 345svn_wc__db_from_relpath(const char **local_abspath, 346 svn_wc__db_t *db, 347 const char *wri_abspath, 348 const char *local_relpath, 349 apr_pool_t *result_pool, 350 apr_pool_t *scratch_pool); 351 352/* Compute the working copy root WCROOT_ABSPATH for WRI_ABSPATH using DB. 353 354 This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 355 option. 356 */ 357svn_error_t * 358svn_wc__db_get_wcroot(const char **wcroot_abspath, 359 svn_wc__db_t *db, 360 const char *wri_abspath, 361 apr_pool_t *result_pool, 362 apr_pool_t *scratch_pool); 363 364 365/* @} */ 366 367/* Different kinds of trees 368 369 The design doc mentions three different kinds of trees, BASE, WORKING and 370 ACTUAL: http://svn.apache.org/repos/asf/subversion/trunk/notes/wc-ng-design 371 We have different APIs to handle each tree, enumerated below, along with 372 a blurb to explain what that tree represents. 373*/ 374 375/* @defgroup svn_wc__db_base BASE tree management 376 377 BASE is what we get from the server. It is the *absolute* pristine copy. 378 You need to use checkout, update, switch, or commit to alter your view of 379 the repository. 380 381 In the BASE tree, each node corresponds to a particular node-rev in the 382 repository. It can be a mixed-revision tree. Each node holds either a 383 copy of the node-rev as it exists in the repository (if presence = 384 'normal'), or a place-holder (if presence = 'server-excluded' or 'excluded' or 385 'not-present'). 386 387 @{ 388*/ 389 390/* Add or replace a directory in the BASE tree. 391 392 The directory is located at LOCAL_ABSPATH on the local filesystem, and 393 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 394 repository, at revision REVISION. 395 396 The directory properties are given by the PROPS hash (which is 397 const char *name => const svn_string_t *). 398 399 The last-change information is given by <CHANGED_REV, CHANGED_DATE, 400 CHANGED_AUTHOR>. 401 402 The directory's children are listed in CHILDREN, as an array of 403 const char *. The child nodes do NOT have to exist when this API 404 is called. For each child node which does not exists, an "incomplete" 405 node will be added. These child nodes will be added regardless of 406 the DEPTH value. The caller must sort out which must be recorded, 407 and which must be omitted. 408 409 This subsystem does not use DEPTH, but it can be recorded here in 410 the BASE tree for higher-level code to use. 411 412 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 413 data. 414 415 If 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*/ 432svn_error_t * 433svn_wc__db_base_add_directory(svn_wc__db_t *db, 434 const char *local_abspath, 435 const char *wri_abspath, 436 const char *repos_relpath, 437 const char *repos_root_url, 438 const char *repos_uuid, 439 svn_revnum_t revision, 440 const apr_hash_t *props, 441 svn_revnum_t changed_rev, 442 apr_time_t changed_date, 443 const char *changed_author, 444 const apr_array_header_t *children, 445 svn_depth_t depth, 446 apr_hash_t *dav_cache, 447 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 */ 459svn_error_t * 460svn_wc__db_base_add_incomplete_directory(svn_wc__db_t *db, 461 const char *local_abspath, 462 const char *repos_relpath, 463 const char *repos_root_url, 464 const char *repos_uuid, 465 svn_revnum_t revision, 466 svn_depth_t depth, 467 svn_boolean_t insert_base_deleted, 468 svn_boolean_t delete_working, 469 svn_skel_t *conflict, 470 svn_skel_t *work_items, 471 apr_pool_t *scratch_pool); 472 473 474/* Add or replace a file in the BASE tree. 475 476 The file is located at LOCAL_ABSPATH on the local filesystem, and 477 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 478 repository, at revision REVISION. 479 480 The file properties are given by the PROPS hash (which is 481 const char *name => const svn_string_t *). 482 483 The last-change information is given by <CHANGED_REV, CHANGED_DATE, 484 CHANGED_AUTHOR>. 485 486 The checksum of the file contents is given in CHECKSUM. An entry in 487 the pristine text base is NOT required when this API is called. 488 489 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 490 data. 491 492 If CONFLICT is not NULL, then it describes a conflict for this node. The 493 node will be record as conflicted (in ACTUAL). 494 495 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 496 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 497 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 498 ACTUAL, to mark the properties unmodified. 499 500 Any work items that are necessary as part of this node construction may 501 be passed in WORK_ITEMS. 502 503 Unless KEEP_RECORDED_INFO is set to TRUE, recorded size and timestamp values 504 will be cleared. 505 506 All temporary allocations will be made in SCRATCH_POOL. 507*/ 508svn_error_t * 509svn_wc__db_base_add_file(svn_wc__db_t *db, 510 const char *local_abspath, 511 const char *wri_abspath, 512 const char *repos_relpath, 513 const char *repos_root_url, 514 const char *repos_uuid, 515 svn_revnum_t revision, 516 const apr_hash_t *props, 517 svn_revnum_t changed_rev, 518 apr_time_t changed_date, 519 const char *changed_author, 520 const svn_checksum_t *checksum, 521 apr_hash_t *dav_cache, 522 svn_boolean_t delete_working, 523 svn_boolean_t update_actual_props, 524 apr_hash_t *new_actual_props, 525 apr_array_header_t *new_iprops, 526 svn_boolean_t keep_recorded_info, 527 svn_boolean_t insert_base_deleted, 528 const svn_skel_t *conflict, 529 const svn_skel_t *work_items, 530 apr_pool_t *scratch_pool); 531 532 533/* Add or replace a symlink in the BASE tree. 534 535 The symlink is located at LOCAL_ABSPATH on the local filesystem, and 536 corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 537 repository, at revision REVISION. 538 539 The symlink's properties are given by the PROPS hash (which is 540 const char *name => const svn_string_t *). 541 542 The last-change information is given by <CHANGED_REV, CHANGED_DATE, 543 CHANGED_AUTHOR>. 544 545 The target of the symlink is specified by TARGET. 546 547 If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 548 data. 549 550 If CONFLICT is not NULL, then it describes a conflict for this node. The 551 node will be record as conflicted (in ACTUAL). 552 553 If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 554 as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 555 when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 556 ACTUAL, to mark the properties unmodified. 557 558 Any work items that are necessary as part of this node construction may 559 be passed in WORK_ITEMS. 560 561 All temporary allocations will be made in SCRATCH_POOL. 562*/ 563/* ### KFF: This is an interesting question, because currently 564 ### symlinks are versioned as regular files with the svn:special 565 ### property; then the file's text contents indicate that it is a 566 ### symlink and where that symlink points. That's for portability: 567 ### you can check 'em out onto a platform that doesn't support 568 ### symlinks, and even modify the link and check it back in. It's 569 ### a great solution; but then the question for wc-ng is: 570 ### 571 ### Suppose you check out a symlink on platform X and platform Y. 572 ### X supports symlinks; Y does not. Should the wc-ng storage for 573 ### those two be the same? I mean, on platform Y, the file is just 574 ### going to look and behave like a regular file. It would be sort 575 ### of odd for the wc-ng storage for that file to be of a different 576 ### type from all the other files. (On the other hand, maybe it's 577 ### weird today that the wc-1 storage for a working symlink is to 578 ### be like a regular file (i.e., regular text-base and whatnot). 579 ### 580 ### I'm still feeling my way around this problem; just pointing out 581 ### the issues. 582 583 ### gjs: symlinks are stored in the database as first-class objects, 584 ### rather than in the filesystem as "special" regular files. thus, 585 ### all portability concerns are moot. higher-levels can figure out 586 ### how to represent the link in ACTUAL. higher-levels can also 587 ### deal with translating to/from the svn:special property and 588 ### the plain-text file contents. 589 ### dlr: What about hard links? At minimum, mention in doc string. 590*/ 591svn_error_t * 592svn_wc__db_base_add_symlink(svn_wc__db_t *db, 593 const char *local_abspath, 594 const char *wri_abspath, 595 const char *repos_relpath, 596 const char *repos_root_url, 597 const char *repos_uuid, 598 svn_revnum_t revision, 599 const apr_hash_t *props, 600 svn_revnum_t changed_rev, 601 apr_time_t changed_date, 602 const char *changed_author, 603 const char *target, 604 apr_hash_t *dav_cache, 605 svn_boolean_t delete_working, 606 svn_boolean_t update_actual_props, 607 apr_hash_t *new_actual_props, 608 apr_array_header_t *new_iprops, 609 svn_boolean_t keep_recorded_info, 610 svn_boolean_t insert_base_deleted, 611 const svn_skel_t *conflict, 612 const svn_skel_t *work_items, 613 apr_pool_t *scratch_pool); 614 615 616/* Create a node in the BASE tree that is present in name only. 617 618 The new node will be located at LOCAL_ABSPATH, and correspond to the 619 repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> 620 at revision REVISION. 621 622 The node's kind is described by KIND, and the reason for its absence 623 is specified by STATUS. Only these values are allowed for STATUS: 624 625 svn_wc__db_status_server_excluded 626 svn_wc__db_status_excluded 627 628 If CONFLICT is not NULL, then it describes a conflict for this node. The 629 node will be record as conflicted (in ACTUAL). 630 631 Any work items that are necessary as part of this node construction may 632 be passed in WORK_ITEMS. 633 634 All temporary allocations will be made in SCRATCH_POOL. 635*/ 636svn_error_t * 637svn_wc__db_base_add_excluded_node(svn_wc__db_t *db, 638 const char *local_abspath, 639 const char *repos_relpath, 640 const char *repos_root_url, 641 const char *repos_uuid, 642 svn_revnum_t revision, 643 svn_node_kind_t kind, 644 svn_wc__db_status_t status, 645 const svn_skel_t *conflict, 646 const svn_skel_t *work_items, 647 apr_pool_t *scratch_pool); 648 649 650/* Create a node in the BASE tree that is present in name only. 651 652 The new node will be located at LOCAL_ABSPATH, and correspond to the 653 repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> 654 at revision REVISION. 655 656 The node's kind is described by KIND, and the reason for its absence 657 is 'svn_wc__db_status_not_present'. 658 659 If CONFLICT is not NULL, then it describes a conflict for this node. The 660 node will be record as conflicted (in ACTUAL). 661 662 Any work items that are necessary as part of this node construction may 663 be passed in WORK_ITEMS. 664 665 All temporary allocations will be made in SCRATCH_POOL. 666*/ 667svn_error_t * 668svn_wc__db_base_add_not_present_node(svn_wc__db_t *db, 669 const char *local_abspath, 670 const char *repos_relpath, 671 const char *repos_root_url, 672 const char *repos_uuid, 673 svn_revnum_t revision, 674 svn_node_kind_t kind, 675 const svn_skel_t *conflict, 676 const svn_skel_t *work_items, 677 apr_pool_t *scratch_pool); 678 679 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*/ 716svn_error_t * 717svn_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*/ 780svn_error_t * 781svn_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. */ 804struct 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 */ 818svn_error_t * 819svn_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*/ 835svn_error_t * 836svn_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*/ 855svn_error_t * 856svn_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. */ 865svn_error_t * 866svn_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. */ 876svn_error_t * 877svn_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. */ 885svn_error_t * 886svn_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. */ 894svn_error_t * 895svn_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. */ 917svn_error_t * 918svn_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 */ 929svn_error_t * 930svn_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. */ 947svn_error_t * 948svn_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. */ 964svn_error_t * 965svn_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. */ 976svn_error_t * 977svn_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. */ 989svn_error_t * 990svn_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. */ 1009svn_error_t * 1010svn_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. */ 1020svn_error_t * 1021svn_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. */ 1031svn_error_t * 1032svn_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. */ 1039svn_error_t * 1040svn_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*/ 1048svn_error_t * 1049svn_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 */ 1063svn_error_t * 1064svn_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 */ 1100svn_error_t * 1101svn_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 */ 1139svn_error_t * 1140svn_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 */ 1158svn_error_t * 1159svn_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 */ 1202svn_error_t * 1203svn_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. */ 1243svn_error_t * 1244svn_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. */ 1259svn_error_t * 1260svn_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. */ 1275svn_error_t * 1276svn_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. */ 1301svn_error_t * 1302svn_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 */ 1317svn_error_t * 1318svn_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 */ 1337svn_error_t * 1338svn_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. */ 1352svn_error_t * 1353svn_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. */ 1374svn_error_t * 1375svn_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 1394svn_error_t * 1395svn_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? */ 1418svn_error_t * 1419svn_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? */ 1431svn_error_t * 1432svn_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? */ 1442svn_error_t * 1443svn_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*/ 1480svn_error_t * 1481svn_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 */ 1506svn_error_t * 1507svn_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 */ 1540svn_error_t * 1541svn_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? */ 1553svn_error_t * 1554svn_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 */ 1563svn_error_t * 1564svn_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 */ 1586svn_error_t * 1587svn_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. */ 1599svn_error_t * 1600svn_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 */ 1621svn_error_t * 1622svn_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 */ 1638svn_error_t * 1639svn_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(). */ 1650typedef 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. */ 1659svn_error_t * 1660svn_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 */ 1674svn_error_t * 1675svn_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 */ 1683svn_error_t * 1684svn_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*/ 1866svn_error_t * 1867svn_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 returned by svn_wc__db_read_children_info. Only has the 1913 fields needed by status. */ 1914struct svn_wc__db_info_t { 1915 svn_wc__db_status_t status; 1916 svn_node_kind_t kind; 1917 svn_revnum_t revnum; 1918 const char *repos_relpath; 1919 const char *repos_root_url; 1920 const char *repos_uuid; 1921 svn_revnum_t changed_rev; 1922 const char *changed_author; 1923 apr_time_t changed_date; 1924 svn_depth_t depth; 1925 1926 svn_filesize_t recorded_size; 1927 apr_time_t recorded_time; 1928 1929 const char *changelist; 1930 svn_boolean_t conflicted; 1931#ifdef HAVE_SYMLINK 1932 svn_boolean_t special; 1933#endif 1934 svn_boolean_t op_root; 1935 1936 svn_boolean_t has_checksum; 1937 svn_boolean_t copied; 1938 svn_boolean_t had_props; 1939 svn_boolean_t props_mod; 1940 1941 svn_boolean_t have_base; 1942 svn_boolean_t have_more_work; 1943 1944 svn_boolean_t locked; /* WC directory lock */ 1945 svn_wc__db_lock_t *lock; /* Repository file lock */ 1946 svn_boolean_t incomplete; /* TRUE if a working node is incomplete */ 1947 1948 const char *moved_to_abspath; /* Only on op-roots. See svn_wc_status3_t. */ 1949 svn_boolean_t moved_here; /* Only on op-roots. */ 1950 1951 svn_boolean_t file_external; 1952}; 1953 1954/* Return in *NODES a hash mapping name->struct svn_wc__db_info_t for 1955 the children of DIR_ABSPATH, and in *CONFLICTS a hash of names in 1956 conflict. 1957 1958 The results include any path that was a child of a deleted directory that 1959 existed at LOCAL_ABSPATH, even if that directory is now scheduled to be 1960 replaced by the working node at LOCAL_ABSPATH. 1961 */ 1962svn_error_t * 1963svn_wc__db_read_children_info(apr_hash_t **nodes, 1964 apr_hash_t **conflicts, 1965 svn_wc__db_t *db, 1966 const char *dir_abspath, 1967 apr_pool_t *result_pool, 1968 apr_pool_t *scratch_pool); 1969 1970 1971/* Structure returned by svn_wc__db_read_walker_info. Only has the 1972 fields needed by svn_wc__internal_walk_children(). */ 1973struct svn_wc__db_walker_info_t { 1974 svn_wc__db_status_t status; 1975 svn_node_kind_t kind; 1976}; 1977 1978/* When a node is deleted in WORKING, some of its information is no longer 1979 available. But in some cases it might still be relevant to obtain this 1980 information even when the information isn't stored in the BASE tree. 1981 1982 This function allows access to that specific information. 1983 1984 When a node is not deleted, this node returns the same information 1985 as svn_wc__db_read_info(). 1986 1987 All output arguments are optional and behave in the same way as when 1988 calling svn_wc__db_read_info(). 1989 1990 (All other information (like original_*) can be obtained via other apis). 1991 1992 *PROPS maps "const char *" names to "const svn_string_t *" values. If 1993 the pristine node is capable of having properties but has none, set 1994 *PROPS to an empty hash. If its status is such that it cannot have 1995 properties, set *PROPS to NULL. 1996 */ 1997svn_error_t * 1998svn_wc__db_read_pristine_info(svn_wc__db_status_t *status, 1999 svn_node_kind_t *kind, 2000 svn_revnum_t *changed_rev, 2001 apr_time_t *changed_date, 2002 const char **changed_author, 2003 svn_depth_t *depth, /* dirs only */ 2004 const svn_checksum_t **checksum, /* files only */ 2005 const char **target, /* symlinks only */ 2006 svn_boolean_t *had_props, 2007 apr_hash_t **props, 2008 svn_wc__db_t *db, 2009 const char *local_abspath, 2010 apr_pool_t *result_pool, 2011 apr_pool_t *scratch_pool); 2012 2013/* Gets the information required to install a pristine file to the working copy 2014 2015 Set WCROOT_ABSPATH to the working copy root, SHA1_CHECKSUM to the 2016 checksum of the node (a valid reference into the pristine store) 2017 and PRISTINE_PROPS to the node's pristine properties (to use for 2018 installing the file). 2019 2020 If WRI_ABSPATH is not NULL, check for information in the working copy 2021 identified by WRI_ABSPATH. 2022 */ 2023svn_error_t * 2024svn_wc__db_read_node_install_info(const char **wcroot_abspath, 2025 const svn_checksum_t **sha1_checksum, 2026 apr_hash_t **pristine_props, 2027 apr_time_t *changed_date, 2028 svn_wc__db_t *db, 2029 const char *local_abspath, 2030 const char *wri_abspath, 2031 apr_pool_t *result_pool, 2032 apr_pool_t *scratch_pool); 2033 2034/* Return in *NODES a hash mapping name->struct svn_wc__db_walker_info_t for 2035 the children of DIR_ABSPATH. "name" is the child's name relative to 2036 DIR_ABSPATH, not an absolute path. */ 2037svn_error_t * 2038svn_wc__db_read_children_walker_info(apr_hash_t **nodes, 2039 svn_wc__db_t *db, 2040 const char *dir_abspath, 2041 apr_pool_t *result_pool, 2042 apr_pool_t *scratch_pool); 2043 2044 2045/** 2046 * Set *URL to the corresponding url for LOCAL_ABSPATH. 2047 * If the node is added, return the url it will have in the repository. 2048 */ 2049svn_error_t * 2050svn_wc__db_read_url(const char **url, 2051 svn_wc__db_t *db, 2052 const char *local_abspath, 2053 apr_pool_t *result_pool, 2054 apr_pool_t *scratch_pool); 2055 2056 2057/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the ACTUAL 2058 tree (looking through to the WORKING or BASE tree as required). 2059 2060 ### *PROPS will be set to NULL in the following situations: 2061 ### ... tbd 2062 2063 PROPS maps "const char *" names to "const svn_string_t *" values. 2064 If the node has no properties, set *PROPS to an empty hash. 2065 If the node is not present, return an error. 2066 Allocate *PROPS and its keys and values in RESULT_POOL. 2067*/ 2068svn_error_t * 2069svn_wc__db_read_props(apr_hash_t **props, 2070 svn_wc__db_t *db, 2071 const char *local_abspath, 2072 apr_pool_t *result_pool, 2073 apr_pool_t *scratch_pool); 2074 2075/* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and 2076 * a hash table mapping <tt>char *</tt> names onto svn_string_t * 2077 * values for any properties of child nodes of LOCAL_ABSPATH (up to DEPTH). 2078 * 2079 * If PRISTINE is FALSE, read the properties from the WORKING layer (highest 2080 * op_depth); if PRISTINE is FALSE, local modifications will be visible. 2081 */ 2082svn_error_t * 2083svn_wc__db_read_props_streamily(svn_wc__db_t *db, 2084 const char *local_abspath, 2085 svn_depth_t depth, 2086 svn_boolean_t pristine, 2087 const apr_array_header_t *changelists, 2088 svn_wc__proplist_receiver_t receiver_func, 2089 void *receiver_baton, 2090 svn_cancel_func_t cancel_func, 2091 void *cancel_baton, 2092 apr_pool_t *scratch_pool); 2093 2094 2095/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the WORKING 2096 tree (looking through to the BASE tree as required). 2097 2098 ### *PROPS will set set to NULL in the following situations: 2099 ### ... tbd. see props.c:svn_wc__get_pristine_props() 2100 2101 *PROPS maps "const char *" names to "const svn_string_t *" values. 2102 If the node has no properties, set *PROPS to an empty hash. 2103 If the node is not present, return an error. 2104 Allocate *PROPS and its keys and values in RESULT_POOL. 2105*/ 2106svn_error_t * 2107svn_wc__db_read_pristine_props(apr_hash_t **props, 2108 svn_wc__db_t *db, 2109 const char *local_abspath, 2110 apr_pool_t *result_pool, 2111 apr_pool_t *scratch_pool); 2112 2113 2114/** 2115 * Set @a *iprops to a depth-first ordered array of 2116 * #svn_prop_inherited_item_t * structures representing the properties 2117 * inherited by @a local_abspath from the ACTUAL tree above 2118 * @a local_abspath (looking through to the WORKING or BASE tree as 2119 * required), up to and including the root of the working copy and 2120 * any cached inherited properties inherited by the root. 2121 * 2122 * The #svn_prop_inherited_item_t->path_or_url members of the 2123 * #svn_prop_inherited_item_t * structures in @a *iprops are 2124 * paths relative to the repository root URL for cached inherited 2125 * properties and absolute working copy paths otherwise. 2126 * 2127 * If ACTUAL_PROPS is not NULL, then set *ACTUAL_PROPS to the actual 2128 * properties stored on LOCAL_ABSPATH. 2129 * 2130 * Allocate @a *iprops in @a result_pool. Use @a scratch_pool 2131 * for temporary allocations. 2132 */ 2133svn_error_t * 2134svn_wc__db_read_inherited_props(apr_array_header_t **iprops, 2135 apr_hash_t **actual_props, 2136 svn_wc__db_t *db, 2137 const char *local_abspath, 2138 const char *propname, 2139 apr_pool_t *result_pool, 2140 apr_pool_t *scratch_pool); 2141 2142/* Read a BASE node's inherited property information. 2143 2144 Set *IPROPS to to a depth-first ordered array of 2145 svn_prop_inherited_item_t * structures representing the cached 2146 inherited properties for the BASE node at LOCAL_ABSPATH. 2147 2148 If no cached properties are found, then set *IPROPS to NULL. 2149 If LOCAL_ABSPATH represents the root of the repository, then set 2150 *IPROPS to an empty array. 2151 2152 Allocate *IPROPS in RESULT_POOL, use SCRATCH_POOL for temporary 2153 allocations. */ 2154svn_error_t * 2155svn_wc__db_read_cached_iprops(apr_array_header_t **iprops, 2156 svn_wc__db_t *db, 2157 const char *local_abspath, 2158 apr_pool_t *result_pool, 2159 apr_pool_t *scratch_pool); 2160 2161/* Find BASE nodes with cached inherited properties. 2162 2163 Set *IPROPS_PATHS to a hash mapping const char * absolute working copy 2164 paths to the repos_relpath of the path for each path in the working copy 2165 at or below LOCAL_ABSPATH, limited by DEPTH, that has cached inherited 2166 properties for the BASE node of the path. 2167 2168 Allocate *IPROP_PATHS in RESULT_POOL. 2169 Use SCRATCH_POOL for temporary allocations. */ 2170svn_error_t * 2171svn_wc__db_get_children_with_cached_iprops(apr_hash_t **iprop_paths, 2172 svn_depth_t depth, 2173 const char *local_abspath, 2174 svn_wc__db_t *db, 2175 apr_pool_t *result_pool, 2176 apr_pool_t *scratch_pool); 2177 2178/** Obtain a mapping of const char * local_abspaths to const svn_string_t* 2179 * property values in *VALUES, of all PROPNAME properties on LOCAL_ABSPATH 2180 * and its descendants. 2181 * 2182 * Allocate the result in RESULT_POOL, and perform temporary allocations in 2183 * SCRATCH_POOL. 2184 */ 2185svn_error_t * 2186svn_wc__db_prop_retrieve_recursive(apr_hash_t **values, 2187 svn_wc__db_t *db, 2188 const char *local_abspath, 2189 const char *propname, 2190 apr_pool_t *result_pool, 2191 apr_pool_t *scratch_pool); 2192 2193/* Set *CHILDREN to a new array of the (const char *) basenames of the 2194 immediate children of the working node at LOCAL_ABSPATH in DB. 2195 2196 Return every path that refers to a child of the working node at 2197 LOCAL_ABSPATH. Do not include a path just because it was a child of a 2198 deleted directory that existed at LOCAL_ABSPATH if that directory is now 2199 scheduled to be replaced by the working node at LOCAL_ABSPATH. 2200 2201 Allocate *CHILDREN in RESULT_POOL and do temporary allocations in 2202 SCRATCH_POOL. 2203 2204 ### return some basic info for each child? e.g. kind. 2205 ### maybe the data in _read_get_info should be a structure, and this 2206 ### can return a struct for each one. 2207 ### however: _read_get_info can say "not interested", which isn't the 2208 ### case with a struct. thus, a struct requires fetching and/or 2209 ### computing all info. 2210*/ 2211svn_error_t * 2212svn_wc__db_read_children_of_working_node(const apr_array_header_t **children, 2213 svn_wc__db_t *db, 2214 const char *local_abspath, 2215 apr_pool_t *result_pool, 2216 apr_pool_t *scratch_pool); 2217 2218/* Like svn_wc__db_read_children_of_working_node(), except also include any 2219 path that was a child of a deleted directory that existed at 2220 LOCAL_ABSPATH, even if that directory is now scheduled to be replaced by 2221 the working node at LOCAL_ABSPATH. 2222*/ 2223svn_error_t * 2224svn_wc__db_read_children(const apr_array_header_t **children, 2225 svn_wc__db_t *db, 2226 const char *local_abspath, 2227 apr_pool_t *result_pool, 2228 apr_pool_t *scratch_pool); 2229 2230/* Read into *VICTIMS the basenames of the immediate children of 2231 LOCAL_ABSPATH in DB that are conflicted. 2232 2233 In case of tree conflicts a victim doesn't have to be in the 2234 working copy. 2235 2236 Allocate *VICTIMS in RESULT_POOL and do temporary allocations in 2237 SCRATCH_POOL */ 2238/* ### This function will probably be removed. */ 2239svn_error_t * 2240svn_wc__db_read_conflict_victims(const apr_array_header_t **victims, 2241 svn_wc__db_t *db, 2242 const char *local_abspath, 2243 apr_pool_t *result_pool, 2244 apr_pool_t *scratch_pool); 2245 2246/* Read into *MARKER_FILES the absolute paths of the marker files 2247 of conflicts stored on LOCAL_ABSPATH and its immediate children in DB. 2248 The on-disk files may have been deleted by the user. 2249 2250 Allocate *MARKER_FILES in RESULT_POOL and do temporary allocations 2251 in SCRATCH_POOL */ 2252svn_error_t * 2253svn_wc__db_get_conflict_marker_files(apr_hash_t **markers, 2254 svn_wc__db_t *db, 2255 const char *local_abspath, 2256 apr_pool_t *result_pool, 2257 apr_pool_t *scratch_pool); 2258 2259/* Read the conflict information recorded on LOCAL_ABSPATH in *CONFLICT, 2260 an editable conflict skel. 2261 2262 If the node exists, but does not have a conflict set *CONFLICT to NULL, 2263 otherwise return a SVN_ERR_WC_PATH_NOT_FOUND error. 2264 2265 Allocate *CONFLICTS in RESULT_POOL and do temporary allocations in 2266 SCRATCH_POOL */ 2267svn_error_t * 2268svn_wc__db_read_conflict(svn_skel_t **conflict, 2269 svn_wc__db_t *db, 2270 const char *local_abspath, 2271 apr_pool_t *result_pool, 2272 apr_pool_t *scratch_pool); 2273 2274 2275/* Return the kind of the node in DB at LOCAL_ABSPATH. The WORKING tree will 2276 be examined first, then the BASE tree. If the node is not present in either 2277 tree and ALLOW_MISSING is TRUE, then svn_node_unknown is returned. 2278 If the node is missing and ALLOW_MISSING is FALSE, then it will return 2279 SVN_ERR_WC_PATH_NOT_FOUND. 2280 2281 The SHOW_HIDDEN and SHOW_DELETED flags report certain states as kind none. 2282 2283 When nodes have certain statee they are only reported when: 2284 svn_wc__db_status_not_present when show_hidden && show_deleted 2285 2286 svn_wc__db_status_excluded when show_hidden 2287 svn_wc__db_status_server_excluded when show_hidden 2288 2289 svn_wc__db_status_deleted when show_deleted 2290 2291 In other cases these nodes are reported with *KIND as svn_node_none. 2292 (See also svn_wc_read_kind2()'s documentation) 2293 2294 Uses SCRATCH_POOL for temporary allocations. */ 2295svn_error_t * 2296svn_wc__db_read_kind(svn_node_kind_t *kind, 2297 svn_wc__db_t *db, 2298 const char *local_abspath, 2299 svn_boolean_t allow_missing, 2300 svn_boolean_t show_deleted, 2301 svn_boolean_t show_hidden, 2302 apr_pool_t *scratch_pool); 2303 2304 2305/* An analog to svn_wc__entry_is_hidden(). Set *HIDDEN to TRUE if 2306 LOCAL_ABSPATH in DB "is not present, and I haven't scheduled something 2307 over the top of it." */ 2308svn_error_t * 2309svn_wc__db_node_hidden(svn_boolean_t *hidden, 2310 svn_wc__db_t *db, 2311 const char *local_abspath, 2312 apr_pool_t *scratch_pool); 2313 2314/* Checks if a node replaces a node in a different layer. Also check if it 2315 replaces a BASE (op_depth 0) node or just a node in a higher layer (a copy). 2316 Finally check if this is the root of the replacement, or if the replacement 2317 is initiated by the parent node. 2318 2319 IS_REPLACE_ROOT (if not NULL) is set to TRUE if the node is the root of a 2320 replacement; otherwise to FALSE. 2321 2322 BASE_REPLACE (if not NULL) is set to TRUE if the node directly or indirectly 2323 replaces a node in the BASE tree; otherwise to FALSE. 2324 2325 IS_REPLACE (if not NULL) is set to TRUE if the node directly replaces a node 2326 in a lower layer; otherwise to FALSE. 2327 */ 2328svn_error_t * 2329svn_wc__db_node_check_replace(svn_boolean_t *is_replace_root, 2330 svn_boolean_t *base_replace, 2331 svn_boolean_t *is_replace, 2332 svn_wc__db_t *db, 2333 const char *local_abspath, 2334 apr_pool_t *scratch_pool); 2335 2336/* ### changelists. return an array, or an iterator interface? how big 2337 ### are these things? are we okay with an in-memory array? examine other 2338 ### changelist usage -- we may already assume the list fits in memory. 2339*/ 2340 2341/* The DB-private version of svn_wc__is_wcroot(), which see. 2342 */ 2343svn_error_t * 2344svn_wc__db_is_wcroot(svn_boolean_t *is_wcroot, 2345 svn_wc__db_t *db, 2346 const char *local_abspath, 2347 apr_pool_t *scratch_pool); 2348 2349/* Check whether a node is a working copy root and/or switched. 2350 2351 If LOCAL_ABSPATH is the root of a working copy, set *IS_WC_ROOT to TRUE, 2352 otherwise to FALSE. 2353 2354 If LOCAL_ABSPATH is switched against its parent in the same working copy 2355 set *IS_SWITCHED to TRUE, otherwise to FALSE. 2356 2357 If KIND is not null, set *KIND to the node type of LOCAL_ABSPATH. 2358 2359 Any of the output arguments can be null to specify that the result is not 2360 interesting to the caller. 2361 2362 Use SCRATCH_POOL for temporary allocations. 2363 */ 2364svn_error_t * 2365svn_wc__db_is_switched(svn_boolean_t *is_wcroot, 2366 svn_boolean_t *is_switched, 2367 svn_node_kind_t *kind, 2368 svn_wc__db_t *db, 2369 const char *local_abspath, 2370 apr_pool_t *scratch_pool); 2371 2372 2373/* @} */ 2374 2375 2376/* @defgroup svn_wc__db_global Operations that alter multiple trees 2377 @{ 2378*/ 2379 2380/* Associate LOCAL_DIR_ABSPATH, and all its children with the repository at 2381 at REPOS_ROOT_URL. The relative path to the repos root will not change, 2382 just the repository root. The repos uuid will also remain the same. 2383 This also updates any locks which may exist for the node, as well as any 2384 copyfrom repository information. Finally, the DAV cache (aka 2385 "wcprops") will be reset for affected entries. 2386 2387 Use SCRATCH_POOL for any temporary allocations. 2388 2389 ### local_dir_abspath "should be" the wcroot or a switch root. all URLs 2390 ### under this directory (depth=infinity) will be rewritten. 2391 2392 ### This API had a depth parameter, which was removed, should it be 2393 ### resurrected? What's the purpose if we claim relocate is infinitely 2394 ### recursive? 2395 2396 ### Assuming the future ability to copy across repositories, should we 2397 ### refrain from resetting the copyfrom information in this operation? 2398*/ 2399svn_error_t * 2400svn_wc__db_global_relocate(svn_wc__db_t *db, 2401 const char *local_dir_abspath, 2402 const char *repos_root_url, 2403 apr_pool_t *scratch_pool); 2404 2405 2406/* ### docco 2407 2408 ### collapse the WORKING and ACTUAL tree changes down into BASE, called 2409 for each committed node. 2410 2411 NEW_REVISION must be the revision number of the revision created by 2412 the commit. It will become the BASE node's 'revnum' and 'changed_rev' 2413 values in the BASE_NODE table. 2414 2415 CHANGED_REVISION is the new 'last changed' revision. If the node is 2416 modified its value is equivalent to NEW_REVISION, but in case of a 2417 descendant of a copy/move it can be an older revision. 2418 2419 CHANGED_DATE is the (server-side) date of CHANGED_REVISION. It may be 0 if 2420 the revprop is missing on the revision. 2421 2422 CHANGED_AUTHOR is the (server-side) author of CHANGED_REVISION. It may be 2423 NULL if the revprop is missing on the revision. 2424 2425 One or both of NEW_CHECKSUM and NEW_CHILDREN should be NULL. For new: 2426 files: NEW_CHILDREN should be NULL 2427 dirs: NEW_CHECKSUM should be NULL 2428 symlinks: both should be NULL 2429 2430 WORK_ITEMS will be place into the work queue. 2431*/ 2432svn_error_t * 2433svn_wc__db_global_commit(svn_wc__db_t *db, 2434 const char *local_abspath, 2435 svn_revnum_t new_revision, 2436 svn_revnum_t changed_revision, 2437 apr_time_t changed_date, 2438 const char *changed_author, 2439 const svn_checksum_t *new_checksum, 2440 const apr_array_header_t *new_children, 2441 apr_hash_t *new_dav_cache, 2442 svn_boolean_t keep_changelist, 2443 svn_boolean_t no_unlock, 2444 const svn_skel_t *work_items, 2445 apr_pool_t *scratch_pool); 2446 2447 2448/* ### docco 2449 2450 Perform an "update" operation at this node. It will create/modify a BASE 2451 node, and possibly update the ACTUAL tree's node (e.g put the node into 2452 a conflicted state). 2453 2454 ### there may be cases where we need to tweak an existing WORKING node 2455 2456 ### this operations on a single node, but may affect children 2457 2458 ### the repository cannot be changed with this function, but a "switch" 2459 ### (aka changing repos_relpath) is possible 2460 2461 ### one of NEW_CHILDREN, NEW_CHECKSUM, or NEW_TARGET must be provided. 2462 ### the other two values must be NULL. 2463 ### should this be broken out into an update_(directory|file|symlink) ? 2464 2465 ### how does this differ from base_add_*? just the CONFLICT param. 2466 ### the WORK_ITEMS param is new here, but the base_add_* functions 2467 ### should probably grow that. should we instead just (re)use base_add 2468 ### rather than grow a new function? 2469 2470 ### this does not allow a change of depth 2471 2472 ### we do not update a file's TRANSLATED_SIZE here. at some future point, 2473 ### when the file is installed, then a TRANSLATED_SIZE will be set. 2474*/ 2475svn_error_t * 2476svn_wc__db_global_update(svn_wc__db_t *db, 2477 const char *local_abspath, 2478 svn_node_kind_t new_kind, 2479 const char *new_repos_relpath, 2480 svn_revnum_t new_revision, 2481 const apr_hash_t *new_props, 2482 svn_revnum_t new_changed_rev, 2483 apr_time_t new_changed_date, 2484 const char *new_changed_author, 2485 const apr_array_header_t *new_children, 2486 const svn_checksum_t *new_checksum, 2487 const char *new_target, 2488 const apr_hash_t *new_dav_cache, 2489 const svn_skel_t *conflict, 2490 const svn_skel_t *work_items, 2491 apr_pool_t *scratch_pool); 2492 2493 2494/* Modify the entry of working copy LOCAL_ABSPATH, presumably after an update 2495 of depth DEPTH completes. If LOCAL_ABSPATH doesn't exist, this routine 2496 does nothing. 2497 2498 Set the node's repository relpath, repository root, repository uuid and 2499 revision to NEW_REPOS_RELPATH, NEW_REPOS_ROOT and NEW_REPOS_UUID. If 2500 NEW_REPOS_RELPATH is null, the repository location is untouched; if 2501 NEW_REVISION in invalid, the working revision field is untouched. 2502 The modifications are mutually exclusive. If NEW_REPOS_ROOT is non-NULL, 2503 set the repository root of the entry to NEW_REPOS_ROOT. 2504 2505 If LOCAL_ABSPATH is a directory, then, walk entries below LOCAL_ABSPATH 2506 according to DEPTH thusly: 2507 2508 If DEPTH is svn_depth_infinity, perform the following actions on 2509 every entry below PATH; if svn_depth_immediates, svn_depth_files, 2510 or svn_depth_empty, perform them only on LOCAL_ABSPATH. 2511 2512 If NEW_REVISION is valid, then tweak every entry to have this new 2513 working revision (excluding files that are scheduled for addition 2514 or replacement). Likewise, if BASE_URL is non-null, then rewrite 2515 all urls to be "telescoping" children of the base_url. 2516 2517 EXCLUDE_RELPATHS is a hash containing const char *local_relpath. Nodes 2518 for pathnames contained in EXCLUDE_RELPATHS are not touched by this 2519 function. These pathnames should be paths relative to the wcroot. 2520 2521 If WCROOT_IPROPS is not NULL it is a hash mapping const char * absolute 2522 working copy paths to depth-first ordered arrays of 2523 svn_prop_inherited_item_t * structures. If LOCAL_ABSPATH exists in 2524 WCROOT_IPROPS, then set the hashed value as the node's inherited 2525 properties. 2526*/ 2527svn_error_t * 2528svn_wc__db_op_bump_revisions_post_update(svn_wc__db_t *db, 2529 const char *local_abspath, 2530 svn_depth_t depth, 2531 const char *new_repos_relpath, 2532 const char *new_repos_root_url, 2533 const char *new_repos_uuid, 2534 svn_revnum_t new_revision, 2535 apr_hash_t *exclude_relpaths, 2536 apr_hash_t *wcroot_iprops, 2537 svn_wc_notify_func2_t notify_func, 2538 void *notify_baton, 2539 apr_pool_t *scratch_pool); 2540 2541 2542/* Record the RECORDED_SIZE and RECORDED_TIME for a versioned node. 2543 2544 This function will record the information within the WORKING node, 2545 if present, or within the BASE tree. If neither node is present, then 2546 SVN_ERR_WC_PATH_NOT_FOUND will be returned. 2547 2548 RECORDED_SIZE may be SVN_INVALID_FILESIZE, which will be recorded 2549 as such, implying "unknown size". 2550 2551 RECORDED_TIME may be 0, which will be recorded as such, implying 2552 "unknown last mod time". 2553*/ 2554svn_error_t * 2555svn_wc__db_global_record_fileinfo(svn_wc__db_t *db, 2556 const char *local_abspath, 2557 svn_filesize_t recorded_size, 2558 apr_time_t recorded_time, 2559 apr_pool_t *scratch_pool); 2560 2561 2562/* ### post-commit handling. 2563 ### maybe multiple phases? 2564 ### 1) mark a changelist as being-committed 2565 ### 2) collect ACTUAL content, store for future use as TEXTBASE 2566 ### 3) caller performs commit 2567 ### 4) post-commit, integrate changelist into BASE 2568*/ 2569 2570 2571/* @} */ 2572 2573 2574/* @defgroup svn_wc__db_lock Function to manage the LOCKS table. 2575 @{ 2576*/ 2577 2578/* Add or replace LOCK for LOCAL_ABSPATH to DB. */ 2579svn_error_t * 2580svn_wc__db_lock_add(svn_wc__db_t *db, 2581 const char *local_abspath, 2582 const svn_wc__db_lock_t *lock, 2583 apr_pool_t *scratch_pool); 2584 2585 2586/* Remove any lock for LOCAL_ABSPATH in DB. */ 2587svn_error_t * 2588svn_wc__db_lock_remove(svn_wc__db_t *db, 2589 const char *local_abspath, 2590 apr_pool_t *scratch_pool); 2591 2592 2593/* @} */ 2594 2595 2596/* @defgroup svn_wc__db_scan Functions to scan up a tree for further data. 2597 @{ 2598*/ 2599 2600/* Read a BASE node's repository information. 2601 2602 For the BASE node implied by LOCAL_ABSPATH, its location in the repository 2603 returned in *REPOS_ROOT_URL and *REPOS_UUID will be returned in 2604 *REPOS_RELPATH. Any of the OUT parameters may be NULL, indicating no 2605 interest in that piece of information. 2606 2607 All returned data will be allocated in RESULT_POOL. All temporary 2608 allocations will be made in SCRATCH_POOL. 2609 2610 ### Either delete this function and use _base_get_info instead, or 2611 ### add a 'revision' output to make a complete repository node location 2612 ### and rename to not say 'scan', because it doesn't. 2613*/ 2614svn_error_t * 2615svn_wc__db_scan_base_repos(const char **repos_relpath, 2616 const char **repos_root_url, 2617 const char **repos_uuid, 2618 svn_wc__db_t *db, 2619 const char *local_abspath, 2620 apr_pool_t *result_pool, 2621 apr_pool_t *scratch_pool); 2622 2623 2624/* Scan upwards for information about a known addition to the WORKING tree. 2625 2626 IFF a node's status as returned by svn_wc__db_read_info() is 2627 svn_wc__db_status_added (NOT obstructed_add!), then this function 2628 returns a refined status in *STATUS, which is one of: 2629 2630 svn_wc__db_status_added -- this NODE is a simple add without history. 2631 OP_ROOT_ABSPATH will be set to the topmost node in the added subtree 2632 (implying its parent will be an unshadowed BASE node). The REPOS_* 2633 values will be implied by that ancestor BASE node and this node's 2634 position in the added subtree. ORIGINAL_* will be set to their 2635 NULL values (and SVN_INVALID_REVNUM for ORIGINAL_REVISION). 2636 2637 svn_wc__db_status_copied -- this NODE is the root or child of a copy. 2638 The root of the copy will be stored in OP_ROOT_ABSPATH. Note that 2639 the parent of the operation root could be another WORKING node (from 2640 an add, copy, or move). The REPOS_* values will be implied by the 2641 ancestor unshadowed BASE node. ORIGINAL_* will indicate the source 2642 of the copy. 2643 2644 svn_wc__db_status_incomplete -- this NODE is copied but incomplete. 2645 2646 svn_wc__db_status_moved_here -- this NODE arrived as a result of a move. 2647 The root of the moved nodes will be stored in OP_ROOT_ABSPATH. 2648 Similar to the copied state, its parent may be a WORKING node or a 2649 BASE node. And again, the REPOS_* values are implied by this node's 2650 position in the subtree under the ancestor unshadowed BASE node. 2651 ORIGINAL_* will indicate the source of the move. 2652 2653 All OUT parameters may be NULL to indicate a lack of interest in 2654 that piece of information. 2655 2656 STATUS, OP_ROOT_ABSPATH, and REPOS_* will always be assigned a value 2657 if that information is requested (and assuming a successful return). 2658 2659 ORIGINAL_REPOS_RELPATH will refer to the *root* of the operation. It 2660 does *not* correspond to the node given by LOCAL_ABSPATH. The caller 2661 can use the suffix on LOCAL_ABSPATH (relative to OP_ROOT_ABSPATH) in 2662 order to compute the source node which corresponds to LOCAL_ABSPATH. 2663 2664 If the node given by LOCAL_ABSPATH does not have changes recorded in 2665 the WORKING tree, then SVN_ERR_WC_PATH_NOT_FOUND is returned. If it 2666 doesn't have an "added" status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS 2667 will be returned. 2668 2669 All returned data will be allocated in RESULT_POOL. All temporary 2670 allocations will be made in SCRATCH_POOL. 2671*/ 2672svn_error_t * 2673svn_wc__db_scan_addition(svn_wc__db_status_t *status, 2674 const char **op_root_abspath, 2675 const char **repos_relpath, 2676 const char **repos_root_url, 2677 const char **repos_uuid, 2678 const char **original_repos_relpath, 2679 const char **original_root_url, 2680 const char **original_uuid, 2681 svn_revnum_t *original_revision, 2682 svn_wc__db_t *db, 2683 const char *local_abspath, 2684 apr_pool_t *result_pool, 2685 apr_pool_t *scratch_pool); 2686 2687/* Scan the working copy for move information of the node LOCAL_ABSPATH. 2688 * If LOCAL_ABSPATH return a SVN_ERR_WC_PATH_UNEXPECTED_STATUS error. 2689 * 2690 * If not NULL *MOVED_FROM_ABSPATH will be set to the previous location 2691 * of LOCAL_ABSPATH, before it or an ancestror was moved. 2692 * 2693 * If not NULL *OP_ROOT_ABSPATH will be set to the new location of the 2694 * path that was actually moved 2695 * 2696 * If not NULL *OP_ROOT_MOVED_FROM_ABSPATH will be set to the old location 2697 * of the path that was actually moved. 2698 * 2699 * If not NULL *MOVED_FROM_DELETE_ABSPATH will be set to the ancestor of the 2700 * moved from location that deletes the original location 2701 * 2702 * Given a working copy 2703 * A/B/C 2704 * svn mv A/B D 2705 * svn rm A 2706 * 2707 * You can call this function on D and D/C. When called on D/C all output 2708 * MOVED_FROM_ABSPATH will be A/B/C 2709 * OP_ROOT_ABSPATH will be D 2710 * OP_ROOT_MOVED_FROM_ABSPATH will be A/B 2711 * MOVED_FROM_DELETE_ABSPATH will be A 2712 */ 2713svn_error_t * 2714svn_wc__db_scan_moved(const char **moved_from_abspath, 2715 const char **op_root_abspath, 2716 const char **op_root_moved_from_abspath, 2717 const char **moved_from_delete_abspath, 2718 svn_wc__db_t *db, 2719 const char *local_abspath, 2720 apr_pool_t *result_pool, 2721 apr_pool_t *scratch_pool); 2722 2723/* Scan upwards for additional information about a deleted node. 2724 2725 When a deleted node is discovered in the WORKING tree, the situation 2726 may be quite complex. This function will provide the information to 2727 resolve the circumstances of the deletion. 2728 2729 For discussion purposes, we will start with the most complex example 2730 and then demonstrate simplified examples. Consider node B/W/D/N has been 2731 found as deleted. B is an unmodified directory (thus, only in BASE). W is 2732 "replacement" content that exists in WORKING, shadowing a similar B/W 2733 directory in BASE. D is a deleted subtree in the WORKING tree, and N is 2734 the deleted node. 2735 2736 In this example, BASE_DEL_ABSPATH will bet set to B/W. That is the root of 2737 the BASE tree (implicitly) deleted by the replacement. WORK_DEL_ABSPATH 2738 will be set to the subtree deleted within the replacement; in this case, 2739 B/W/D. No move-away took place, so MOVED_TO_ABSPATH is set to NULL. 2740 2741 In another scenario, B/W was moved-away before W was put into the WORKING 2742 tree through an add/copy/move-here. MOVED_TO_ABSPATH will indicate where 2743 B/W was moved to. Note that further operations may have been performed 2744 post-move, but that is not known or reported by this function. 2745 2746 If BASE does not have a B/W, then the WORKING B/W is not a replacement, 2747 but a simple add/copy/move-here. BASE_DEL_ABSPATH will be set to NULL. 2748 2749 If B/W/D does not exist in the WORKING tree (we're only talking about a 2750 deletion of nodes of the BASE tree), then deleting B/W/D would have marked 2751 the subtree for deletion. BASE_DEL_ABSPATH will refer to B/W/D, 2752 MOVED_TO_ABSPATH will be NULL, and WORK_DEL_ABSPATH will be NULL. 2753 2754 If the BASE node B/W/D was moved instead of deleted, then MOVED_TO_ABSPATH 2755 would indicate the target location (and other OUT values as above). 2756 2757 When the user deletes B/W/D from the WORKING tree, there are a few 2758 additional considerations. If B/W is a simple addition (not a copy or 2759 a move-here), then the deletion will simply remove the nodes from WORKING 2760 and possibly leave behind "base-delete" markers in the WORKING tree. 2761 If the source is a copy/moved-here, then the nodes are replaced with 2762 deletion markers. 2763 2764 If the user moves-away B/W/D from the WORKING tree, then behavior is 2765 again dependent upon the origination of B/W. For a plain add, the nodes 2766 simply move to the destination; this means that B/W/D ceases to be a 2767 node and so cannot be scanned. For a copy, a deletion is made at B/W/D, 2768 and a new copy (of a subtree of the original source) is made at the 2769 destination. For a move-here, a deletion is made, and a copy is made at 2770 the destination (we do not track multiple moves; the source is moved to 2771 B/W, then B/W/D is deleted; then a copy is made at the destination; 2772 however, note the double-move could have been performed by moving the 2773 subtree first, then moving the source to B/W). 2774 2775 There are three further considerations when resolving a deleted node: 2776 2777 If the BASE B/W/D was deleted explicitly *and* B/W is a replacement, 2778 then the explicit deletion is subsumed by the implicit deletion that 2779 occurred with the B/W replacement. Thus, BASE_DEL_ABSPATH will point 2780 to B/W as the root of the BASE deletion. IOW, we can detect the 2781 explicit move-away, but not an explicit deletion. 2782 2783 If B/W/D/N refers to a node present in the BASE tree, and B/W was 2784 replaced by a shallow subtree, then it is possible for N to be 2785 reported as deleted (from BASE) yet no deletions occurred in the 2786 WORKING tree above N. Thus, WORK_DEL_ABSPATH will be set to NULL. 2787 2788 2789 Summary of OUT parameters: 2790 2791 BASE_DEL_ABSPATH will specify the nearest ancestor of the explicit or 2792 implicit deletion (if any) that applies to the BASE tree. 2793 2794 WORK_DEL_ABSPATH will specify the root of a deleted subtree within 2795 the WORKING tree (note there is no concept of layered delete operations 2796 in WORKING, so there is only one deletion root in the ancestry). 2797 2798 MOVED_TO_ABSPATH will specify the path where this node was moved to 2799 if the node has moved-away. 2800 2801 If the node was moved-away, MOVED_TO_OP_ROOT_ABSPATH will specify the 2802 target path of the root of the move operation. If LOCAL_ABSPATH itself 2803 is the source path of the root of the move operation, then 2804 MOVED_TO_OP_ROOT_ABSPATH equals MOVED_TO_ABSPATH. 2805 2806 All OUT parameters may be set to NULL to indicate a lack of interest in 2807 that piece of information. 2808 2809 If the node given by LOCAL_ABSPATH does not exist, then 2810 SVN_ERR_WC_PATH_NOT_FOUND is returned. If it doesn't have a "deleted" 2811 status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS will be returned. 2812 2813 All returned data will be allocated in RESULT_POOL. All temporary 2814 allocations will be made in SCRATCH_POOL. 2815*/ 2816svn_error_t * 2817svn_wc__db_scan_deletion(const char **base_del_abspath, 2818 const char **moved_to_abspath, 2819 const char **work_del_abspath, 2820 const char **moved_to_op_root_abspath, 2821 svn_wc__db_t *db, 2822 const char *local_abspath, 2823 apr_pool_t *result_pool, 2824 apr_pool_t *scratch_pool); 2825 2826 2827/* @} */ 2828 2829 2830/* @defgroup svn_wc__db_upgrade Functions for upgrading a working copy. 2831 @{ 2832*/ 2833 2834/* Installs or updates Sqlite schema statistics for the current (aka latest) 2835 working copy schema. 2836 2837 This function should be called once on initializing the database and after 2838 an schema update completes */ 2839svn_error_t * 2840svn_wc__db_install_schema_statistics(svn_sqlite__db_t *sdb, 2841 apr_pool_t *scratch_pool); 2842 2843 2844/* Create a new wc.db file for LOCAL_DIR_ABSPATH, which is going to be a 2845 working copy for the repository REPOS_ROOT_URL with uuid REPOS_UUID. 2846 Return the raw sqlite handle, repository id and working copy id 2847 and store the database in WC_DB. 2848 2849 Perform temporary allocations in SCRATCH_POOL. */ 2850svn_error_t * 2851svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb, 2852 apr_int64_t *repos_id, 2853 apr_int64_t *wc_id, 2854 svn_wc__db_t *wc_db, 2855 const char *local_dir_abspath, 2856 const char *repos_root_url, 2857 const char *repos_uuid, 2858 apr_pool_t *scratch_pool); 2859 2860 2861svn_error_t * 2862svn_wc__db_upgrade_apply_dav_cache(svn_sqlite__db_t *sdb, 2863 const char *dir_relpath, 2864 apr_hash_t *cache_values, 2865 apr_pool_t *scratch_pool); 2866 2867 2868/* ### need much more docco 2869 2870 ### this function should be called within a sqlite transaction. it makes 2871 ### assumptions around this fact. 2872 2873 Apply the various sets of properties to the database nodes based on 2874 their existence/presence, the current state of the node, and the original 2875 format of the working copy which provided these property sets. 2876*/ 2877svn_error_t * 2878svn_wc__db_upgrade_apply_props(svn_sqlite__db_t *sdb, 2879 const char *dir_abspath, 2880 const char *local_relpath, 2881 apr_hash_t *base_props, 2882 apr_hash_t *revert_props, 2883 apr_hash_t *working_props, 2884 int original_format, 2885 apr_int64_t wc_id, 2886 apr_pool_t *scratch_pool); 2887 2888/* Simply insert (or replace) one row in the EXTERNALS table. */ 2889svn_error_t * 2890svn_wc__db_upgrade_insert_external(svn_wc__db_t *db, 2891 const char *local_abspath, 2892 svn_node_kind_t kind, 2893 const char *parent_abspath, 2894 const char *def_local_abspath, 2895 const char *repos_relpath, 2896 const char *repos_root_url, 2897 const char *repos_uuid, 2898 svn_revnum_t def_peg_revision, 2899 svn_revnum_t def_revision, 2900 apr_pool_t *scratch_pool); 2901 2902/* Get the repository identifier corresponding to REPOS_ROOT_URL from the 2903 database in SDB. The value is returned in *REPOS_ID. All allocations 2904 are allocated in SCRATCH_POOL. 2905 2906 NOTE: the row in REPOSITORY must exist. If not, then SVN_ERR_WC_DB_ERROR 2907 is returned. 2908 2909 ### unclear on whether/how this interface will stay/evolve. */ 2910svn_error_t * 2911svn_wc__db_upgrade_get_repos_id(apr_int64_t *repos_id, 2912 svn_sqlite__db_t *sdb, 2913 const char *repos_root_url, 2914 apr_pool_t *scratch_pool); 2915 2916/* Upgrade the metadata concerning the WC at WCROOT_ABSPATH, in DB, 2917 * to the SVN_WC__VERSION format. 2918 * 2919 * This function is used for upgrading wc-ng working copies to a newer 2920 * wc-ng format. If a pre-1.7 working copy is found, this function 2921 * returns SVN_ERR_WC_UPGRADE_REQUIRED. 2922 * 2923 * Upgrading subdirectories of a working copy is not supported. 2924 * If WCROOT_ABSPATH is not a working copy root SVN_ERR_WC_INVALID_OP_ON_CWD 2925 * is returned. 2926 * 2927 * If BUMPED_FORMAT is not NULL, set *BUMPED_FORMAT to TRUE if the format 2928 * was bumped or to FALSE if the wc was already at the resulting format. 2929 */ 2930svn_error_t * 2931svn_wc__db_bump_format(int *result_format, 2932 svn_boolean_t *bumped_format, 2933 svn_wc__db_t *db, 2934 const char *wcroot_abspath, 2935 apr_pool_t *scratch_pool); 2936 2937/* @} */ 2938 2939 2940/* @defgroup svn_wc__db_wq Work queue manipulation. see workqueue.h 2941 @{ 2942*/ 2943 2944/* In the WCROOT associated with DB and WRI_ABSPATH, add WORK_ITEM to the 2945 wcroot's work queue. Use SCRATCH_POOL for all temporary allocations. */ 2946svn_error_t * 2947svn_wc__db_wq_add(svn_wc__db_t *db, 2948 const char *wri_abspath, 2949 const svn_skel_t *work_item, 2950 apr_pool_t *scratch_pool); 2951 2952 2953/* In the WCROOT associated with DB and WRI_ABSPATH, fetch a work item that 2954 needs to be completed. Its identifier is returned in ID, and the data in 2955 WORK_ITEM. 2956 2957 Items are returned in the same order they were queued. This allows for 2958 (say) queueing work on a parent node to be handled before that of its 2959 children. 2960 2961 If there are no work items to be completed, then ID will be set to zero, 2962 and WORK_ITEM to NULL. 2963 2964 If COMPLETED_ID is not 0, the wq item COMPLETED_ID will be marked as 2965 completed before returning the next item. 2966 2967 RESULT_POOL will be used to allocate WORK_ITEM, and SCRATCH_POOL 2968 will be used for all temporary allocations. */ 2969svn_error_t * 2970svn_wc__db_wq_fetch_next(apr_uint64_t *id, 2971 svn_skel_t **work_item, 2972 svn_wc__db_t *db, 2973 const char *wri_abspath, 2974 apr_uint64_t completed_id, 2975 apr_pool_t *result_pool, 2976 apr_pool_t *scratch_pool); 2977 2978/* Special variant of svn_wc__db_wq_fetch_next(), which in the same transaction 2979 also records timestamps and sizes for one or more nodes */ 2980svn_error_t * 2981svn_wc__db_wq_record_and_fetch_next(apr_uint64_t *id, 2982 svn_skel_t **work_item, 2983 svn_wc__db_t *db, 2984 const char *wri_abspath, 2985 apr_uint64_t completed_id, 2986 apr_hash_t *record_map, 2987 apr_pool_t *result_pool, 2988 apr_pool_t *scratch_pool); 2989 2990 2991/* @} */ 2992 2993 2994/* Note: LEVELS_TO_LOCK is here strictly for backward compat. The access 2995 batons still have the notion of 'levels to lock' and we need to ensure 2996 that they still function correctly, even in the new world. 'levels to 2997 lock' should not be exposed through the wc-ng APIs at all: users either 2998 get to lock the entire tree (rooted at some subdir, of course), or none. 2999 3000 An infinite depth lock is obtained with LEVELS_TO_LOCK set to -1, but until 3001 we move to a single DB only depth 0 is supported. 3002*/ 3003svn_error_t * 3004svn_wc__db_wclock_obtain(svn_wc__db_t *db, 3005 const char *local_abspath, 3006 int levels_to_lock, 3007 svn_boolean_t steal_lock, 3008 apr_pool_t *scratch_pool); 3009 3010/* Set LOCK_ABSPATH to the path of the the directory that owns the 3011 lock on LOCAL_ABSPATH, or NULL, if LOCAL_ABSPATH is not locked. */ 3012svn_error_t* 3013svn_wc__db_wclock_find_root(const char **lock_abspath, 3014 svn_wc__db_t *db, 3015 const char *local_abspath, 3016 apr_pool_t *result_pool, 3017 apr_pool_t *scratch_pool); 3018 3019/* Check if somebody has a wclock on LOCAL_ABSPATH */ 3020svn_error_t * 3021svn_wc__db_wclocked(svn_boolean_t *locked, 3022 svn_wc__db_t *db, 3023 const char *local_abspath, 3024 apr_pool_t *scratch_pool); 3025 3026/* Release the previously obtained lock on LOCAL_ABSPATH */ 3027svn_error_t * 3028svn_wc__db_wclock_release(svn_wc__db_t *db, 3029 const char *local_abspath, 3030 apr_pool_t *scratch_pool); 3031 3032/* Checks whether DB currently owns a lock to operate on LOCAL_ABSPATH. 3033 If EXACT is TRUE only lock roots are checked. */ 3034svn_error_t * 3035svn_wc__db_wclock_owns_lock(svn_boolean_t *own_lock, 3036 svn_wc__db_t *db, 3037 const char *local_abspath, 3038 svn_boolean_t exact, 3039 apr_pool_t *scratch_pool); 3040 3041 3042 3043/* @defgroup svn_wc__db_temp Various temporary functions during transition 3044 3045 ### These functions SHOULD be completely removed before 1.7 3046 3047 @{ 3048*/ 3049 3050/* Removes all references to LOCAL_ABSPATH from DB, while optionally leaving 3051 a not present node. 3052 3053 This operation always recursively removes all nodes at and below 3054 LOCAL_ABSPATH from NODES and ACTUAL. 3055 3056 If NOT_PRESENT_REVISION specifies a valid revision, leave a not_present 3057 BASE node at local_abspath of the specified status and kind. 3058 (Requires an existing BASE node before removing) 3059 3060 If DESTROY_WC is TRUE, this operation *installs* workqueue operations to 3061 update the local filesystem after the database operation. If DESTROY_CHANGES 3062 is FALSE, modified and unversioned files are left after running this 3063 operation (and the WQ). If DESTROY_CHANGES and DESTROY_WC are TRUE, 3064 LOCAL_ABSPATH and everything below it will be removed by the WQ. 3065 3066 3067 Note: Unlike many similar functions it is a valid scenario for this 3068 function to be called on a wcroot! In this case it will just leave the root 3069 record in BASE 3070 */ 3071svn_error_t * 3072svn_wc__db_op_remove_node(svn_boolean_t *left_changes, 3073 svn_wc__db_t *db, 3074 const char *local_abspath, 3075 svn_boolean_t destroy_wc, 3076 svn_boolean_t destroy_changes, 3077 svn_revnum_t not_present_revision, 3078 svn_wc__db_status_t not_present_status, 3079 svn_node_kind_t not_present_kind, 3080 const svn_skel_t *conflict, 3081 const svn_skel_t *work_items, 3082 svn_cancel_func_t cancel_func, 3083 void *cancel_baton, 3084 apr_pool_t *scratch_pool); 3085 3086/* Sets the depth of LOCAL_ABSPATH in its working copy to DEPTH using DB. 3087 3088 Returns SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not a BASE directory 3089 */ 3090svn_error_t * 3091svn_wc__db_op_set_base_depth(svn_wc__db_t *db, 3092 const char *local_abspath, 3093 svn_depth_t depth, 3094 apr_pool_t *scratch_pool); 3095 3096/* ### temp function. return the FORMAT for the directory LOCAL_ABSPATH. */ 3097svn_error_t * 3098svn_wc__db_temp_get_format(int *format, 3099 svn_wc__db_t *db, 3100 const char *local_dir_abspath, 3101 apr_pool_t *scratch_pool); 3102 3103/* ### temp functions to manage/store access batons within the DB. */ 3104svn_wc_adm_access_t * 3105svn_wc__db_temp_get_access(svn_wc__db_t *db, 3106 const char *local_dir_abspath, 3107 apr_pool_t *scratch_pool); 3108void 3109svn_wc__db_temp_set_access(svn_wc__db_t *db, 3110 const char *local_dir_abspath, 3111 svn_wc_adm_access_t *adm_access, 3112 apr_pool_t *scratch_pool); 3113svn_error_t * 3114svn_wc__db_temp_close_access(svn_wc__db_t *db, 3115 const char *local_dir_abspath, 3116 svn_wc_adm_access_t *adm_access, 3117 apr_pool_t *scratch_pool); 3118void 3119svn_wc__db_temp_clear_access(svn_wc__db_t *db, 3120 const char *local_dir_abspath, 3121 apr_pool_t *scratch_pool); 3122 3123/* ### shallow hash: abspath -> svn_wc_adm_access_t * */ 3124apr_hash_t * 3125svn_wc__db_temp_get_all_access(svn_wc__db_t *db, 3126 apr_pool_t *result_pool); 3127 3128/* ### temp function to open the sqlite database to the appropriate location, 3129 ### then borrow it for a bit. 3130 ### The *only* reason for this function is because entries.c still 3131 ### manually hacks the sqlite database. 3132 3133 ### No matter how tempted you may be DO NOT USE THIS FUNCTION! 3134 ### (if you do, gstein will hunt you down and burn your knee caps off 3135 ### in the middle of the night) 3136 ### "Bet on it." --gstein 3137*/ 3138svn_error_t * 3139svn_wc__db_temp_borrow_sdb(svn_sqlite__db_t **sdb, 3140 svn_wc__db_t *db, 3141 const char *local_dir_abspath, 3142 apr_pool_t *scratch_pool); 3143 3144 3145/* Return a directory in *TEMP_DIR_ABSPATH that is suitable for temporary 3146 files which may need to be moved (atomically and same-device) into the 3147 working copy indicated by WRI_ABSPATH. */ 3148svn_error_t * 3149svn_wc__db_temp_wcroot_tempdir(const char **temp_dir_abspath, 3150 svn_wc__db_t *db, 3151 const char *wri_abspath, 3152 apr_pool_t *result_pool, 3153 apr_pool_t *scratch_pool); 3154 3155/* Update the BASE_NODE of directory LOCAL_ABSPATH to be NEW_REPOS_RELPATH 3156 at revision NEW_REV with status incomplete. */ 3157svn_error_t * 3158svn_wc__db_temp_op_start_directory_update(svn_wc__db_t *db, 3159 const char *local_abspath, 3160 const char *new_repos_relpath, 3161 svn_revnum_t new_rev, 3162 apr_pool_t *scratch_pool); 3163 3164/* Marks a directory update started with 3165 svn_wc__db_temp_op_start_directory_update as completed, by removing 3166 the incomplete status */ 3167svn_error_t * 3168svn_wc__db_temp_op_end_directory_update(svn_wc__db_t *db, 3169 const char *local_dir_abspath, 3170 apr_pool_t *scratch_pool); 3171 3172 3173/* Copy the base tree at LOCAL_ABSPATH into the working tree as copy, 3174 leaving any subtree additions and copies as-is. This allows the 3175 base node tree to be removed. */ 3176svn_error_t * 3177svn_wc__db_op_make_copy(svn_wc__db_t *db, 3178 const char *local_abspath, 3179 const svn_skel_t *conflicts, 3180 const svn_skel_t *work_items, 3181 apr_pool_t *scratch_pool); 3182 3183/* Close the wc root LOCAL_ABSPATH and remove any per-directory 3184 handles associated with it. */ 3185svn_error_t * 3186svn_wc__db_drop_root(svn_wc__db_t *db, 3187 const char *local_abspath, 3188 apr_pool_t *scratch_pool); 3189 3190/* Return the OP_DEPTH for LOCAL_RELPATH. */ 3191int 3192svn_wc__db_op_depth_for_upgrade(const char *local_relpath); 3193 3194/* Set *HAVE_WORK TRUE if there is a working layer below the top layer and 3195 *HAVE_BASE if there is a base layer. Set *STATUS to the status of the 3196 highest layer below WORKING */ 3197svn_error_t * 3198svn_wc__db_info_below_working(svn_boolean_t *have_base, 3199 svn_boolean_t *have_work, 3200 svn_wc__db_status_t *status, 3201 svn_wc__db_t *db, 3202 const char *local_abspath, 3203 apr_pool_t *scratch_pool); 3204 3205 3206/* Gets an array of const char *local_relpaths of descendants of LOCAL_ABSPATH, 3207 * which itself must be the op root of an addition, copy or move. 3208 * The descendants returned are at the same op_depth, but are to be deleted 3209 * by the commit processing because they are not present in the local copy. 3210 */ 3211svn_error_t * 3212svn_wc__db_get_not_present_descendants(const apr_array_header_t **descendants, 3213 svn_wc__db_t *db, 3214 const char *local_abspath, 3215 apr_pool_t *result_pool, 3216 apr_pool_t *scratch_pool); 3217 3218/* Gather revision status information about a working copy using DB. 3219 * 3220 * Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision 3221 * numbers found within LOCAL_ABSPATH. 3222 * Only nodes with op_depth zero and presence 'normal' or 'incomplete' 3223 * are considered, so that added, deleted or excluded nodes do not affect 3224 * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION 3225 * to the lowest and highest committed (i.e. "last changed") revision numbers, 3226 * respectively. 3227 * 3228 * Indicate in *IS_SPARSE_CHECKOUT whether any of the nodes within 3229 * LOCAL_ABSPATH is sparse. 3230 * Indicate in *IS_MODIFIED whether the working copy has local modifications. 3231 * 3232 * Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH 3233 * is switched. If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH 3234 * itself is switched. It should be any trailing portion of LOCAL_ABSPATH's 3235 * expected URL, long enough to include any parts that the caller considers 3236 * might be changed by a switch. If it does not match the end of WC_PATH's 3237 * actual URL, then report a "switched" status. 3238 * 3239 * See also the functions below which provide a subset of this functionality. 3240 */ 3241svn_error_t * 3242svn_wc__db_revision_status(svn_revnum_t *min_revision, 3243 svn_revnum_t *max_revision, 3244 svn_boolean_t *is_sparse_checkout, 3245 svn_boolean_t *is_modified, 3246 svn_boolean_t *is_switched, 3247 svn_wc__db_t *db, 3248 const char *local_abspath, 3249 const char *trail_url, 3250 svn_boolean_t committed, 3251 svn_cancel_func_t cancel_func, 3252 void *cancel_baton, 3253 apr_pool_t *scratch_pool); 3254 3255/* Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision 3256 * numbers found within LOCAL_ABSPATH in the working copy using DB. 3257 * Only nodes with op_depth zero and presence 'normal' or 'incomplete' 3258 * are considered, so that added, deleted or excluded nodes do not affect 3259 * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION 3260 * to the lowest and highest committed (i.e. "last changed") revision numbers, 3261 * respectively. Use SCRATCH_POOL for temporary allocations. 3262 * 3263 * Either of MIN_REVISION and MAX_REVISION may be passed as NULL if 3264 * the caller doesn't care about that return value. 3265 * 3266 * This function provides a subset of the functionality of 3267 * svn_wc__db_revision_status() and is more efficient if the caller 3268 * doesn't need all information returned by svn_wc__db_revision_status(). */ 3269svn_error_t * 3270svn_wc__db_min_max_revisions(svn_revnum_t *min_revision, 3271 svn_revnum_t *max_revision, 3272 svn_wc__db_t *db, 3273 const char *local_abspath, 3274 svn_boolean_t committed, 3275 apr_pool_t *scratch_pool); 3276 3277/* Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH 3278 * is switched, using DB. Use SCRATCH_POOL for temporary allocations. 3279 * 3280 * If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH itself 3281 * is switched. It should be any trailing portion of LOCAL_ABSPATH's 3282 * expected URL, long enough to include any parts that the caller considers 3283 * might be changed by a switch. If it does not match the end of WC_PATH's 3284 * actual URL, then report a "switched" status. 3285 * 3286 * This function provides a subset of the functionality of 3287 * svn_wc__db_revision_status() and is more efficient if the caller 3288 * doesn't need all information returned by svn_wc__db_revision_status(). */ 3289svn_error_t * 3290svn_wc__db_has_switched_subtrees(svn_boolean_t *is_switched, 3291 svn_wc__db_t *db, 3292 const char *local_abspath, 3293 const char *trail_url, 3294 apr_pool_t *scratch_pool); 3295 3296/* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt> 3297 * local absolute paths to <tt>const char *</tt> local absolute paths for 3298 * every path under @a local_abspath in @a db which are excluded by 3299 * the server (e.g. due to authz), or user. If no such paths are found then 3300 * @a *server_excluded_subtrees is set to @c NULL. 3301 * Allocate the hash and all items therein from @a result_pool. 3302 */ 3303svn_error_t * 3304svn_wc__db_get_excluded_subtrees(apr_hash_t **server_excluded_subtrees, 3305 svn_wc__db_t *db, 3306 const char *local_abspath, 3307 apr_pool_t *result_pool, 3308 apr_pool_t *scratch_pool); 3309 3310/* Indicate in *IS_MODIFIED whether the working copy has local modifications, 3311 * using DB. Use SCRATCH_POOL for temporary allocations. 3312 * 3313 * This function provides a subset of the functionality of 3314 * svn_wc__db_revision_status() and is more efficient if the caller 3315 * doesn't need all information returned by svn_wc__db_revision_status(). */ 3316svn_error_t * 3317svn_wc__db_has_local_mods(svn_boolean_t *is_modified, 3318 svn_wc__db_t *db, 3319 const char *local_abspath, 3320 svn_cancel_func_t cancel_func, 3321 void *cancel_baton, 3322 apr_pool_t *scratch_pool); 3323 3324 3325/* Verify the consistency of metadata concerning the WC that contains 3326 * WRI_ABSPATH, in DB. Return an error if any problem is found. */ 3327svn_error_t * 3328svn_wc__db_verify(svn_wc__db_t *db, 3329 const char *wri_abspath, 3330 apr_pool_t *scratch_pool); 3331 3332 3333/* Possibly need two structures, one with relpaths and with abspaths? 3334 * Only exposed for testing at present. */ 3335struct svn_wc__db_moved_to_t { 3336 const char *local_relpath; /* moved-to destination */ 3337 int op_depth; /* op-root of source */ 3338}; 3339 3340/* Set *FINAL_ABSPATH to an array of svn_wc__db_moved_to_t for 3341 * LOCAL_ABSPATH after following any and all nested moves. 3342 * Only exposed for testing at present. */ 3343svn_error_t * 3344svn_wc__db_follow_moved_to(apr_array_header_t **moved_tos, 3345 svn_wc__db_t *db, 3346 const char *local_abspath, 3347 apr_pool_t *result_pool, 3348 apr_pool_t *scratch_pool); 3349 3350/* Update a moved-away tree conflict victim at VICTIM_ABSPATH with changes 3351 * brought in by the update operation which flagged the tree conflict. */ 3352svn_error_t * 3353svn_wc__db_update_moved_away_conflict_victim(svn_wc__db_t *db, 3354 const char *victim_abspath, 3355 svn_wc_notify_func2_t notify_func, 3356 void *notify_baton, 3357 svn_cancel_func_t cancel_func, 3358 void *cancel_baton, 3359 apr_pool_t *scratch_pool); 3360 3361/* LOCAL_ABSPATH is moved to MOVE_DST_ABSPATH. MOVE_SRC_ROOT_ABSPATH 3362 * is the root of the move to MOVE_DST_OP_ROOT_ABSPATH. 3363 * MOVE_SRC_OP_ROOT_ABSPATH is the op-root of the move; it's the same 3364 * as MOVE_SRC_ROOT_ABSPATH except for moves inside deletes when it is 3365 * the op-root of the delete. */ 3366svn_error_t * 3367svn_wc__db_base_moved_to(const char **move_dst_abspath, 3368 const char **move_dst_op_root_abspath, 3369 const char **move_src_root_abspath, 3370 const char **move_src_op_root_abspath, 3371 svn_wc__db_t *db, 3372 const char *local_abspath, 3373 apr_pool_t *result_pool, 3374 apr_pool_t *scratch_pool); 3375 3376/* Recover space from the database file for LOCAL_ABSPATH by running 3377 * the "vacuum" command. */ 3378svn_error_t * 3379svn_wc__db_vacuum(svn_wc__db_t *db, 3380 const char *local_abspath, 3381 apr_pool_t *scratch_pool); 3382 3383/* This raises move-edit tree-conflicts on any moves inside the 3384 delete-edit conflict on LOCAL_ABSPATH. This is experimental: see 3385 comment in resolve_conflict_on_node about combining with another 3386 function. */ 3387svn_error_t * 3388svn_wc__db_resolve_delete_raise_moved_away(svn_wc__db_t *db, 3389 const char *local_abspath, 3390 svn_wc_notify_func2_t notify_func, 3391 void *notify_baton, 3392 apr_pool_t *scratch_pool); 3393 3394/* Like svn_wc__db_resolve_delete_raise_moved_away this should be 3395 combined. 3396 3397 ### LOCAL_ABSPATH specifies the move origin, but the move origin 3398 ### is not necessary unique enough. This function needs an op_root_abspath 3399 ### argument to differentiate between different origins. 3400 3401 ### See move_tests.py: move_many_update_delete for an example case. 3402 */ 3403svn_error_t * 3404svn_wc__db_resolve_break_moved_away(svn_wc__db_t *db, 3405 const char *local_abspath, 3406 svn_wc_notify_func2_t notify_func, 3407 void *notify_baton, 3408 apr_pool_t *scratch_pool); 3409 3410/* Break moves for all moved-away children of LOCAL_ABSPATH, within 3411 * a single transaction. 3412 * 3413 * ### Like svn_wc__db_resolve_delete_raise_moved_away this should be 3414 * combined. */ 3415svn_error_t * 3416svn_wc__db_resolve_break_moved_away_children(svn_wc__db_t *db, 3417 const char *local_abspath, 3418 svn_wc_notify_func2_t notify_func, 3419 void *notify_baton, 3420 apr_pool_t *scratch_pool); 3421 3422/* Set *REQUIRED_ABSPATH to the path that should be locked to ensure 3423 * that the lock covers all paths affected by resolving the conflicts 3424 * in the tree LOCAL_ABSPATH. */ 3425svn_error_t * 3426svn_wc__required_lock_for_resolve(const char **required_abspath, 3427 svn_wc__db_t *db, 3428 const char *local_abspath, 3429 apr_pool_t *result_pool, 3430 apr_pool_t *scratch_pool); 3431/* @} */ 3432 3433 3434#ifdef __cplusplus 3435} 3436#endif /* __cplusplus */ 3437 3438#endif /* SVN_WC_DB_H */ 3439