1251881Speter/** 2251881Speter * @copyright 3251881Speter * ==================================================================== 4251881Speter * Licensed to the Apache Software Foundation (ASF) under one 5251881Speter * or more contributor license agreements. See the NOTICE file 6251881Speter * distributed with this work for additional information 7251881Speter * regarding copyright ownership. The ASF licenses this file 8251881Speter * to you under the Apache License, Version 2.0 (the 9251881Speter * "License"); you may not use this file except in compliance 10251881Speter * with the License. You may obtain a copy of the License at 11251881Speter * 12251881Speter * http://www.apache.org/licenses/LICENSE-2.0 13251881Speter * 14251881Speter * Unless required by applicable law or agreed to in writing, 15251881Speter * software distributed under the License is distributed on an 16251881Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17251881Speter * KIND, either express or implied. See the License for the 18251881Speter * specific language governing permissions and limitations 19251881Speter * under the License. 20251881Speter * ==================================================================== 21251881Speter * @endcopyright 22251881Speter * 23289180Speter * @file wc_db.h 24251881Speter * @brief The Subversion Working Copy Library - Metadata/Base-Text Support 25251881Speter * 26251881Speter * Requires: 27251881Speter * - A working copy 28251881Speter * 29251881Speter * Provides: 30251881Speter * - Ability to manipulate working copy's administrative files. 31251881Speter * 32251881Speter * Used By: 33251881Speter * - The main working copy library 34251881Speter */ 35251881Speter 36251881Speter#ifndef SVN_WC_DB_H 37251881Speter#define SVN_WC_DB_H 38251881Speter 39251881Speter#include "svn_wc.h" 40251881Speter 41251881Speter#include "svn_types.h" 42251881Speter#include "svn_error.h" 43251881Speter#include "svn_config.h" 44251881Speter#include "svn_io.h" 45251881Speter 46251881Speter#include "private/svn_skel.h" 47251881Speter#include "private/svn_sqlite.h" 48251881Speter#include "private/svn_wc_private.h" 49251881Speter 50251881Speter#include "svn_private_config.h" 51251881Speter 52251881Speter#ifdef __cplusplus 53251881Speterextern "C" { 54251881Speter#endif /* __cplusplus */ 55251881Speter 56251881Speter/* INTERFACE CONVENTIONS 57251881Speter 58251881Speter "OUT" PARAMETERS 59251881Speter 60251881Speter There are numerous functions within this API which take a (large) number 61251881Speter of "out" parameters. These are listed individually, rather than combined 62251881Speter into a struct, so that a caller can be fine-grained about the which 63251881Speter pieces of information are being requested. In many cases, only a subset 64251881Speter is required, so the implementation can perform various optimizations 65251881Speter to fulfill the limited request for information. 66251881Speter 67251881Speter 68251881Speter POOLS 69251881Speter 70251881Speter wc_db uses the dual-pool paradigm for all of its functions. Any OUT 71251881Speter parameter will be allocated within the result pool, and all temporary 72251881Speter allocations will be performed within the scratch pool. 73251881Speter 74251881Speter The pool that DB is allocated within (the "state" pool) is only used 75251881Speter for a few, limited allocations to track each of the working copy roots 76251881Speter that the DB is asked to operate upon. The memory usage on this pool 77251881Speter is O(# wcroots), which should normally be one or a few. Custom clients 78251881Speter which hold open structures over a significant period of time should 79251881Speter pay particular attention to the number of roots touched, and the 80251881Speter resulting impact on memory consumption (which should still be minimal). 81251881Speter 82251881Speter 83251881Speter PARAMETER CONVENTIONS 84251881Speter 85251881Speter * Parameter Order 86251881Speter - any output arguments 87251881Speter - DB 88251881Speter - LOCAL_ABSPATH 89251881Speter - any other input arguments 90251881Speter - RESULT_POOL 91251881Speter - SCRATCH_POOL 92251881Speter 93251881Speter * DB 94251881Speter This parameter is the primary context for all operations on the 95251881Speter metadata for working copies. This parameter is passed to almost every 96251881Speter function, and maintains information and state about every working 97251881Speter copy "touched" by any of the APIs in this interface. 98251881Speter 99251881Speter * *_ABSPATH 100251881Speter All *_ABSPATH parameters in this API are absolute paths in the local 101251881Speter filesystem, represented in Subversion internal canonical form. 102251881Speter 103251881Speter * LOCAL_ABSPATH 104251881Speter This parameter specifies a particular *versioned* node in the local 105251881Speter filesystem. From this node, a working copy root is implied, and will 106251881Speter be used for the given API operation. 107251881Speter 108251881Speter * LOCAL_DIR_ABSPATH 109251881Speter This parameter is similar to LOCAL_ABSPATH, but the semantics of the 110251881Speter parameter and operation require the node to be a directory within 111251881Speter the working copy. 112251881Speter 113251881Speter * WRI_ABSPATH 114251881Speter This is a "Working copy Root Indicator" path. This refers to a location 115251881Speter in the local filesystem that is anywhere inside a working copy. The given 116251881Speter operation will be performed within the context of the root of that 117251881Speter working copy. This does not necessarily need to refer to a specific 118251881Speter versioned node or the root of a working copy (although it can) -- any 119251881Speter location, existing or not, is sufficient, as long as it is inside a 120251881Speter working copy. 121251881Speter ### TODO: Define behaviour for switches and externals. 122251881Speter ### Preference has been stated that WRI_ABSPATH should imply the root 123251881Speter ### of the parent WC of all switches and externals, but that may 124251881Speter ### not play out well, especially with multiple repositories involved. 125251881Speter*/ 126251881Speter 127251881Speter/* Context data structure for interacting with the administrative data. */ 128251881Spetertypedef struct svn_wc__db_t svn_wc__db_t; 129251881Speter 130251881Speter 131251881Speter/* Enumerated values describing the state of a node. */ 132251881Spetertypedef enum svn_wc__db_status_t { 133251881Speter /* The node is present and has no known modifications applied to it. */ 134251881Speter svn_wc__db_status_normal, 135251881Speter 136251881Speter /* The node has been added (potentially obscuring a delete or move of 137251881Speter the BASE node; see HAVE_BASE param [### What param? This is an enum 138251881Speter not a function.] ). The text will be marked as 139251881Speter modified, and if properties exist, they will be marked as modified. 140251881Speter 141251881Speter In many cases svn_wc__db_status_added means any of added, moved-here 142251881Speter or copied-here. See individual functions for clarification and 143251881Speter svn_wc__db_scan_addition() to get more details. */ 144251881Speter svn_wc__db_status_added, 145251881Speter 146251881Speter /* This node has been added with history, based on the move source. 147251881Speter Text and property modifications are based on whether changes have 148251881Speter been made against their pristine versions. */ 149251881Speter svn_wc__db_status_moved_here, 150251881Speter 151251881Speter /* This node has been added with history, based on the copy source. 152251881Speter Text and property modifications are based on whether changes have 153251881Speter been made against their pristine versions. */ 154251881Speter svn_wc__db_status_copied, 155251881Speter 156251881Speter /* This node has been deleted. No text or property modifications 157251881Speter will be present. */ 158251881Speter svn_wc__db_status_deleted, 159251881Speter 160251881Speter /* This node was named by the server, but no information was provided. */ 161251881Speter svn_wc__db_status_server_excluded, 162251881Speter 163251881Speter /* This node has been administratively excluded. */ 164251881Speter svn_wc__db_status_excluded, 165251881Speter 166251881Speter /* This node is not present in this revision. This typically happens 167251881Speter when a node is deleted and committed without updating its parent. 168251881Speter The parent revision indicates it should be present, but this node's 169251881Speter revision states otherwise. */ 170251881Speter svn_wc__db_status_not_present, 171251881Speter 172251881Speter /* This node is known, but its information is incomplete. Generally, 173251881Speter it should be treated similar to the other missing status values 174251881Speter until some (later) process updates the node with its data. 175251881Speter 176251881Speter When the incomplete status applies to a directory, the list of 177251881Speter children and the list of its base properties as recorded in the 178251881Speter working copy do not match their working copy versions. 179251881Speter The update editor can complete a directory by using a different 180251881Speter update algorithm. */ 181251881Speter svn_wc__db_status_incomplete, 182251881Speter 183251881Speter /* The BASE node has been marked as deleted. Only used as an internal 184251881Speter status in wc_db.c and entries.c. */ 185251881Speter svn_wc__db_status_base_deleted 186251881Speter 187251881Speter} svn_wc__db_status_t; 188251881Speter 189251881Speter/* Lock information. We write/read it all as one, so let's use a struct 190251881Speter for convenience. */ 191251881Spetertypedef struct svn_wc__db_lock_t { 192251881Speter /* The lock token */ 193251881Speter const char *token; 194251881Speter 195251881Speter /* The owner of the lock, possibly NULL */ 196251881Speter const char *owner; 197251881Speter 198251881Speter /* A comment about the lock, possibly NULL */ 199251881Speter const char *comment; 200251881Speter 201251881Speter /* The date the lock was created */ 202251881Speter apr_time_t date; 203251881Speter} svn_wc__db_lock_t; 204251881Speter 205251881Speter 206251881Speter/* ### NOTE: I have not provided docstrings for most of this file at this 207251881Speter ### point in time. The shape and extent of this API is still in massive 208251881Speter ### flux. I'm iterating in public, but do not want to doc until it feels 209251881Speter ### like it is "Right". 210251881Speter*/ 211251881Speter 212251881Speter/* ### where/how to handle: text_time, locks, working_size */ 213251881Speter 214251881Speter 215251881Speter/* 216251881Speter @defgroup svn_wc__db_admin General administrative functions 217251881Speter @{ 218251881Speter*/ 219251881Speter 220251881Speter/* Open a working copy administrative database context. 221251881Speter 222251881Speter This context is (initially) not associated with any particular working 223251881Speter copy directory or working copy root (wcroot). As operations are performed, 224251881Speter this context will load the appropriate wcroot information. 225251881Speter 226251881Speter The context is returned in DB. 227251881Speter 228251881Speter CONFIG should hold the various configuration options that may apply to 229251881Speter the administrative operation. It should live at least as long as the 230251881Speter RESULT_POOL parameter. 231251881Speter 232251881Speter When OPEN_WITHOUT_UPGRADE is TRUE, then the working copy databases will 233251881Speter be opened even when an old database format is found/detected during 234251881Speter the operation of a wc_db API). If open_without_upgrade is FALSE and an 235251881Speter upgrade is required, then SVN_ERR_WC_UPGRADE_REQUIRED will be returned 236251881Speter from that API. 237251881Speter Passing TRUE will allow a bare minimum of APIs to function (most notably, 238251881Speter the temp_get_format() function will always return a value) since most of 239251881Speter these APIs expect a current-format database to be present. 240251881Speter 241251881Speter If ENFORCE_EMPTY_WQ is TRUE, then any databases with stale work items in 242251881Speter their work queue will raise an error when they are opened. The operation 243251881Speter will raise SVN_ERR_WC_CLEANUP_REQUIRED. Passing FALSE for this routine 244251881Speter means that the work queue is being processed (via 'svn cleanup') and all 245251881Speter operations should be allowed. 246251881Speter 247251881Speter The DB will be closed when RESULT_POOL is cleared. It may also be closed 248251881Speter manually using svn_wc__db_close(). In particular, this will close any 249251881Speter SQLite databases that have been opened and cached. 250251881Speter 251251881Speter The context is allocated in RESULT_POOL. This pool is *retained* and used 252251881Speter for future allocations within the DB. Be forewarned about unbounded 253251881Speter memory growth if this DB is used across an unbounded number of wcroots 254251881Speter and versioned directories. 255251881Speter 256251881Speter Temporary allocations will be made in SCRATCH_POOL. 257251881Speter*/ 258251881Spetersvn_error_t * 259251881Spetersvn_wc__db_open(svn_wc__db_t **db, 260251881Speter svn_config_t *config, 261251881Speter svn_boolean_t open_without_upgrade, 262251881Speter svn_boolean_t enforce_empty_wq, 263251881Speter apr_pool_t *result_pool, 264251881Speter apr_pool_t *scratch_pool); 265251881Speter 266251881Speter 267251881Speter/* Close DB. */ 268251881Spetersvn_error_t * 269251881Spetersvn_wc__db_close(svn_wc__db_t *db); 270251881Speter 271251881Speter 272251881Speter/* Initialize the SDB for LOCAL_ABSPATH, which should be a working copy path. 273251881Speter 274251881Speter A REPOSITORY row will be constructed for the repository identified by 275251881Speter REPOS_ROOT_URL and REPOS_UUID. Neither of these may be NULL. 276251881Speter 277251881Speter A BASE_NODE row will be created for the directory at REPOS_RELPATH at 278251881Speter revision INITIAL_REV. 279251881Speter If INITIAL_REV is greater than zero, then the node will be marked as 280251881Speter "incomplete" because we don't know its children. Contrary, if the 281251881Speter INITIAL_REV is zero, then this directory should represent the root and 282251881Speter we know it has no children, so the node is complete. 283251881Speter 284251881Speter ### Is there any benefit to marking it 'complete' if rev==0? Seems like 285251881Speter ### an unnecessary special case. 286251881Speter 287251881Speter DEPTH is the initial depth of the working copy; it must be a definite 288251881Speter depth, not svn_depth_unknown. 289251881Speter 290251881Speter Use SCRATCH_POOL for temporary allocations. 291251881Speter*/ 292251881Spetersvn_error_t * 293251881Spetersvn_wc__db_init(svn_wc__db_t *db, 294251881Speter const char *local_abspath, 295251881Speter const char *repos_relpath, 296251881Speter const char *repos_root_url, 297251881Speter const char *repos_uuid, 298251881Speter svn_revnum_t initial_rev, 299251881Speter svn_depth_t depth, 300251881Speter apr_pool_t *scratch_pool); 301251881Speter 302251881Speter 303251881Speter/* Compute the LOCAL_RELPATH for the given LOCAL_ABSPATH, relative 304251881Speter from wri_abspath. 305251881Speter 306251881Speter The LOCAL_RELPATH is a relative path to the working copy's root. That 307251881Speter root will be located by this function, and the path will be relative to 308251881Speter that location. If LOCAL_ABSPATH is the wcroot directory, then "" will 309251881Speter be returned. 310251881Speter 311251881Speter The LOCAL_RELPATH should ONLY be used for persisting paths to disk. 312251881Speter Those paths should not be abspaths, otherwise the working copy cannot 313251881Speter be moved. The working copy library should not make these paths visible 314251881Speter in its API (which should all be abspaths), and it should not be using 315251881Speter relpaths for other processing. 316251881Speter 317251881Speter LOCAL_RELPATH will be allocated in RESULT_POOL. All other (temporary) 318251881Speter allocations will be made in SCRATCH_POOL. 319251881Speter 320251881Speter This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 321251881Speter option. 322251881Speter*/ 323251881Spetersvn_error_t * 324251881Spetersvn_wc__db_to_relpath(const char **local_relpath, 325251881Speter svn_wc__db_t *db, 326251881Speter const char *wri_abspath, 327251881Speter const char *local_abspath, 328251881Speter apr_pool_t *result_pool, 329251881Speter apr_pool_t *scratch_pool); 330251881Speter 331251881Speter 332251881Speter/* Compute the LOCAL_ABSPATH for a LOCAL_RELPATH located within the working 333251881Speter copy identified by WRI_ABSPATH. 334251881Speter 335251881Speter This is the reverse of svn_wc__db_to_relpath. It should be used for 336251881Speter returning a persisted relpath back into an abspath. 337251881Speter 338251881Speter LOCAL_ABSPATH will be allocated in RESULT_POOL. All other (temporary) 339251881Speter allocations will be made in SCRATCH_POOL. 340251881Speter 341251881Speter This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 342251881Speter option. 343251881Speter */ 344251881Spetersvn_error_t * 345251881Spetersvn_wc__db_from_relpath(const char **local_abspath, 346251881Speter svn_wc__db_t *db, 347251881Speter const char *wri_abspath, 348251881Speter const char *local_relpath, 349251881Speter apr_pool_t *result_pool, 350251881Speter apr_pool_t *scratch_pool); 351251881Speter 352251881Speter/* Compute the working copy root WCROOT_ABSPATH for WRI_ABSPATH using DB. 353251881Speter 354251881Speter This function is available when DB is opened with the OPEN_WITHOUT_UPGRADE 355251881Speter option. 356251881Speter */ 357251881Spetersvn_error_t * 358251881Spetersvn_wc__db_get_wcroot(const char **wcroot_abspath, 359251881Speter svn_wc__db_t *db, 360251881Speter const char *wri_abspath, 361251881Speter apr_pool_t *result_pool, 362251881Speter apr_pool_t *scratch_pool); 363251881Speter 364251881Speter 365251881Speter/* @} */ 366251881Speter 367251881Speter/* Different kinds of trees 368251881Speter 369251881Speter The design doc mentions three different kinds of trees, BASE, WORKING and 370251881Speter ACTUAL: http://svn.apache.org/repos/asf/subversion/trunk/notes/wc-ng-design 371251881Speter We have different APIs to handle each tree, enumerated below, along with 372251881Speter a blurb to explain what that tree represents. 373251881Speter*/ 374251881Speter 375251881Speter/* @defgroup svn_wc__db_base BASE tree management 376251881Speter 377251881Speter BASE is what we get from the server. It is the *absolute* pristine copy. 378251881Speter You need to use checkout, update, switch, or commit to alter your view of 379251881Speter the repository. 380251881Speter 381251881Speter In the BASE tree, each node corresponds to a particular node-rev in the 382251881Speter repository. It can be a mixed-revision tree. Each node holds either a 383251881Speter copy of the node-rev as it exists in the repository (if presence = 384251881Speter 'normal'), or a place-holder (if presence = 'server-excluded' or 'excluded' or 385251881Speter 'not-present'). 386251881Speter 387251881Speter @{ 388251881Speter*/ 389251881Speter 390251881Speter/* Add or replace a directory in the BASE tree. 391251881Speter 392251881Speter The directory is located at LOCAL_ABSPATH on the local filesystem, and 393251881Speter corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 394251881Speter repository, at revision REVISION. 395251881Speter 396251881Speter The directory properties are given by the PROPS hash (which is 397251881Speter const char *name => const svn_string_t *). 398251881Speter 399251881Speter The last-change information is given by <CHANGED_REV, CHANGED_DATE, 400251881Speter CHANGED_AUTHOR>. 401251881Speter 402251881Speter The directory's children are listed in CHILDREN, as an array of 403251881Speter const char *. The child nodes do NOT have to exist when this API 404251881Speter is called. For each child node which does not exists, an "incomplete" 405251881Speter node will be added. These child nodes will be added regardless of 406251881Speter the DEPTH value. The caller must sort out which must be recorded, 407251881Speter and which must be omitted. 408251881Speter 409251881Speter This subsystem does not use DEPTH, but it can be recorded here in 410251881Speter the BASE tree for higher-level code to use. 411251881Speter 412251881Speter If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 413251881Speter data. 414251881Speter 415251881Speter If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 416251881Speter as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 417251881Speter when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 418251881Speter ACTUAL, to mark the properties unmodified. 419251881Speter 420251881Speter If NEW_IPROPS is not NULL, then it is a depth-first ordered array of 421251881Speter svn_prop_inherited_item_t * structures that is set as the base node's 422251881Speter inherited_properties. 423251881Speter 424289180Speter If CONFLICT is not NULL, then it describes a conflict for this node. The 425289180Speter node will be record as conflicted (in ACTUAL). 426289180Speter 427251881Speter Any work items that are necessary as part of this node construction may 428251881Speter be passed in WORK_ITEMS. 429251881Speter 430251881Speter All temporary allocations will be made in SCRATCH_POOL. 431251881Speter*/ 432251881Spetersvn_error_t * 433251881Spetersvn_wc__db_base_add_directory(svn_wc__db_t *db, 434251881Speter const char *local_abspath, 435251881Speter const char *wri_abspath, 436251881Speter const char *repos_relpath, 437251881Speter const char *repos_root_url, 438251881Speter const char *repos_uuid, 439251881Speter svn_revnum_t revision, 440251881Speter const apr_hash_t *props, 441251881Speter svn_revnum_t changed_rev, 442251881Speter apr_time_t changed_date, 443251881Speter const char *changed_author, 444251881Speter const apr_array_header_t *children, 445251881Speter svn_depth_t depth, 446251881Speter apr_hash_t *dav_cache, 447251881Speter svn_boolean_t update_actual_props, 448251881Speter apr_hash_t *new_actual_props, 449251881Speter apr_array_header_t *new_iprops, 450289180Speter const svn_skel_t *conflict, 451251881Speter const svn_skel_t *work_items, 452251881Speter apr_pool_t *scratch_pool); 453251881Speter 454251881Speter/* Add a new directory in BASE, whether WORKING nodes exist or not. Mark it 455251881Speter as incomplete and with revision REVISION. If REPOS_RELPATH is not NULL, 456251881Speter apply REPOS_RELPATH, REPOS_ROOT_URL and REPOS_UUID. 457251881Speter Perform all temporary allocations in SCRATCH_POOL. 458251881Speter */ 459251881Spetersvn_error_t * 460251881Spetersvn_wc__db_base_add_incomplete_directory(svn_wc__db_t *db, 461251881Speter const char *local_abspath, 462251881Speter const char *repos_relpath, 463251881Speter const char *repos_root_url, 464251881Speter const char *repos_uuid, 465251881Speter svn_revnum_t revision, 466251881Speter svn_depth_t depth, 467251881Speter svn_boolean_t insert_base_deleted, 468251881Speter svn_boolean_t delete_working, 469251881Speter svn_skel_t *conflict, 470251881Speter svn_skel_t *work_items, 471251881Speter apr_pool_t *scratch_pool); 472251881Speter 473251881Speter 474251881Speter/* Add or replace a file in the BASE tree. 475251881Speter 476251881Speter The file is located at LOCAL_ABSPATH on the local filesystem, and 477251881Speter corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 478251881Speter repository, at revision REVISION. 479251881Speter 480251881Speter The file properties are given by the PROPS hash (which is 481251881Speter const char *name => const svn_string_t *). 482251881Speter 483251881Speter The last-change information is given by <CHANGED_REV, CHANGED_DATE, 484251881Speter CHANGED_AUTHOR>. 485251881Speter 486251881Speter The checksum of the file contents is given in CHECKSUM. An entry in 487251881Speter the pristine text base is NOT required when this API is called. 488251881Speter 489251881Speter If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 490251881Speter data. 491251881Speter 492251881Speter If CONFLICT is not NULL, then it describes a conflict for this node. The 493251881Speter node will be record as conflicted (in ACTUAL). 494251881Speter 495251881Speter If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 496251881Speter as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 497251881Speter when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 498251881Speter ACTUAL, to mark the properties unmodified. 499251881Speter 500251881Speter Any work items that are necessary as part of this node construction may 501251881Speter be passed in WORK_ITEMS. 502251881Speter 503251881Speter Unless KEEP_RECORDED_INFO is set to TRUE, recorded size and timestamp values 504251881Speter will be cleared. 505251881Speter 506251881Speter All temporary allocations will be made in SCRATCH_POOL. 507251881Speter*/ 508251881Spetersvn_error_t * 509251881Spetersvn_wc__db_base_add_file(svn_wc__db_t *db, 510251881Speter const char *local_abspath, 511251881Speter const char *wri_abspath, 512251881Speter const char *repos_relpath, 513251881Speter const char *repos_root_url, 514251881Speter const char *repos_uuid, 515251881Speter svn_revnum_t revision, 516251881Speter const apr_hash_t *props, 517251881Speter svn_revnum_t changed_rev, 518251881Speter apr_time_t changed_date, 519251881Speter const char *changed_author, 520251881Speter const svn_checksum_t *checksum, 521251881Speter apr_hash_t *dav_cache, 522251881Speter svn_boolean_t delete_working, 523251881Speter svn_boolean_t update_actual_props, 524251881Speter apr_hash_t *new_actual_props, 525251881Speter apr_array_header_t *new_iprops, 526251881Speter svn_boolean_t keep_recorded_info, 527251881Speter svn_boolean_t insert_base_deleted, 528251881Speter const svn_skel_t *conflict, 529251881Speter const svn_skel_t *work_items, 530251881Speter apr_pool_t *scratch_pool); 531251881Speter 532251881Speter 533251881Speter/* Add or replace a symlink in the BASE tree. 534251881Speter 535251881Speter The symlink is located at LOCAL_ABSPATH on the local filesystem, and 536251881Speter corresponds to <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> in the 537251881Speter repository, at revision REVISION. 538251881Speter 539251881Speter The symlink's properties are given by the PROPS hash (which is 540251881Speter const char *name => const svn_string_t *). 541251881Speter 542251881Speter The last-change information is given by <CHANGED_REV, CHANGED_DATE, 543251881Speter CHANGED_AUTHOR>. 544251881Speter 545251881Speter The target of the symlink is specified by TARGET. 546251881Speter 547251881Speter If DAV_CACHE is not NULL, sets LOCAL_ABSPATH's dav cache to the specified 548251881Speter data. 549251881Speter 550251881Speter If CONFLICT is not NULL, then it describes a conflict for this node. The 551251881Speter node will be record as conflicted (in ACTUAL). 552251881Speter 553251881Speter If UPDATE_ACTUAL_PROPS is TRUE, set the properties store NEW_ACTUAL_PROPS 554251881Speter as the new set of properties in ACTUAL. If NEW_ACTUAL_PROPS is NULL or 555251881Speter when the value of NEW_ACTUAL_PROPS matches NEW_PROPS, store NULL in 556251881Speter ACTUAL, to mark the properties unmodified. 557251881Speter 558251881Speter Any work items that are necessary as part of this node construction may 559251881Speter be passed in WORK_ITEMS. 560251881Speter 561251881Speter All temporary allocations will be made in SCRATCH_POOL. 562251881Speter*/ 563251881Speter/* ### KFF: This is an interesting question, because currently 564251881Speter ### symlinks are versioned as regular files with the svn:special 565251881Speter ### property; then the file's text contents indicate that it is a 566251881Speter ### symlink and where that symlink points. That's for portability: 567251881Speter ### you can check 'em out onto a platform that doesn't support 568251881Speter ### symlinks, and even modify the link and check it back in. It's 569251881Speter ### a great solution; but then the question for wc-ng is: 570251881Speter ### 571251881Speter ### Suppose you check out a symlink on platform X and platform Y. 572251881Speter ### X supports symlinks; Y does not. Should the wc-ng storage for 573251881Speter ### those two be the same? I mean, on platform Y, the file is just 574251881Speter ### going to look and behave like a regular file. It would be sort 575251881Speter ### of odd for the wc-ng storage for that file to be of a different 576251881Speter ### type from all the other files. (On the other hand, maybe it's 577251881Speter ### weird today that the wc-1 storage for a working symlink is to 578251881Speter ### be like a regular file (i.e., regular text-base and whatnot). 579251881Speter ### 580251881Speter ### I'm still feeling my way around this problem; just pointing out 581251881Speter ### the issues. 582251881Speter 583251881Speter ### gjs: symlinks are stored in the database as first-class objects, 584251881Speter ### rather than in the filesystem as "special" regular files. thus, 585251881Speter ### all portability concerns are moot. higher-levels can figure out 586251881Speter ### how to represent the link in ACTUAL. higher-levels can also 587251881Speter ### deal with translating to/from the svn:special property and 588251881Speter ### the plain-text file contents. 589251881Speter ### dlr: What about hard links? At minimum, mention in doc string. 590251881Speter*/ 591251881Spetersvn_error_t * 592251881Spetersvn_wc__db_base_add_symlink(svn_wc__db_t *db, 593251881Speter const char *local_abspath, 594251881Speter const char *wri_abspath, 595251881Speter const char *repos_relpath, 596251881Speter const char *repos_root_url, 597251881Speter const char *repos_uuid, 598251881Speter svn_revnum_t revision, 599251881Speter const apr_hash_t *props, 600251881Speter svn_revnum_t changed_rev, 601251881Speter apr_time_t changed_date, 602251881Speter const char *changed_author, 603251881Speter const char *target, 604251881Speter apr_hash_t *dav_cache, 605251881Speter svn_boolean_t delete_working, 606251881Speter svn_boolean_t update_actual_props, 607251881Speter apr_hash_t *new_actual_props, 608251881Speter apr_array_header_t *new_iprops, 609251881Speter svn_boolean_t keep_recorded_info, 610251881Speter svn_boolean_t insert_base_deleted, 611251881Speter const svn_skel_t *conflict, 612251881Speter const svn_skel_t *work_items, 613251881Speter apr_pool_t *scratch_pool); 614251881Speter 615251881Speter 616251881Speter/* Create a node in the BASE tree that is present in name only. 617251881Speter 618251881Speter The new node will be located at LOCAL_ABSPATH, and correspond to the 619251881Speter repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> 620251881Speter at revision REVISION. 621251881Speter 622251881Speter The node's kind is described by KIND, and the reason for its absence 623251881Speter is specified by STATUS. Only these values are allowed for STATUS: 624251881Speter 625251881Speter svn_wc__db_status_server_excluded 626251881Speter svn_wc__db_status_excluded 627251881Speter 628251881Speter If CONFLICT is not NULL, then it describes a conflict for this node. The 629251881Speter node will be record as conflicted (in ACTUAL). 630251881Speter 631251881Speter Any work items that are necessary as part of this node construction may 632251881Speter be passed in WORK_ITEMS. 633251881Speter 634251881Speter All temporary allocations will be made in SCRATCH_POOL. 635251881Speter*/ 636251881Spetersvn_error_t * 637251881Spetersvn_wc__db_base_add_excluded_node(svn_wc__db_t *db, 638251881Speter const char *local_abspath, 639251881Speter const char *repos_relpath, 640251881Speter const char *repos_root_url, 641251881Speter const char *repos_uuid, 642251881Speter svn_revnum_t revision, 643251881Speter svn_node_kind_t kind, 644251881Speter svn_wc__db_status_t status, 645251881Speter const svn_skel_t *conflict, 646251881Speter const svn_skel_t *work_items, 647251881Speter apr_pool_t *scratch_pool); 648251881Speter 649251881Speter 650251881Speter/* Create a node in the BASE tree that is present in name only. 651251881Speter 652251881Speter The new node will be located at LOCAL_ABSPATH, and correspond to the 653251881Speter repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID> 654251881Speter at revision REVISION. 655251881Speter 656251881Speter The node's kind is described by KIND, and the reason for its absence 657251881Speter is 'svn_wc__db_status_not_present'. 658251881Speter 659251881Speter If CONFLICT is not NULL, then it describes a conflict for this node. The 660251881Speter node will be record as conflicted (in ACTUAL). 661251881Speter 662251881Speter Any work items that are necessary as part of this node construction may 663251881Speter be passed in WORK_ITEMS. 664251881Speter 665251881Speter All temporary allocations will be made in SCRATCH_POOL. 666251881Speter*/ 667251881Spetersvn_error_t * 668251881Spetersvn_wc__db_base_add_not_present_node(svn_wc__db_t *db, 669251881Speter const char *local_abspath, 670251881Speter const char *repos_relpath, 671251881Speter const char *repos_root_url, 672251881Speter const char *repos_uuid, 673251881Speter svn_revnum_t revision, 674251881Speter svn_node_kind_t kind, 675251881Speter const svn_skel_t *conflict, 676251881Speter const svn_skel_t *work_items, 677251881Speter apr_pool_t *scratch_pool); 678251881Speter 679289180Speter/* Remove a node and all its descendants from the BASE tree. This can 680289180Speter be done in two modes: 681251881Speter 682289180Speter * Remove everything, scheduling wq operations to clean up 683289180Speter the working copy. (KEEP_WORKING = FALSE) 684251881Speter 685289180Speter * Bump things to WORKING, so the BASE layer is free, but the working 686289180Speter copy unmodified, except that everything that was visible from 687289180Speter BASE is now a copy of what it used to be. (KEEP_WORKING = TRUE) 688251881Speter 689251881Speter This operation *installs* workqueue operations to update the local 690251881Speter filesystem after the database operation. 691251881Speter 692251881Speter To maintain a consistent database this function will also remove 693251881Speter any working node that marks LOCAL_ABSPATH as base-deleted. If this 694251881Speter results in there being no working node for LOCAL_ABSPATH then any 695251881Speter actual node will be removed if the actual node does not mark a 696251881Speter conflict. 697251881Speter 698251881Speter 699289180Speter If MARK_NOT_PRESENT or MARK_EXCLUDED is TRUE, install a marker 700289180Speter of the specified type at the root of the now removed tree, with 701289180Speter either the specified revision (or in case of SVN_INVALID_REVNUM) 702289180Speter the original revision. 703251881Speter 704251881Speter If CONFLICT and/or WORK_ITEMS are passed they are installed as part 705251881Speter of the operation, after the work items inserted by the operation 706251881Speter itself. 707251881Speter*/ 708251881Spetersvn_error_t * 709251881Spetersvn_wc__db_base_remove(svn_wc__db_t *db, 710251881Speter const char *local_abspath, 711289180Speter svn_boolean_t keep_working, 712289180Speter svn_boolean_t mark_not_present, 713289180Speter svn_boolean_t mark_excluded, 714289180Speter svn_revnum_t marker_revision, 715251881Speter svn_skel_t *conflict, 716251881Speter svn_skel_t *work_items, 717251881Speter apr_pool_t *scratch_pool); 718251881Speter 719251881Speter 720251881Speter/* Retrieve information about a node in the BASE tree. 721251881Speter 722251881Speter For the BASE node implied by LOCAL_ABSPATH from the local filesystem, 723251881Speter return information in the provided OUT parameters. Each OUT parameter 724251881Speter may be NULL, indicating that specific item is not requested. 725251881Speter 726251881Speter If there is no information about this node, then SVN_ERR_WC_PATH_NOT_FOUND 727251881Speter will be returned. 728251881Speter 729251881Speter The OUT parameters, and their "not available" values are: 730251881Speter STATUS n/a (always available) 731251881Speter KIND n/a (always available) 732251881Speter REVISION SVN_INVALID_REVNUM 733251881Speter REPOS_RELPATH NULL (caller should scan up) 734251881Speter REPOS_ROOT_URL NULL (caller should scan up) 735251881Speter REPOS_UUID NULL (caller should scan up) 736251881Speter CHANGED_REV SVN_INVALID_REVNUM 737251881Speter CHANGED_DATE 0 738251881Speter CHANGED_AUTHOR NULL 739251881Speter DEPTH svn_depth_unknown 740251881Speter CHECKSUM NULL 741251881Speter TARGET NULL 742251881Speter LOCK NULL 743251881Speter 744251881Speter HAD_PROPS FALSE 745251881Speter PROPS NULL 746251881Speter 747251881Speter UPDATE_ROOT FALSE 748251881Speter 749251881Speter If the STATUS is normal, the REPOS_* values will be non-NULL. 750251881Speter 751251881Speter If DEPTH is requested, and the node is NOT a directory, then the 752251881Speter value will be set to svn_depth_unknown. If LOCAL_ABSPATH is a link, 753251881Speter it's up to the caller to resolve depth for the link's target. 754251881Speter 755251881Speter If CHECKSUM is requested, and the node is NOT a file, then it will 756251881Speter be set to NULL. 757251881Speter 758251881Speter If TARGET is requested, and the node is NOT a symlink, then it will 759251881Speter be set to NULL. 760251881Speter 761251881Speter *PROPS maps "const char *" names to "const svn_string_t *" values. If 762251881Speter the base node is capable of having properties but has none, set 763251881Speter *PROPS to an empty hash. If its status is such that it cannot have 764251881Speter properties, set *PROPS to NULL. 765251881Speter 766251881Speter If UPDATE_ROOT is requested, set it to TRUE if the node should only 767251881Speter be updated when it is the root of an update (e.g. file externals). 768251881Speter 769251881Speter All returned data will be allocated in RESULT_POOL. All temporary 770251881Speter allocations will be made in SCRATCH_POOL. 771251881Speter*/ 772251881Spetersvn_error_t * 773251881Spetersvn_wc__db_base_get_info(svn_wc__db_status_t *status, 774251881Speter svn_node_kind_t *kind, 775251881Speter svn_revnum_t *revision, 776251881Speter const char **repos_relpath, 777251881Speter const char **repos_root_url, 778251881Speter const char **repos_uuid, 779251881Speter svn_revnum_t *changed_rev, 780251881Speter apr_time_t *changed_date, 781251881Speter const char **changed_author, 782251881Speter svn_depth_t *depth, 783251881Speter const svn_checksum_t **checksum, 784251881Speter const char **target, 785251881Speter svn_wc__db_lock_t **lock, 786251881Speter svn_boolean_t *had_props, 787251881Speter apr_hash_t **props, 788251881Speter svn_boolean_t *update_root, 789251881Speter svn_wc__db_t *db, 790251881Speter const char *local_abspath, 791251881Speter apr_pool_t *result_pool, 792251881Speter apr_pool_t *scratch_pool); 793251881Speter 794251881Speter/* Structure returned by svn_wc__db_base_get_children_info. Only has the 795251881Speter fields needed by the adm crawler. */ 796251881Speterstruct svn_wc__db_base_info_t { 797251881Speter svn_wc__db_status_t status; 798251881Speter svn_node_kind_t kind; 799251881Speter svn_revnum_t revnum; 800251881Speter const char *repos_relpath; 801251881Speter const char *repos_root_url; 802251881Speter svn_depth_t depth; 803251881Speter svn_boolean_t update_root; 804251881Speter svn_wc__db_lock_t *lock; 805251881Speter}; 806251881Speter 807251881Speter/* Return in *NODES a hash mapping name->struct svn_wc__db_base_info_t for 808251881Speter the children of DIR_ABSPATH at op_depth 0. 809251881Speter */ 810251881Spetersvn_error_t * 811251881Spetersvn_wc__db_base_get_children_info(apr_hash_t **nodes, 812251881Speter svn_wc__db_t *db, 813251881Speter const char *dir_abspath, 814251881Speter apr_pool_t *result_pool, 815251881Speter apr_pool_t *scratch_pool); 816251881Speter 817251881Speter 818251881Speter/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the BASE tree. 819251881Speter 820251881Speter *PROPS maps "const char *" names to "const svn_string_t *" values. 821251881Speter If the node has no properties, set *PROPS to an empty hash. 822251881Speter *PROPS will never be set to NULL. 823251881Speter If the node is not present in the BASE tree (with presence 'normal' 824251881Speter or 'incomplete'), return an error. 825251881Speter Allocate *PROPS and its keys and values in RESULT_POOL. 826251881Speter*/ 827251881Spetersvn_error_t * 828251881Spetersvn_wc__db_base_get_props(apr_hash_t **props, 829251881Speter svn_wc__db_t *db, 830251881Speter const char *local_abspath, 831251881Speter apr_pool_t *result_pool, 832251881Speter apr_pool_t *scratch_pool); 833251881Speter 834251881Speter 835251881Speter/* Return a list of the BASE tree node's children's names. 836251881Speter 837251881Speter For the node indicated by LOCAL_ABSPATH, this function will return 838251881Speter the names of all of its children in the array CHILDREN. The array 839251881Speter elements are const char * values. 840251881Speter 841251881Speter If the node is not a directory, then SVN_ERR_WC_NOT_WORKING_COPY will 842251881Speter be returned. 843251881Speter 844251881Speter All returned data will be allocated in RESULT_POOL. All temporary 845251881Speter allocations will be made in SCRATCH_POOL. 846251881Speter*/ 847251881Spetersvn_error_t * 848251881Spetersvn_wc__db_base_get_children(const apr_array_header_t **children, 849251881Speter svn_wc__db_t *db, 850251881Speter const char *local_abspath, 851251881Speter apr_pool_t *result_pool, 852251881Speter apr_pool_t *scratch_pool); 853251881Speter 854251881Speter 855251881Speter/* Set the dav cache for LOCAL_ABSPATH to PROPS. Use SCRATCH_POOL for 856251881Speter temporary allocations. */ 857251881Spetersvn_error_t * 858251881Spetersvn_wc__db_base_set_dav_cache(svn_wc__db_t *db, 859251881Speter const char *local_abspath, 860251881Speter const apr_hash_t *props, 861251881Speter apr_pool_t *scratch_pool); 862251881Speter 863251881Speter 864251881Speter/* Retrieve the dav cache for LOCAL_ABSPATH into *PROPS, allocated in 865251881Speter RESULT_POOL. Use SCRATCH_POOL for temporary allocations. Return 866251881Speter SVN_ERR_WC_PATH_NOT_FOUND if no dav cache can be located for 867251881Speter LOCAL_ABSPATH in DB. */ 868251881Spetersvn_error_t * 869251881Spetersvn_wc__db_base_get_dav_cache(apr_hash_t **props, 870251881Speter svn_wc__db_t *db, 871251881Speter const char *local_abspath, 872251881Speter apr_pool_t *result_pool, 873251881Speter apr_pool_t *scratch_pool); 874251881Speter 875251881Speter/* Recursively clear the dav cache for LOCAL_ABSPATH. Use 876251881Speter SCRATCH_POOL for temporary allocations. */ 877251881Spetersvn_error_t * 878251881Spetersvn_wc__db_base_clear_dav_cache_recursive(svn_wc__db_t *db, 879251881Speter const char *local_abspath, 880251881Speter apr_pool_t *scratch_pool); 881251881Speter 882251881Speter/* Set LOCK_TOKENS to a hash mapping const char * full URLs to const char * 883251881Speter * lock tokens for every base node at or under LOCAL_ABSPATH in DB which has 884251881Speter * such a lock token set on it. 885251881Speter * Allocate the hash and all items therein from RESULT_POOL. */ 886251881Spetersvn_error_t * 887251881Spetersvn_wc__db_base_get_lock_tokens_recursive(apr_hash_t **lock_tokens, 888251881Speter svn_wc__db_t *db, 889251881Speter const char *local_abspath, 890251881Speter apr_pool_t *result_pool, 891251881Speter apr_pool_t *scratch_pool); 892251881Speter 893251881Speter/* ### anything else needed for maintaining the BASE tree? */ 894251881Speter 895251881Speter 896251881Speter/* @} */ 897251881Speter 898251881Speter/* @defgroup svn_wc__db_pristine Pristine ("text base") management 899251881Speter @{ 900251881Speter*/ 901251881Speter 902251881Speter/* Set *PRISTINE_ABSPATH to the path to the pristine text file 903251881Speter identified by SHA1_CHECKSUM. Error if it does not exist. 904251881Speter 905251881Speter ### This is temporary - callers should not be looking at the file 906251881Speter directly. 907251881Speter 908251881Speter Allocate the path in RESULT_POOL. */ 909251881Spetersvn_error_t * 910251881Spetersvn_wc__db_pristine_get_path(const char **pristine_abspath, 911251881Speter svn_wc__db_t *db, 912251881Speter const char *wri_abspath, 913251881Speter const svn_checksum_t *checksum, 914251881Speter apr_pool_t *result_pool, 915251881Speter apr_pool_t *scratch_pool); 916251881Speter 917251881Speter/* Set *PRISTINE_ABSPATH to the path under WCROOT_ABSPATH that will be 918251881Speter used by the pristine text identified by SHA1_CHECKSUM. The file 919251881Speter need not exist. 920251881Speter */ 921251881Spetersvn_error_t * 922251881Spetersvn_wc__db_pristine_get_future_path(const char **pristine_abspath, 923251881Speter const char *wcroot_abspath, 924251881Speter const svn_checksum_t *sha1_checksum, 925251881Speter apr_pool_t *result_pool, 926251881Speter apr_pool_t *scratch_pool); 927251881Speter 928251881Speter 929251881Speter/* If requested set *CONTENTS to a readable stream that will yield the pristine 930251881Speter text identified by SHA1_CHECKSUM (must be a SHA-1 checksum) within the WC 931251881Speter identified by WRI_ABSPATH in DB. 932251881Speter 933251881Speter If requested set *SIZE to the size of the pristine stream in bytes, 934251881Speter 935251881Speter Even if the pristine text is removed from the store while it is being 936251881Speter read, the stream will remain valid and readable until it is closed. 937251881Speter 938251881Speter Allocate the stream in RESULT_POOL. */ 939251881Spetersvn_error_t * 940251881Spetersvn_wc__db_pristine_read(svn_stream_t **contents, 941251881Speter svn_filesize_t *size, 942251881Speter svn_wc__db_t *db, 943251881Speter const char *wri_abspath, 944251881Speter const svn_checksum_t *sha1_checksum, 945251881Speter apr_pool_t *result_pool, 946251881Speter apr_pool_t *scratch_pool); 947251881Speter 948289180Speter/* Baton for svn_wc__db_pristine_install */ 949289180Spetertypedef struct svn_wc__db_install_data_t 950289180Speter svn_wc__db_install_data_t; 951251881Speter 952289180Speter/* Open a writable stream to a temporary text base, ready for installing 953289180Speter into the pristine store. Set *STREAM to the opened stream. The temporary 954289180Speter file will have an arbitrary unique name. Return as *INSTALL_DATA a baton 955289180Speter for eiter installing or removing the file 956251881Speter 957289180Speter Arrange that, on stream closure, *MD5_CHECKSUM and *SHA1_CHECKSUM will be 958289180Speter set to the MD-5 and SHA-1 checksums respectively of that file. 959289180Speter MD5_CHECKSUM and/or SHA1_CHECKSUM may be NULL if not wanted. 960251881Speter 961289180Speter Allocate the new stream, path and checksums in RESULT_POOL. 962289180Speter */ 963251881Spetersvn_error_t * 964289180Spetersvn_wc__db_pristine_prepare_install(svn_stream_t **stream, 965289180Speter svn_wc__db_install_data_t **install_data, 966289180Speter svn_checksum_t **sha1_checksum, 967289180Speter svn_checksum_t **md5_checksum, 968289180Speter svn_wc__db_t *db, 969289180Speter const char *wri_abspath, 970289180Speter apr_pool_t *result_pool, 971289180Speter apr_pool_t *scratch_pool); 972251881Speter 973289180Speter/* Install the file created via svn_wc__db_pristine_prepare_install() into 974289180Speter the pristine data store, to be identified by the SHA-1 checksum of its 975289180Speter contents, SHA1_CHECKSUM, and whose MD-5 checksum is MD5_CHECKSUM. */ 976251881Spetersvn_error_t * 977289180Spetersvn_wc__db_pristine_install(svn_wc__db_install_data_t *install_data, 978251881Speter const svn_checksum_t *sha1_checksum, 979251881Speter const svn_checksum_t *md5_checksum, 980251881Speter apr_pool_t *scratch_pool); 981251881Speter 982289180Speter/* Removes the temporary data created by svn_wc__db_pristine_prepare_install 983289180Speter when the pristine won't be installed. */ 984289180Spetersvn_error_t * 985289180Spetersvn_wc__db_pristine_install_abort(svn_wc__db_install_data_t *install_data, 986289180Speter apr_pool_t *scratch_pool); 987251881Speter 988289180Speter 989251881Speter/* Set *MD5_CHECKSUM to the MD-5 checksum of a pristine text 990251881Speter identified by its SHA-1 checksum SHA1_CHECKSUM. Return an error 991251881Speter if the pristine text does not exist or its MD5 checksum is not found. 992251881Speter 993251881Speter Allocate *MD5_CHECKSUM in RESULT_POOL. */ 994251881Spetersvn_error_t * 995251881Spetersvn_wc__db_pristine_get_md5(const svn_checksum_t **md5_checksum, 996251881Speter svn_wc__db_t *db, 997251881Speter const char *wri_abspath, 998251881Speter const svn_checksum_t *sha1_checksum, 999251881Speter apr_pool_t *result_pool, 1000251881Speter apr_pool_t *scratch_pool); 1001251881Speter 1002251881Speter 1003251881Speter/* Set *SHA1_CHECKSUM to the SHA-1 checksum of a pristine text 1004251881Speter identified by its MD-5 checksum MD5_CHECKSUM. Return an error 1005251881Speter if the pristine text does not exist or its SHA-1 checksum is not found. 1006251881Speter 1007251881Speter Note: The MD-5 checksum is not strictly guaranteed to be unique in the 1008251881Speter database table, although duplicates are expected to be extremely rare. 1009251881Speter ### TODO: The behaviour is currently unspecified if the MD-5 checksum is 1010251881Speter not unique. Need to see whether this function is going to stay in use, 1011251881Speter and, if so, address this somehow. 1012251881Speter 1013251881Speter Allocate *SHA1_CHECKSUM in RESULT_POOL. */ 1014251881Spetersvn_error_t * 1015251881Spetersvn_wc__db_pristine_get_sha1(const svn_checksum_t **sha1_checksum, 1016251881Speter svn_wc__db_t *db, 1017251881Speter const char *wri_abspath, 1018251881Speter const svn_checksum_t *md5_checksum, 1019251881Speter apr_pool_t *result_pool, 1020251881Speter apr_pool_t *scratch_pool); 1021251881Speter 1022251881Speter 1023251881Speter/* If necessary transfers the PRISTINE files of the tree rooted at 1024251881Speter SRC_LOCAL_ABSPATH to the working copy identified by DST_WRI_ABSPATH. */ 1025251881Spetersvn_error_t * 1026251881Spetersvn_wc__db_pristine_transfer(svn_wc__db_t *db, 1027251881Speter const char *src_local_abspath, 1028251881Speter const char *dst_wri_abspath, 1029251881Speter svn_cancel_func_t cancel_func, 1030251881Speter void *cancel_baton, 1031251881Speter apr_pool_t *scratch_pool); 1032251881Speter 1033251881Speter/* Remove the pristine text with SHA-1 checksum SHA1_CHECKSUM from the 1034251881Speter * pristine store, iff it is not referenced by any of the (other) WC DB 1035251881Speter * tables. */ 1036251881Spetersvn_error_t * 1037251881Spetersvn_wc__db_pristine_remove(svn_wc__db_t *db, 1038251881Speter const char *wri_abspath, 1039251881Speter const svn_checksum_t *sha1_checksum, 1040251881Speter apr_pool_t *scratch_pool); 1041251881Speter 1042251881Speter 1043251881Speter/* Remove all unreferenced pristines in the WC of WRI_ABSPATH in DB. */ 1044251881Spetersvn_error_t * 1045251881Spetersvn_wc__db_pristine_cleanup(svn_wc__db_t *db, 1046251881Speter const char *wri_abspath, 1047251881Speter apr_pool_t *scratch_pool); 1048251881Speter 1049251881Speter 1050251881Speter/* Set *PRESENT to true if the pristine store for WRI_ABSPATH in DB contains 1051251881Speter a pristine text with SHA-1 checksum SHA1_CHECKSUM, and to false otherwise. 1052251881Speter*/ 1053251881Spetersvn_error_t * 1054251881Spetersvn_wc__db_pristine_check(svn_boolean_t *present, 1055251881Speter svn_wc__db_t *db, 1056251881Speter const char *wri_abspath, 1057251881Speter const svn_checksum_t *sha1_checksum, 1058251881Speter apr_pool_t *scratch_pool); 1059251881Speter 1060251881Speter/* @defgroup svn_wc__db_external External management 1061251881Speter @{ */ 1062251881Speter 1063251881Speter/* Adds (or overwrites) a file external LOCAL_ABSPATH to the working copy 1064251881Speter identified by WRI_ABSPATH. 1065251881Speter 1066251881Speter It updates both EXTERNALS and NODES in one atomic step. 1067251881Speter */ 1068251881Spetersvn_error_t * 1069251881Spetersvn_wc__db_external_add_file(svn_wc__db_t *db, 1070251881Speter const char *local_abspath, 1071251881Speter const char *wri_abspath, 1072251881Speter 1073251881Speter const char *repos_relpath, 1074251881Speter const char *repos_root_url, 1075251881Speter const char *repos_uuid, 1076251881Speter svn_revnum_t revision, 1077251881Speter 1078251881Speter const apr_hash_t *props, 1079251881Speter apr_array_header_t *iprops, 1080251881Speter 1081251881Speter svn_revnum_t changed_rev, 1082251881Speter apr_time_t changed_date, 1083251881Speter const char *changed_author, 1084251881Speter 1085251881Speter const svn_checksum_t *checksum, 1086251881Speter 1087251881Speter const apr_hash_t *dav_cache, 1088251881Speter 1089251881Speter const char *record_ancestor_abspath, 1090251881Speter const char *recorded_repos_relpath, 1091251881Speter svn_revnum_t recorded_peg_revision, 1092251881Speter svn_revnum_t recorded_revision, 1093251881Speter 1094251881Speter svn_boolean_t update_actual_props, 1095251881Speter apr_hash_t *new_actual_props, 1096251881Speter 1097251881Speter svn_boolean_t keep_recorded_info, 1098251881Speter const svn_skel_t *conflict, 1099251881Speter const svn_skel_t *work_items, 1100251881Speter apr_pool_t *scratch_pool); 1101251881Speter 1102251881Speter/* Adds (or overwrites) a symlink external LOCAL_ABSPATH to the working copy 1103251881Speter identified by WRI_ABSPATH. 1104251881Speter */ 1105251881Spetersvn_error_t * 1106251881Spetersvn_wc__db_external_add_symlink(svn_wc__db_t *db, 1107251881Speter const char *local_abspath, 1108251881Speter const char *wri_abspath, 1109251881Speter 1110251881Speter const char *repos_relpath, 1111251881Speter const char *repos_root_url, 1112251881Speter const char *repos_uuid, 1113251881Speter svn_revnum_t revision, 1114251881Speter 1115251881Speter const apr_hash_t *props, 1116251881Speter 1117251881Speter svn_revnum_t changed_rev, 1118251881Speter apr_time_t changed_date, 1119251881Speter const char *changed_author, 1120251881Speter 1121251881Speter const char *target, 1122251881Speter 1123251881Speter const apr_hash_t *dav_cache, 1124251881Speter 1125251881Speter const char *record_ancestor_abspath, 1126251881Speter const char *recorded_repos_relpath, 1127251881Speter svn_revnum_t recorded_peg_revision, 1128251881Speter svn_revnum_t recorded_revision, 1129251881Speter 1130251881Speter svn_boolean_t update_actual_props, 1131251881Speter apr_hash_t *new_actual_props, 1132251881Speter 1133251881Speter svn_boolean_t keep_recorded_info, 1134251881Speter const svn_skel_t *work_items, 1135251881Speter apr_pool_t *scratch_pool); 1136251881Speter 1137251881Speter/* Adds (or overwrites) a directory external LOCAL_ABSPATH to the working copy 1138251881Speter identified by WRI_ABSPATH. 1139251881Speter 1140251881Speter Directory externals are stored in their own working copy, so one should use 1141251881Speter the normal svn_wc__db functions to access the normal working copy 1142251881Speter information. 1143251881Speter */ 1144251881Spetersvn_error_t * 1145251881Spetersvn_wc__db_external_add_dir(svn_wc__db_t *db, 1146251881Speter const char *local_abspath, 1147251881Speter const char *wri_abspath, 1148251881Speter 1149251881Speter const char *repos_root_url, 1150251881Speter const char *repos_uuid, 1151251881Speter 1152251881Speter const char *record_ancestor_abspath, 1153251881Speter const char *recorded_repos_relpath, 1154251881Speter svn_revnum_t recorded_peg_revision, 1155251881Speter svn_revnum_t recorded_revision, 1156251881Speter 1157251881Speter const svn_skel_t *work_items, 1158251881Speter apr_pool_t *scratch_pool); 1159251881Speter 1160251881Speter/* Remove a registered external LOCAL_ABSPATH from the working copy identified 1161251881Speter by WRI_ABSPATH. 1162251881Speter */ 1163251881Spetersvn_error_t * 1164251881Spetersvn_wc__db_external_remove(svn_wc__db_t *db, 1165251881Speter const char *local_abspath, 1166251881Speter const char *wri_abspath, 1167251881Speter 1168251881Speter const svn_skel_t *work_items, 1169251881Speter apr_pool_t *scratch_pool); 1170251881Speter 1171251881Speter 1172251881Speter/* Reads information on the external LOCAL_ABSPATH as stored in the working 1173251881Speter copy identified with WRI_ABSPATH (If NULL the parent directory of 1174251881Speter LOCAL_ABSPATH is taken as WRI_ABSPATH). 1175251881Speter 1176251881Speter Return SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not an external in 1177251881Speter this working copy. 1178251881Speter 1179251881Speter When STATUS is requested it has one of these values 1180251881Speter svn_wc__db_status_normal The external is available 1181251881Speter svn_wc__db_status_excluded The external is user excluded 1182251881Speter 1183251881Speter When KIND is requested then the value will be set to the kind of external. 1184251881Speter 1185251881Speter If DEFINING_ABSPATH is requested, then the value will be set to the 1186251881Speter absolute path of the directory which originally defined the external. 1187251881Speter (The path with the svn:externals property) 1188251881Speter 1189251881Speter If REPOS_ROOT_URL is requested, then the value will be set to the 1190251881Speter repository root of the external. 1191251881Speter 1192251881Speter If REPOS_UUID is requested, then the value will be set to the 1193251881Speter repository uuid of the external. 1194251881Speter 1195251881Speter If RECORDED_REPOS_RELPATH is requested, then the value will be set to the 1196251881Speter original repository relative path inside REPOS_ROOT_URL of the external. 1197251881Speter 1198251881Speter If RECORDED_PEG_REVISION is requested, then the value will be set to the 1199251881Speter original recorded operational (peg) revision of the external. 1200251881Speter 1201251881Speter If RECORDED_REVISION is requested, then the value will be set to the 1202251881Speter original recorded revision of the external. 1203251881Speter 1204251881Speter Allocate the result in RESULT_POOL and perform temporary allocations in 1205251881Speter SCRATCH_POOL. 1206251881Speter */ 1207251881Spetersvn_error_t * 1208251881Spetersvn_wc__db_external_read(svn_wc__db_status_t *status, 1209251881Speter svn_node_kind_t *kind, 1210251881Speter const char **defining_abspath, 1211251881Speter 1212251881Speter const char **repos_root_url, 1213251881Speter const char **repos_uuid, 1214251881Speter 1215251881Speter const char **recorded_repos_relpath, 1216251881Speter svn_revnum_t *recorded_peg_revision, 1217251881Speter svn_revnum_t *recorded_revision, 1218251881Speter 1219251881Speter svn_wc__db_t *db, 1220251881Speter const char *local_abspath, 1221251881Speter const char *wri_abspath, 1222251881Speter apr_pool_t *result_pool, 1223251881Speter apr_pool_t *scratch_pool); 1224251881Speter 1225251881Speter/* Return in *EXTERNALS a list of svn_wc__committable_external_info_t * 1226251881Speter * containing info on externals defined to be checked out below LOCAL_ABSPATH, 1227251881Speter * returning only those externals that are not fixed to a specific revision. 1228251881Speter * 1229251881Speter * If IMMEDIATES_ONLY is TRUE, only those externals defined to be checked out 1230251881Speter * as immediate children of LOCAL_ABSPATH are returned (this is useful for 1231251881Speter * treating user requested depth < infinity). 1232251881Speter * 1233251881Speter * If there are no externals to be returned, set *EXTERNALS to NULL. Otherwise 1234251881Speter * set *EXTERNALS to an APR array newly cleated in RESULT_POOL. 1235251881Speter * 1236251881Speter * NOTE: This only returns the externals known by the immediate WC root for 1237251881Speter * LOCAL_ABSPATH; i.e.: 1238251881Speter * - If there is a further parent WC "above" the immediate WC root, and if 1239251881Speter * that parent WC defines externals to live somewhere within this WC, these 1240251881Speter * externals will appear to be foreign/unversioned and won't be picked up. 1241251881Speter * - Likewise, only the topmost level of externals nestings (externals 1242251881Speter * defined within a checked out external dir) is picked up by this function. 1243251881Speter * (For recursion, see svn_wc__committable_externals_below().) 1244251881Speter * 1245251881Speter * ###TODO: Add a WRI_ABSPATH (wc root indicator) separate from LOCAL_ABSPATH, 1246251881Speter * to allow searching any wc-root for externals under LOCAL_ABSPATH, not only 1247251881Speter * LOCAL_ABSPATH's most immediate wc-root. */ 1248251881Spetersvn_error_t * 1249251881Spetersvn_wc__db_committable_externals_below(apr_array_header_t **externals, 1250251881Speter svn_wc__db_t *db, 1251251881Speter const char *local_abspath, 1252251881Speter svn_boolean_t immediates_only, 1253251881Speter apr_pool_t *result_pool, 1254251881Speter apr_pool_t *scratch_pool); 1255251881Speter 1256289180Speter/* Opaque struct for svn_wc__db_create_commit_queue, svn_wc__db_commit_queue_add, 1257289180Speter svn_wc__db_process_commit_queue */ 1258289180Spetertypedef struct svn_wc__db_commit_queue_t svn_wc__db_commit_queue_t; 1259289180Speter 1260289180Speter/* Create a new svn_wc__db_commit_queue_t instance in RESULT_POOL for the 1261289180Speter working copy specified with WRI_ABSPATH */ 1262289180Spetersvn_error_t * 1263289180Spetersvn_wc__db_create_commit_queue(svn_wc__db_commit_queue_t **queue, 1264289180Speter svn_wc__db_t *db, 1265289180Speter const char *wri_abspath, 1266289180Speter apr_pool_t *result_pool, 1267289180Speter apr_pool_t *scratch_pool); 1268289180Speter 1269289180Speter/* Adds the specified path to the commit queue with the related information. 1270289180Speter 1271289180Speter See svn_wc_queue_committed4() for argument documentation. 1272289180Speter 1273289180Speter Note that this function currently DOESN'T copy the passed values to 1274289180Speter RESULT_POOL, but expects them to be valid until processing. Otherwise the 1275289180Speter only users memory requirements would +- double. 1276289180Speter */ 1277289180Spetersvn_error_t * 1278289180Spetersvn_wc__db_commit_queue_add(svn_wc__db_commit_queue_t *queue, 1279289180Speter const char *local_abspath, 1280289180Speter svn_boolean_t recurse, 1281289180Speter svn_boolean_t is_commited, 1282289180Speter svn_boolean_t remove_lock, 1283289180Speter svn_boolean_t remove_changelist, 1284289180Speter const svn_checksum_t *new_sha1_checksum, 1285289180Speter apr_hash_t *new_dav_cache, 1286289180Speter apr_pool_t *result_pool, 1287289180Speter apr_pool_t *scratch_pool); 1288289180Speter 1289289180Speter/* Process the items in QUEUE in a single transaction. Commit workqueue items 1290289180Speter for items that need post processing. 1291289180Speter 1292289180Speter Implementation detail of svn_wc_process_committed_queue2(). 1293289180Speter */ 1294289180Spetersvn_error_t * 1295289180Spetersvn_wc__db_process_commit_queue(svn_wc__db_t *db, 1296289180Speter svn_wc__db_commit_queue_t *queue, 1297289180Speter svn_revnum_t new_revnum, 1298289180Speter apr_time_t new_date, 1299289180Speter const char *new_author, 1300289180Speter apr_pool_t *scratch_pool); 1301289180Speter 1302289180Speter 1303251881Speter/* Gets a mapping from const char * local abspaths of externals to the const 1304251881Speter char * local abspath of where they are defined for all externals defined 1305251881Speter at or below LOCAL_ABSPATH. 1306251881Speter 1307251881Speter ### Returns NULL in *EXTERNALS until we bumped to format 29. 1308251881Speter 1309251881Speter Allocate the result in RESULT_POOL and perform temporary allocations in 1310251881Speter SCRATCH_POOL. */ 1311251881Spetersvn_error_t * 1312251881Spetersvn_wc__db_externals_defined_below(apr_hash_t **externals, 1313251881Speter svn_wc__db_t *db, 1314251881Speter const char *local_abspath, 1315251881Speter apr_pool_t *result_pool, 1316251881Speter apr_pool_t *scratch_pool); 1317251881Speter 1318251881Speter/* Gather all svn:externals property values from the actual properties on 1319251881Speter directories below LOCAL_ABSPATH as a mapping of const char *local_abspath 1320251881Speter to const char * property values. 1321251881Speter 1322251881Speter If DEPTHS is not NULL, set *depths to an apr_hash_t* mapping the same 1323251881Speter local_abspaths to the const char * ambient depth of the node. 1324251881Speter 1325251881Speter Allocate the result in RESULT_POOL and perform temporary allocations in 1326251881Speter SCRATCH_POOL. */ 1327251881Spetersvn_error_t * 1328251881Spetersvn_wc__db_externals_gather_definitions(apr_hash_t **externals, 1329251881Speter apr_hash_t **depths, 1330251881Speter svn_wc__db_t *db, 1331251881Speter const char *local_abspath, 1332251881Speter apr_pool_t *result_pool, 1333251881Speter apr_pool_t *scratch_pool); 1334251881Speter 1335251881Speter/* @} */ 1336251881Speter 1337251881Speter/* @defgroup svn_wc__db_op Operations on WORKING tree 1338251881Speter @{ 1339251881Speter*/ 1340251881Speter 1341251881Speter/* Copy the node at SRC_ABSPATH (in NODES and ACTUAL_NODE tables) to 1342251881Speter * DST_ABSPATH, both in DB but not necessarily in the same WC. The parent 1343251881Speter * of DST_ABSPATH must be a versioned directory. 1344251881Speter * 1345251881Speter * This copy is NOT recursive. It simply establishes this one node, plus 1346251881Speter * incomplete nodes for the children. 1347251881Speter * 1348251881Speter * If IS_MOVE is TRUE, mark this copy operation as the copy-half of 1349251881Speter * a move. The delete-half of the move needs to be created separately 1350251881Speter * with svn_wc__db_op_delete(). 1351251881Speter * 1352251881Speter * Add WORK_ITEMS to the work queue. */ 1353251881Spetersvn_error_t * 1354251881Spetersvn_wc__db_op_copy(svn_wc__db_t *db, 1355251881Speter const char *src_abspath, 1356251881Speter const char *dst_abspath, 1357251881Speter const char *dst_op_root_abspath, 1358251881Speter svn_boolean_t is_move, 1359251881Speter const svn_skel_t *work_items, 1360251881Speter apr_pool_t *scratch_pool); 1361251881Speter 1362251881Speter/* Checks if LOCAL_ABSPATH represents a move back to its original location, 1363251881Speter * and if it is reverts the move while keeping local changes after it has been 1364251881Speter * moved from MOVED_FROM_ABSPATH. 1365251881Speter * 1366251881Speter * If MOVED_BACK is not NULL, set *MOVED_BACK to TRUE when a move was reverted, 1367251881Speter * otherwise to FALSE. 1368251881Speter */ 1369251881Spetersvn_error_t * 1370251881Spetersvn_wc__db_op_handle_move_back(svn_boolean_t *moved_back, 1371251881Speter svn_wc__db_t *db, 1372251881Speter const char *local_abspath, 1373251881Speter const char *moved_from_abspath, 1374251881Speter const svn_skel_t *work_items, 1375251881Speter apr_pool_t *scratch_pool); 1376251881Speter 1377251881Speter 1378251881Speter/* Copy the leaves of the op_depth layer directly shadowed by the operation 1379251881Speter * of SRC_ABSPATH (so SRC_ABSPATH must be an op_root) to dst_abspaths 1380251881Speter * parents layer. 1381251881Speter * 1382251881Speter * This operation is recursive. It copies all the descendants at the lower 1383251881Speter * layer and adds base-deleted nodes on dst_abspath layer to mark these nodes 1384251881Speter * properly deleted. 1385251881Speter * 1386251881Speter * Usually this operation is directly followed by a call to svn_wc__db_op_copy 1387251881Speter * which performs the real copy from src_abspath to dst_abspath. 1388251881Speter */ 1389251881Spetersvn_error_t * 1390251881Spetersvn_wc__db_op_copy_shadowed_layer(svn_wc__db_t *db, 1391251881Speter const char *src_abspath, 1392251881Speter const char *dst_abspath, 1393251881Speter svn_boolean_t is_move, 1394251881Speter apr_pool_t *scratch_pool); 1395251881Speter 1396251881Speter 1397251881Speter/* Record a copy at LOCAL_ABSPATH from a repository directory. 1398251881Speter 1399251881Speter This copy is NOT recursive. It simply establishes this one node. 1400251881Speter CHILDREN must be provided, and incomplete nodes will be constructed 1401251881Speter for them. 1402251881Speter 1403251881Speter ### arguments docco. */ 1404251881Spetersvn_error_t * 1405251881Spetersvn_wc__db_op_copy_dir(svn_wc__db_t *db, 1406251881Speter const char *local_abspath, 1407251881Speter const apr_hash_t *props, 1408251881Speter svn_revnum_t changed_rev, 1409251881Speter apr_time_t changed_date, 1410251881Speter const char *changed_author, 1411251881Speter const char *original_repos_relpath, 1412251881Speter const char *original_root_url, 1413251881Speter const char *original_uuid, 1414251881Speter svn_revnum_t original_revision, 1415251881Speter const apr_array_header_t *children, 1416286506Speter svn_depth_t depth, 1417251881Speter svn_boolean_t is_move, 1418251881Speter const svn_skel_t *conflict, 1419251881Speter const svn_skel_t *work_items, 1420251881Speter apr_pool_t *scratch_pool); 1421251881Speter 1422251881Speter 1423251881Speter/* Record a copy at LOCAL_ABSPATH from a repository file. 1424251881Speter 1425251881Speter ### arguments docco. */ 1426251881Spetersvn_error_t * 1427251881Spetersvn_wc__db_op_copy_file(svn_wc__db_t *db, 1428251881Speter const char *local_abspath, 1429251881Speter const apr_hash_t *props, 1430251881Speter svn_revnum_t changed_rev, 1431251881Speter apr_time_t changed_date, 1432251881Speter const char *changed_author, 1433251881Speter const char *original_repos_relpath, 1434251881Speter const char *original_root_url, 1435251881Speter const char *original_uuid, 1436251881Speter svn_revnum_t original_revision, 1437251881Speter const svn_checksum_t *checksum, 1438251881Speter svn_boolean_t update_actual_props, 1439251881Speter const apr_hash_t *new_actual_props, 1440251881Speter svn_boolean_t is_move, 1441251881Speter const svn_skel_t *conflict, 1442251881Speter const svn_skel_t *work_items, 1443251881Speter apr_pool_t *scratch_pool); 1444251881Speter 1445251881Speter 1446251881Spetersvn_error_t * 1447251881Spetersvn_wc__db_op_copy_symlink(svn_wc__db_t *db, 1448251881Speter const char *local_abspath, 1449251881Speter const apr_hash_t *props, 1450251881Speter svn_revnum_t changed_rev, 1451251881Speter apr_time_t changed_date, 1452251881Speter const char *changed_author, 1453251881Speter const char *original_repos_relpath, 1454251881Speter const char *original_root_url, 1455251881Speter const char *original_uuid, 1456251881Speter svn_revnum_t original_revision, 1457251881Speter const char *target, 1458286506Speter svn_boolean_t is_move, 1459251881Speter const svn_skel_t *conflict, 1460251881Speter const svn_skel_t *work_items, 1461251881Speter apr_pool_t *scratch_pool); 1462251881Speter 1463251881Speter 1464251881Speter/* ### do we need svn_wc__db_op_copy_server_excluded() ?? */ 1465251881Speter 1466251881Speter 1467251881Speter/* ### add a new versioned directory. a list of children is NOT passed 1468251881Speter ### since they are added in future, distinct calls to db_op_add_*. 1469251881Speter PROPS gives the properties; empty or NULL means none. */ 1470251881Speter/* ### do we need a CONFLICTS param? */ 1471251881Spetersvn_error_t * 1472251881Spetersvn_wc__db_op_add_directory(svn_wc__db_t *db, 1473251881Speter const char *local_abspath, 1474251881Speter const apr_hash_t *props, 1475251881Speter const svn_skel_t *work_items, 1476251881Speter apr_pool_t *scratch_pool); 1477251881Speter 1478251881Speter 1479251881Speter/* Add a file. 1480251881Speter PROPS gives the properties; empty or NULL means none. 1481251881Speter ### this file has no "pristine" 1482251881Speter ### contents, so a checksum [reference] is not required. */ 1483251881Speter/* ### do we need a CONFLICTS param? */ 1484251881Spetersvn_error_t * 1485251881Spetersvn_wc__db_op_add_file(svn_wc__db_t *db, 1486251881Speter const char *local_abspath, 1487251881Speter const apr_hash_t *props, 1488251881Speter const svn_skel_t *work_items, 1489251881Speter apr_pool_t *scratch_pool); 1490251881Speter 1491251881Speter 1492251881Speter/* Add a symlink. 1493251881Speter PROPS gives the properties; empty or NULL means none. */ 1494251881Speter/* ### do we need a CONFLICTS param? */ 1495251881Spetersvn_error_t * 1496251881Spetersvn_wc__db_op_add_symlink(svn_wc__db_t *db, 1497251881Speter const char *local_abspath, 1498251881Speter const char *target, 1499251881Speter const apr_hash_t *props, 1500251881Speter const svn_skel_t *work_items, 1501251881Speter apr_pool_t *scratch_pool); 1502251881Speter 1503251881Speter 1504251881Speter/* Set the properties of the node LOCAL_ABSPATH in the ACTUAL tree to 1505251881Speter PROPS. 1506251881Speter 1507251881Speter PROPS maps "const char *" names to "const svn_string_t *" values. 1508251881Speter To specify no properties, PROPS must be an empty hash, not NULL. 1509251881Speter If the node is not present, return an error. 1510251881Speter 1511251881Speter If PROPS is NULL, set the properties to be the same as the pristine 1512251881Speter properties. 1513251881Speter 1514251881Speter If CONFLICT is not NULL, it is used to register a conflict on this 1515251881Speter node at the same time the properties are changed. 1516251881Speter 1517251881Speter WORK_ITEMS are inserted into the work queue, as additional things that 1518251881Speter need to be completed before the working copy is stable. 1519251881Speter 1520251881Speter 1521251881Speter If CLEAR_RECORDED_INFO is true, the recorded information for the node 1522251881Speter is cleared. (commonly used when updating svn:* magic properties). 1523251881Speter 1524251881Speter NOTE: This will overwrite ALL working properties the node currently 1525251881Speter has. There is no db_op_set_prop() function. Callers must read all the 1526251881Speter properties, change one, and write all the properties. 1527251881Speter ### ugh. this has poor transaction semantics... 1528251881Speter 1529251881Speter 1530251881Speter NOTE: This will create an entry in the ACTUAL table for the node if it 1531251881Speter does not yet have one. 1532251881Speter*/ 1533251881Spetersvn_error_t * 1534251881Spetersvn_wc__db_op_set_props(svn_wc__db_t *db, 1535251881Speter const char *local_abspath, 1536251881Speter apr_hash_t *props, 1537251881Speter svn_boolean_t clear_recorded_info, 1538251881Speter const svn_skel_t *conflict, 1539251881Speter const svn_skel_t *work_items, 1540251881Speter apr_pool_t *scratch_pool); 1541251881Speter 1542251881Speter/* Mark LOCAL_ABSPATH, and all children, for deletion. 1543251881Speter * 1544251881Speter * This function removes the file externals (and if DELETE_DIR_EXTERNALS is 1545251881Speter * TRUE also the directory externals) registered below LOCAL_ABSPATH. 1546251881Speter * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes) 1547251881Speter * 1548251881Speter * If MOVED_TO_ABSPATH is not NULL, mark the deletion of LOCAL_ABSPATH 1549251881Speter * as the delete-half of a move from LOCAL_ABSPATH to MOVED_TO_ABSPATH. 1550251881Speter * 1551251881Speter * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON) 1552251881Speter * for each node deleted. While this processing occurs, if CANCEL_FUNC is 1553251881Speter * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation 1554251881Speter * during the processing. 1555251881Speter * 1556251881Speter * Note: the notification (and cancellation) occur outside of a SQLite 1557251881Speter * transaction. 1558251881Speter */ 1559251881Spetersvn_error_t * 1560251881Spetersvn_wc__db_op_delete(svn_wc__db_t *db, 1561251881Speter const char *local_abspath, 1562251881Speter const char *moved_to_abspath, 1563251881Speter svn_boolean_t delete_dir_externals, 1564251881Speter svn_skel_t *conflict, 1565251881Speter svn_skel_t *work_items, 1566251881Speter svn_cancel_func_t cancel_func, 1567251881Speter void *cancel_baton, 1568251881Speter svn_wc_notify_func2_t notify_func, 1569251881Speter void *notify_baton, 1570251881Speter apr_pool_t *scratch_pool); 1571251881Speter 1572251881Speter 1573251881Speter/* Mark all LOCAL_ABSPATH in the TARGETS array, and all of their children, 1574251881Speter * for deletion. 1575251881Speter * 1576251881Speter * This function is more efficient than svn_wc__db_op_delete() because 1577251881Speter * only one sqlite transaction is used for all targets. 1578251881Speter * It currently lacks support for moves (though this could be changed, 1579251881Speter * at which point svn_wc__db_op_delete() becomes redundant). 1580251881Speter * 1581251881Speter * This function removes the file externals (and if DELETE_DIR_EXTERNALS is 1582251881Speter * TRUE also the directory externals) registered below the targets. 1583251881Speter * (DELETE_DIR_EXTERNALS should be true if also removing unversioned nodes) 1584251881Speter * 1585251881Speter * If NOTIFY_FUNC is not NULL, then it will be called (with NOTIFY_BATON) 1586251881Speter * for each node deleted. While this processing occurs, if CANCEL_FUNC is 1587251881Speter * not NULL, then it will be called (with CANCEL_BATON) to detect cancellation 1588251881Speter * during the processing. 1589251881Speter * 1590251881Speter * Note: the notification (and cancellation) occur outside of a SQLite 1591251881Speter * transaction. 1592251881Speter */ 1593251881Spetersvn_error_t * 1594251881Spetersvn_wc__db_op_delete_many(svn_wc__db_t *db, 1595251881Speter apr_array_header_t *targets, 1596251881Speter svn_boolean_t delete_dir_externals, 1597251881Speter const svn_skel_t *conflict, 1598251881Speter svn_cancel_func_t cancel_func, 1599251881Speter void *cancel_baton, 1600251881Speter svn_wc_notify_func2_t notify_func, 1601251881Speter void *notify_baton, 1602251881Speter apr_pool_t *scratch_pool); 1603251881Speter 1604251881Speter 1605251881Speter/* ### mark PATH as (possibly) modified. "svn edit" ... right API here? */ 1606251881Spetersvn_error_t * 1607251881Spetersvn_wc__db_op_modified(svn_wc__db_t *db, 1608251881Speter const char *local_abspath, 1609251881Speter apr_pool_t *scratch_pool); 1610251881Speter 1611251881Speter 1612251881Speter/* ### use NULL to remove from a changelist. 1613251881Speter 1614251881Speter ### NOTE: only depth=svn_depth_empty is supported right now. 1615251881Speter */ 1616251881Spetersvn_error_t * 1617251881Spetersvn_wc__db_op_set_changelist(svn_wc__db_t *db, 1618251881Speter const char *local_abspath, 1619251881Speter const char *new_changelist, 1620251881Speter const apr_array_header_t *changelist_filter, 1621251881Speter svn_depth_t depth, 1622251881Speter /* ### flip to CANCEL, then NOTIFY. precedent. */ 1623251881Speter svn_wc_notify_func2_t notify_func, 1624251881Speter void *notify_baton, 1625251881Speter svn_cancel_func_t cancel_func, 1626251881Speter void *cancel_baton, 1627251881Speter apr_pool_t *scratch_pool); 1628251881Speter 1629251881Speter/* Record CONFLICT on LOCAL_ABSPATH, potentially replacing other conflicts 1630251881Speter recorded on LOCAL_ABSPATH. 1631251881Speter 1632251881Speter Users should in most cases pass CONFLICT to another WC_DB call instead of 1633251881Speter calling svn_wc__db_op_mark_conflict() directly outside a transaction, to 1634251881Speter allow recording atomically with the operation involved. 1635251881Speter 1636251881Speter Any work items that are necessary as part of marking this node conflicted 1637251881Speter can be passed in WORK_ITEMS. 1638251881Speter */ 1639251881Spetersvn_error_t * 1640251881Spetersvn_wc__db_op_mark_conflict(svn_wc__db_t *db, 1641251881Speter const char *local_abspath, 1642251881Speter const svn_skel_t *conflict, 1643251881Speter const svn_skel_t *work_items, 1644251881Speter apr_pool_t *scratch_pool); 1645251881Speter 1646251881Speter 1647362181Sdim/* Clear all or some of the conflicts stored on LOCAL_ABSPATH, if any. 1648362181Sdim 1649362181Sdim Any work items that are necessary as part of resolving this node 1650362181Sdim can be passed in WORK_ITEMS. 1651362181Sdim 1652362181Sdim### caller maintains ACTUAL, and how the resolution occurred. we're just 1653251881Speter ### recording state. 1654251881Speter ### 1655251881Speter ### I'm not sure that these three values are the best way to do this, 1656251881Speter ### but they're handy for now. */ 1657251881Spetersvn_error_t * 1658251881Spetersvn_wc__db_op_mark_resolved(svn_wc__db_t *db, 1659251881Speter const char *local_abspath, 1660251881Speter svn_boolean_t resolved_text, 1661251881Speter svn_boolean_t resolved_props, 1662251881Speter svn_boolean_t resolved_tree, 1663251881Speter const svn_skel_t *work_items, 1664251881Speter apr_pool_t *scratch_pool); 1665251881Speter 1666251881Speter 1667251881Speter/* Revert all local changes which are being maintained in the database, 1668251881Speter * including conflict storage, properties and text modification status. 1669251881Speter * 1670251881Speter * Returns SVN_ERR_WC_INVALID_OPERATION_DEPTH if the revert is not 1671251881Speter * possible, e.g. copy/delete but not a root, or a copy root with 1672251881Speter * children. 1673251881Speter * 1674251881Speter * At present only depth=empty and depth=infinity are supported. 1675251881Speter * 1676289180Speter * If @a clear_changelists is FALSE then changelist information is kept, 1677289180Speter * otherwise it is cleared. 1678289180Speter * 1679251881Speter * This function populates the revert list that can be queried to 1680251881Speter * determine what was reverted. 1681251881Speter */ 1682251881Spetersvn_error_t * 1683251881Spetersvn_wc__db_op_revert(svn_wc__db_t *db, 1684251881Speter const char *local_abspath, 1685251881Speter svn_depth_t depth, 1686289180Speter svn_boolean_t clear_changelists, 1687251881Speter apr_pool_t *result_pool, 1688251881Speter apr_pool_t *scratch_pool); 1689251881Speter 1690251881Speter/* Query the revert list for LOCAL_ABSPATH and set *REVERTED if the 1691251881Speter * path was reverted. Set *MARKER_FILES to a const char *list of 1692251881Speter * marker files if any were recorded on LOCAL_ABSPATH. 1693251881Speter * 1694251881Speter * Set *COPIED_HERE if the reverted node was copied here and is the 1695251881Speter * operation root of the copy. 1696251881Speter * Set *KIND to the node kind of the reverted node. 1697251881Speter * 1698251881Speter * Removes the row for LOCAL_ABSPATH from the revert list. 1699251881Speter */ 1700251881Spetersvn_error_t * 1701251881Spetersvn_wc__db_revert_list_read(svn_boolean_t *reverted, 1702251881Speter const apr_array_header_t **marker_files, 1703251881Speter svn_boolean_t *copied_here, 1704251881Speter svn_node_kind_t *kind, 1705251881Speter svn_wc__db_t *db, 1706251881Speter const char *local_abspath, 1707251881Speter apr_pool_t *result_pool, 1708251881Speter apr_pool_t *scratch_pool); 1709251881Speter 1710251881Speter/* The type of elements in the array returned by 1711251881Speter * svn_wc__db_revert_list_read_copied_children(). */ 1712251881Spetertypedef struct svn_wc__db_revert_list_copied_child_info_t { 1713251881Speter const char *abspath; 1714251881Speter svn_node_kind_t kind; 1715251881Speter} svn_wc__db_revert_list_copied_child_info_t ; 1716251881Speter 1717251881Speter/* Return in *CHILDREN a list of reverted copied nodes at or within 1718251881Speter * LOCAL_ABSPATH (which is a reverted file or a reverted directory). 1719251881Speter * Allocate *COPIED_CHILDREN and its elements in RESULT_POOL. 1720251881Speter * The elements are of type svn_wc__db_revert_list_copied_child_info_t. */ 1721251881Spetersvn_error_t * 1722289180Spetersvn_wc__db_revert_list_read_copied_children(apr_array_header_t **children, 1723251881Speter svn_wc__db_t *db, 1724251881Speter const char *local_abspath, 1725251881Speter apr_pool_t *result_pool, 1726251881Speter apr_pool_t *scratch_pool); 1727251881Speter 1728251881Speter 1729251881Speter/* Make revert notifications for all paths in the revert list that are 1730251881Speter * equal to LOCAL_ABSPATH or below LOCAL_ABSPATH. 1731251881Speter * 1732251881Speter * Removes all the corresponding rows from the revert list. 1733251881Speter * 1734251881Speter * ### Pass in cancel_func? 1735251881Speter */ 1736251881Spetersvn_error_t * 1737251881Spetersvn_wc__db_revert_list_notify(svn_wc_notify_func2_t notify_func, 1738251881Speter void *notify_baton, 1739251881Speter svn_wc__db_t *db, 1740251881Speter const char *local_abspath, 1741251881Speter apr_pool_t *scratch_pool); 1742251881Speter 1743251881Speter/* Clean up after svn_wc__db_op_revert by removing the revert list. 1744251881Speter */ 1745251881Spetersvn_error_t * 1746251881Spetersvn_wc__db_revert_list_done(svn_wc__db_t *db, 1747251881Speter const char *local_abspath, 1748251881Speter apr_pool_t *scratch_pool); 1749251881Speter 1750251881Speter/* ### status */ 1751251881Speter 1752251881Speter 1753251881Speter/* @} */ 1754251881Speter 1755251881Speter/* @defgroup svn_wc__db_read Read operations on the BASE/WORKING tree 1756251881Speter @{ 1757251881Speter 1758251881Speter These functions query information about nodes in ACTUAL, and returns 1759251881Speter the requested information from the appropriate ACTUAL, WORKING, or 1760251881Speter BASE tree. 1761251881Speter 1762251881Speter For example, asking for the checksum of the pristine version will 1763251881Speter return the one recorded in WORKING, or if no WORKING node exists, then 1764251881Speter the checksum comes from BASE. 1765251881Speter*/ 1766251881Speter 1767251881Speter/* Retrieve information about a node. 1768251881Speter 1769251881Speter For the node implied by LOCAL_ABSPATH from the local filesystem, return 1770251881Speter information in the provided OUT parameters. Each OUT parameter may be 1771251881Speter NULL, indicating that specific item is not requested. 1772251881Speter 1773251881Speter The information returned comes from the BASE tree, as possibly modified 1774251881Speter by the WORKING and ACTUAL trees. 1775251881Speter 1776251881Speter If there is no information about the node, then SVN_ERR_WC_PATH_NOT_FOUND 1777251881Speter will be returned. 1778251881Speter 1779251881Speter The OUT parameters, and their "not available" values are: 1780251881Speter STATUS n/a (always available) 1781251881Speter KIND svn_node_unknown (For ACTUAL only nodes) 1782251881Speter REVISION SVN_INVALID_REVNUM 1783251881Speter REPOS_RELPATH NULL 1784251881Speter REPOS_ROOT_URL NULL 1785251881Speter REPOS_UUID NULL 1786251881Speter CHANGED_REV SVN_INVALID_REVNUM 1787251881Speter CHANGED_DATE 0 1788251881Speter CHANGED_AUTHOR NULL 1789251881Speter DEPTH svn_depth_unknown 1790251881Speter CHECKSUM NULL 1791251881Speter TARGET NULL 1792251881Speter 1793251881Speter ORIGINAL_REPOS_RELPATH NULL 1794251881Speter ORIGINAL_ROOT_URL NULL 1795251881Speter ORIGINAL_UUID NULL 1796251881Speter ORIGINAL_REVISION SVN_INVALID_REVNUM 1797251881Speter 1798251881Speter LOCK NULL 1799251881Speter 1800251881Speter RECORDED_SIZE SVN_INVALID_FILESIZE 1801251881Speter RECORDED_TIME 0 1802251881Speter 1803251881Speter CHANGELIST NULL 1804251881Speter CONFLICTED FALSE 1805251881Speter 1806251881Speter OP_ROOT FALSE 1807251881Speter HAD_PROPS FALSE 1808251881Speter PROPS_MOD FALSE 1809251881Speter 1810251881Speter HAVE_BASE FALSE 1811251881Speter HAVE_MORE_WORK FALSE 1812251881Speter HAVE_WORK FALSE 1813251881Speter 1814251881Speter When STATUS is requested, then it will be one of these values: 1815251881Speter 1816251881Speter svn_wc__db_status_normal 1817251881Speter A plain BASE node, with no local changes. 1818251881Speter 1819251881Speter svn_wc__db_status_added 1820251881Speter A node has been added/copied/moved to here. See HAVE_BASE to see 1821251881Speter if this change overwrites a BASE node. Use scan_addition() to resolve 1822251881Speter whether this has been added, copied, or moved, and the details of the 1823251881Speter operation (this function only looks at LOCAL_ABSPATH, but resolving 1824251881Speter the details requires scanning one or more ancestor nodes). 1825251881Speter 1826251881Speter svn_wc__db_status_deleted 1827251881Speter This node has been deleted or moved away. It may be a delete/move of 1828251881Speter a BASE node, or a child node of a subtree that was copied/moved to 1829251881Speter an ancestor location. Call scan_deletion() to determine the full 1830251881Speter details of the operations upon this node. 1831251881Speter 1832251881Speter svn_wc__db_status_server_excluded 1833251881Speter The node is versioned/known by the server, but the server has 1834251881Speter decided not to provide further information about the node. This 1835251881Speter is a BASE node (since changes are not allowed to this node). 1836251881Speter 1837251881Speter svn_wc__db_status_excluded 1838251881Speter The node has been excluded from the working copy tree. This may 1839251881Speter be an exclusion from the BASE tree, or an exclusion in the 1840251881Speter WORKING tree for a child node of a copied/moved parent. 1841251881Speter 1842251881Speter svn_wc__db_status_not_present 1843251881Speter This is a node from the BASE tree, has been marked as "not-present" 1844251881Speter within this mixed-revision working copy. This node is at a revision 1845251881Speter that is not in the tree, contrary to its inclusion in the parent 1846251881Speter node's revision. 1847251881Speter 1848251881Speter svn_wc__db_status_incomplete 1849251881Speter The BASE is incomplete due to an interrupted operation. An 1850251881Speter incomplete WORKING node will be svn_wc__db_status_added. 1851251881Speter 1852251881Speter If REVISION is requested, it will be set to the revision of the 1853251881Speter unmodified (BASE) node, or to SVN_INVALID_REVNUM if any structural 1854251881Speter changes have been made to that node (that is, if the node has a row in 1855251881Speter the WORKING table). 1856251881Speter 1857251881Speter If DEPTH is requested, and the node is NOT a directory, then 1858251881Speter the value will be set to svn_depth_unknown. 1859251881Speter 1860251881Speter If CHECKSUM is requested, and the node is NOT a file, then it will 1861251881Speter be set to NULL. 1862251881Speter 1863251881Speter If TARGET is requested, and the node is NOT a symlink, then it will 1864251881Speter be set to NULL. 1865251881Speter 1866251881Speter If TRANSLATED_SIZE is requested, and the node is NOT a file, then 1867251881Speter it will be set to SVN_INVALID_FILESIZE. 1868251881Speter 1869251881Speter If HAVE_WORK is TRUE, the returned information is from the highest WORKING 1870251881Speter layer. In that case HAVE_MORE_WORK and HAVE_BASE provide information about 1871251881Speter what other layers exist for this node. 1872251881Speter 1873251881Speter If HAVE_WORK is FALSE and HAVE_BASE is TRUE then the information is from 1874251881Speter the BASE tree. 1875251881Speter 1876251881Speter If HAVE_WORK and HAVE_BASE are both FALSE and when retrieving CONFLICTED, 1877251881Speter then the node doesn't exist at all. 1878251881Speter 1879251881Speter If OP_ROOT is requested and the node has a WORKING layer, OP_ROOT will be 1880251881Speter set to true if this node is the op_root for this layer. 1881251881Speter 1882251881Speter If HAD_PROPS is requested and the node has pristine props, the value will 1883251881Speter be set to TRUE. 1884251881Speter 1885251881Speter If PROPS_MOD is requested and the node has property modification the value 1886251881Speter will be set to TRUE. 1887251881Speter 1888251881Speter ### add information about the need to scan upwards to get a complete 1889251881Speter ### picture of the state of this node. 1890251881Speter 1891251881Speter ### add some documentation about OUT parameter values based on STATUS ?? 1892251881Speter 1893251881Speter ### the TEXT_MOD may become an enumerated value at some point to 1894251881Speter ### indicate different states of knowledge about text modifications. 1895251881Speter ### for example, an "svn edit" command in the future might set a 1896251881Speter ### flag indicating administratively-defined modification. and/or we 1897251881Speter ### might have a status indicating that we saw it was modified while 1898251881Speter ### performing a filesystem traversal. 1899251881Speter 1900251881Speter All returned data will be allocated in RESULT_POOL. All temporary 1901251881Speter allocations will be made in SCRATCH_POOL. 1902251881Speter*/ 1903251881Speter/* ### old docco. needs to be incorporated as appropriate. there is 1904251881Speter ### some pending, potential changes to the definition of this API, 1905251881Speter ### so not worrying about it just yet. 1906251881Speter 1907251881Speter ### if the node has not been committed (after adding): 1908251881Speter ### revision will be SVN_INVALID_REVNUM 1909251881Speter ### repos_* will be NULL 1910251881Speter ### changed_rev will be SVN_INVALID_REVNUM 1911251881Speter ### changed_date will be 0 1912251881Speter ### changed_author will be NULL 1913251881Speter ### status will be svn_wc__db_status_added 1914251881Speter ### text_mod will be TRUE 1915251881Speter ### prop_mod will be TRUE if any props have been set 1916251881Speter ### base_shadowed will be FALSE 1917251881Speter 1918251881Speter ### if the node is not a copy, or a move destination: 1919251881Speter ### original_repos_path will be NULL 1920251881Speter ### original_root_url will be NULL 1921251881Speter ### original_uuid will be NULL 1922251881Speter ### original_revision will be SVN_INVALID_REVNUM 1923251881Speter 1924251881Speter ### note that @a base_shadowed can be derived. if the status specifies 1925251881Speter ### an add/copy/move *and* there is a corresponding node in BASE, then 1926251881Speter ### the BASE has been deleted to open the way for this node. 1927251881Speter*/ 1928251881Spetersvn_error_t * 1929251881Spetersvn_wc__db_read_info(svn_wc__db_status_t *status, /* ### derived */ 1930251881Speter svn_node_kind_t *kind, 1931251881Speter svn_revnum_t *revision, 1932251881Speter const char **repos_relpath, 1933251881Speter const char **repos_root_url, 1934251881Speter const char **repos_uuid, 1935251881Speter svn_revnum_t *changed_rev, 1936251881Speter apr_time_t *changed_date, 1937251881Speter const char **changed_author, 1938251881Speter svn_depth_t *depth, /* dirs only */ 1939251881Speter const svn_checksum_t **checksum, /* files only */ 1940251881Speter const char **target, /* symlinks only */ 1941251881Speter 1942251881Speter /* ### the following fields if copied/moved (history) */ 1943251881Speter const char **original_repos_relpath, 1944251881Speter const char **original_root_url, 1945251881Speter const char **original_uuid, 1946251881Speter svn_revnum_t *original_revision, 1947251881Speter 1948251881Speter /* For BASE nodes */ 1949251881Speter svn_wc__db_lock_t **lock, 1950251881Speter 1951251881Speter /* Recorded for files present in the working copy */ 1952251881Speter svn_filesize_t *recorded_size, 1953251881Speter apr_time_t *recorded_time, 1954251881Speter 1955251881Speter /* From ACTUAL */ 1956251881Speter const char **changelist, 1957251881Speter svn_boolean_t *conflicted, 1958251881Speter 1959251881Speter /* ### the followed are derived fields */ 1960251881Speter svn_boolean_t *op_root, 1961251881Speter 1962251881Speter svn_boolean_t *had_props, 1963251881Speter svn_boolean_t *props_mod, 1964251881Speter 1965251881Speter svn_boolean_t *have_base, 1966251881Speter svn_boolean_t *have_more_work, 1967251881Speter svn_boolean_t *have_work, 1968251881Speter 1969251881Speter svn_wc__db_t *db, 1970251881Speter const char *local_abspath, 1971251881Speter apr_pool_t *result_pool, 1972251881Speter apr_pool_t *scratch_pool); 1973251881Speter 1974266731Speter/* Structure used as linked list in svn_wc__db_info_t to describe all nodes 1975266731Speter in this location that were moved to another location */ 1976266731Speterstruct svn_wc__db_moved_to_info_t 1977266731Speter{ 1978266731Speter const char *moved_to_abspath; 1979266731Speter const char *shadow_op_root_abspath; 1980266731Speter 1981266731Speter struct svn_wc__db_moved_to_info_t *next; 1982266731Speter}; 1983266731Speter 1984251881Speter/* Structure returned by svn_wc__db_read_children_info. Only has the 1985251881Speter fields needed by status. */ 1986251881Speterstruct svn_wc__db_info_t { 1987251881Speter svn_wc__db_status_t status; 1988251881Speter svn_node_kind_t kind; 1989251881Speter svn_revnum_t revnum; 1990251881Speter const char *repos_relpath; 1991251881Speter const char *repos_root_url; 1992251881Speter const char *repos_uuid; 1993251881Speter svn_revnum_t changed_rev; 1994251881Speter const char *changed_author; 1995251881Speter apr_time_t changed_date; 1996251881Speter svn_depth_t depth; 1997251881Speter 1998251881Speter svn_filesize_t recorded_size; 1999251881Speter apr_time_t recorded_time; 2000251881Speter 2001251881Speter const char *changelist; 2002251881Speter svn_boolean_t conflicted; 2003251881Speter#ifdef HAVE_SYMLINK 2004251881Speter svn_boolean_t special; 2005251881Speter#endif 2006251881Speter svn_boolean_t op_root; 2007251881Speter 2008251881Speter svn_boolean_t has_checksum; 2009251881Speter svn_boolean_t copied; 2010251881Speter svn_boolean_t had_props; 2011251881Speter svn_boolean_t props_mod; 2012251881Speter 2013251881Speter svn_boolean_t have_base; 2014251881Speter svn_boolean_t have_more_work; 2015251881Speter 2016251881Speter svn_boolean_t locked; /* WC directory lock */ 2017251881Speter svn_wc__db_lock_t *lock; /* Repository file lock */ 2018251881Speter svn_boolean_t incomplete; /* TRUE if a working node is incomplete */ 2019251881Speter 2020266731Speter struct svn_wc__db_moved_to_info_t *moved_to; /* A linked list of locations 2021266731Speter where nodes at this path 2022266731Speter are moved to. Highest layers 2023266731Speter first */ 2024251881Speter svn_boolean_t moved_here; /* Only on op-roots. */ 2025251881Speter 2026251881Speter svn_boolean_t file_external; 2027289180Speter svn_boolean_t has_descendants; /* Is dir, or has tc descendants */ 2028251881Speter}; 2029251881Speter 2030251881Speter/* Return in *NODES a hash mapping name->struct svn_wc__db_info_t for 2031251881Speter the children of DIR_ABSPATH, and in *CONFLICTS a hash of names in 2032251881Speter conflict. 2033251881Speter 2034251881Speter The results include any path that was a child of a deleted directory that 2035251881Speter existed at LOCAL_ABSPATH, even if that directory is now scheduled to be 2036251881Speter replaced by the working node at LOCAL_ABSPATH. 2037289180Speter 2038289180Speter If BASE_TREE_ONLY is set, only information about the BASE tree 2039289180Speter is returned. 2040251881Speter */ 2041251881Spetersvn_error_t * 2042251881Spetersvn_wc__db_read_children_info(apr_hash_t **nodes, 2043251881Speter apr_hash_t **conflicts, 2044251881Speter svn_wc__db_t *db, 2045251881Speter const char *dir_abspath, 2046289180Speter svn_boolean_t base_tree_only, 2047251881Speter apr_pool_t *result_pool, 2048251881Speter apr_pool_t *scratch_pool); 2049251881Speter 2050266731Speter/* Like svn_wc__db_read_children_info, but only gets an info node for the root 2051289180Speter element. 2052289180Speter 2053289180Speter If BASE_TREE_ONLY is set, only information about the BASE tree 2054289180Speter is returned. */ 2055266731Spetersvn_error_t * 2056266731Spetersvn_wc__db_read_single_info(const struct svn_wc__db_info_t **info, 2057266731Speter svn_wc__db_t *db, 2058266731Speter const char *local_abspath, 2059289180Speter svn_boolean_t base_tree_only, 2060266731Speter apr_pool_t *result_pool, 2061266731Speter apr_pool_t *scratch_pool); 2062251881Speter 2063251881Speter/* Structure returned by svn_wc__db_read_walker_info. Only has the 2064251881Speter fields needed by svn_wc__internal_walk_children(). */ 2065251881Speterstruct svn_wc__db_walker_info_t { 2066289180Speter const char *name; 2067251881Speter svn_wc__db_status_t status; 2068251881Speter svn_node_kind_t kind; 2069251881Speter}; 2070251881Speter 2071251881Speter/* When a node is deleted in WORKING, some of its information is no longer 2072251881Speter available. But in some cases it might still be relevant to obtain this 2073251881Speter information even when the information isn't stored in the BASE tree. 2074251881Speter 2075251881Speter This function allows access to that specific information. 2076251881Speter 2077251881Speter When a node is not deleted, this node returns the same information 2078251881Speter as svn_wc__db_read_info(). 2079251881Speter 2080251881Speter All output arguments are optional and behave in the same way as when 2081251881Speter calling svn_wc__db_read_info(). 2082251881Speter 2083251881Speter (All other information (like original_*) can be obtained via other apis). 2084251881Speter 2085251881Speter *PROPS maps "const char *" names to "const svn_string_t *" values. If 2086251881Speter the pristine node is capable of having properties but has none, set 2087251881Speter *PROPS to an empty hash. If its status is such that it cannot have 2088251881Speter properties, set *PROPS to NULL. 2089251881Speter */ 2090251881Spetersvn_error_t * 2091251881Spetersvn_wc__db_read_pristine_info(svn_wc__db_status_t *status, 2092251881Speter svn_node_kind_t *kind, 2093251881Speter svn_revnum_t *changed_rev, 2094251881Speter apr_time_t *changed_date, 2095251881Speter const char **changed_author, 2096251881Speter svn_depth_t *depth, /* dirs only */ 2097251881Speter const svn_checksum_t **checksum, /* files only */ 2098251881Speter const char **target, /* symlinks only */ 2099251881Speter svn_boolean_t *had_props, 2100251881Speter apr_hash_t **props, 2101251881Speter svn_wc__db_t *db, 2102251881Speter const char *local_abspath, 2103251881Speter apr_pool_t *result_pool, 2104251881Speter apr_pool_t *scratch_pool); 2105251881Speter 2106251881Speter/* Gets the information required to install a pristine file to the working copy 2107251881Speter 2108251881Speter Set WCROOT_ABSPATH to the working copy root, SHA1_CHECKSUM to the 2109251881Speter checksum of the node (a valid reference into the pristine store) 2110251881Speter and PRISTINE_PROPS to the node's pristine properties (to use for 2111251881Speter installing the file). 2112251881Speter 2113251881Speter If WRI_ABSPATH is not NULL, check for information in the working copy 2114251881Speter identified by WRI_ABSPATH. 2115251881Speter */ 2116251881Spetersvn_error_t * 2117251881Spetersvn_wc__db_read_node_install_info(const char **wcroot_abspath, 2118251881Speter const svn_checksum_t **sha1_checksum, 2119251881Speter apr_hash_t **pristine_props, 2120251881Speter apr_time_t *changed_date, 2121251881Speter svn_wc__db_t *db, 2122251881Speter const char *local_abspath, 2123251881Speter const char *wri_abspath, 2124251881Speter apr_pool_t *result_pool, 2125251881Speter apr_pool_t *scratch_pool); 2126251881Speter 2127289180Speter/* Return in *ITEMS an array of struct svn_wc__db_walker_info_t* for 2128289180Speter the direct children of DIR_ABSPATH. */ 2129251881Spetersvn_error_t * 2130289180Spetersvn_wc__db_read_children_walker_info(const apr_array_header_t **items, 2131251881Speter svn_wc__db_t *db, 2132251881Speter const char *dir_abspath, 2133251881Speter apr_pool_t *result_pool, 2134251881Speter apr_pool_t *scratch_pool); 2135251881Speter 2136251881Speter 2137251881Speter/** 2138289180Speter * Set *revision, *repos_relpath, *repos_root_url, *repos_uuid to 2139289180Speter * the intended/commit location of LOCAL_ABSPATH. These arguments may be 2140289180Speter * NULL if they are not needed. 2141289180Speter * 2142289180Speter * If the node is deleted, return the url it would have in the repository 2143289180Speter * if it wouldn't be deleted. If the node is added return the url it will 2144289180Speter * have in the repository, once committed. 2145289180Speter * 2146289180Speter * If the node is not added and has an existing repository location, set 2147289180Speter * revision to its existing revision, otherwise to SVN_INVALID_REVNUM. 2148251881Speter */ 2149251881Spetersvn_error_t * 2150289180Spetersvn_wc__db_read_repos_info(svn_revnum_t *revision, 2151289180Speter const char **repos_relpath, 2152289180Speter const char **repos_root_url, 2153289180Speter const char **repos_uuid, 2154289180Speter svn_wc__db_t *db, 2155289180Speter const char *local_abspath, 2156289180Speter apr_pool_t *result_pool, 2157289180Speter apr_pool_t *scratch_pool); 2158251881Speter 2159251881Speter 2160251881Speter/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the ACTUAL 2161251881Speter tree (looking through to the WORKING or BASE tree as required). 2162251881Speter 2163251881Speter ### *PROPS will be set to NULL in the following situations: 2164251881Speter ### ... tbd 2165251881Speter 2166251881Speter PROPS maps "const char *" names to "const svn_string_t *" values. 2167251881Speter If the node has no properties, set *PROPS to an empty hash. 2168251881Speter If the node is not present, return an error. 2169251881Speter Allocate *PROPS and its keys and values in RESULT_POOL. 2170251881Speter*/ 2171251881Spetersvn_error_t * 2172251881Spetersvn_wc__db_read_props(apr_hash_t **props, 2173251881Speter svn_wc__db_t *db, 2174251881Speter const char *local_abspath, 2175251881Speter apr_pool_t *result_pool, 2176251881Speter apr_pool_t *scratch_pool); 2177251881Speter 2178251881Speter/* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and 2179251881Speter * a hash table mapping <tt>char *</tt> names onto svn_string_t * 2180251881Speter * values for any properties of child nodes of LOCAL_ABSPATH (up to DEPTH). 2181251881Speter * 2182251881Speter * If PRISTINE is FALSE, read the properties from the WORKING layer (highest 2183251881Speter * op_depth); if PRISTINE is FALSE, local modifications will be visible. 2184251881Speter */ 2185251881Spetersvn_error_t * 2186251881Spetersvn_wc__db_read_props_streamily(svn_wc__db_t *db, 2187251881Speter const char *local_abspath, 2188251881Speter svn_depth_t depth, 2189251881Speter svn_boolean_t pristine, 2190251881Speter const apr_array_header_t *changelists, 2191251881Speter svn_wc__proplist_receiver_t receiver_func, 2192251881Speter void *receiver_baton, 2193251881Speter svn_cancel_func_t cancel_func, 2194251881Speter void *cancel_baton, 2195251881Speter apr_pool_t *scratch_pool); 2196251881Speter 2197251881Speter 2198289180Speter/* Set *PROPS to the base properties of the node at LOCAL_ABSPATH. 2199251881Speter 2200251881Speter *PROPS maps "const char *" names to "const svn_string_t *" values. 2201251881Speter If the node has no properties, set *PROPS to an empty hash. 2202289180Speter If the base node is in a state that cannot have properties (such as 2203289180Speter not-present or locally added without copy-from), return an error. 2204289180Speter 2205251881Speter Allocate *PROPS and its keys and values in RESULT_POOL. 2206289180Speter 2207289180Speter See also svn_wc_get_pristine_props(). 2208251881Speter*/ 2209251881Spetersvn_error_t * 2210251881Spetersvn_wc__db_read_pristine_props(apr_hash_t **props, 2211251881Speter svn_wc__db_t *db, 2212251881Speter const char *local_abspath, 2213251881Speter apr_pool_t *result_pool, 2214251881Speter apr_pool_t *scratch_pool); 2215251881Speter 2216251881Speter 2217251881Speter/** 2218251881Speter * Set @a *iprops to a depth-first ordered array of 2219251881Speter * #svn_prop_inherited_item_t * structures representing the properties 2220251881Speter * inherited by @a local_abspath from the ACTUAL tree above 2221251881Speter * @a local_abspath (looking through to the WORKING or BASE tree as 2222251881Speter * required), up to and including the root of the working copy and 2223251881Speter * any cached inherited properties inherited by the root. 2224251881Speter * 2225251881Speter * The #svn_prop_inherited_item_t->path_or_url members of the 2226251881Speter * #svn_prop_inherited_item_t * structures in @a *iprops are 2227251881Speter * paths relative to the repository root URL for cached inherited 2228251881Speter * properties and absolute working copy paths otherwise. 2229251881Speter * 2230289180Speter * If ACTUAL_PROPS is not NULL, then set *ACTUAL_PROPS to ALL the actual 2231251881Speter * properties stored on LOCAL_ABSPATH. 2232251881Speter * 2233251881Speter * Allocate @a *iprops in @a result_pool. Use @a scratch_pool 2234251881Speter * for temporary allocations. 2235251881Speter */ 2236251881Spetersvn_error_t * 2237251881Spetersvn_wc__db_read_inherited_props(apr_array_header_t **iprops, 2238251881Speter apr_hash_t **actual_props, 2239251881Speter svn_wc__db_t *db, 2240251881Speter const char *local_abspath, 2241251881Speter const char *propname, 2242251881Speter apr_pool_t *result_pool, 2243251881Speter apr_pool_t *scratch_pool); 2244251881Speter 2245251881Speter/* Read a BASE node's inherited property information. 2246251881Speter 2247251881Speter Set *IPROPS to to a depth-first ordered array of 2248251881Speter svn_prop_inherited_item_t * structures representing the cached 2249251881Speter inherited properties for the BASE node at LOCAL_ABSPATH. 2250251881Speter 2251251881Speter If no cached properties are found, then set *IPROPS to NULL. 2252251881Speter If LOCAL_ABSPATH represents the root of the repository, then set 2253251881Speter *IPROPS to an empty array. 2254251881Speter 2255251881Speter Allocate *IPROPS in RESULT_POOL, use SCRATCH_POOL for temporary 2256251881Speter allocations. */ 2257251881Spetersvn_error_t * 2258251881Spetersvn_wc__db_read_cached_iprops(apr_array_header_t **iprops, 2259251881Speter svn_wc__db_t *db, 2260251881Speter const char *local_abspath, 2261251881Speter apr_pool_t *result_pool, 2262251881Speter apr_pool_t *scratch_pool); 2263251881Speter 2264251881Speter/* Find BASE nodes with cached inherited properties. 2265251881Speter 2266251881Speter Set *IPROPS_PATHS to a hash mapping const char * absolute working copy 2267251881Speter paths to the repos_relpath of the path for each path in the working copy 2268251881Speter at or below LOCAL_ABSPATH, limited by DEPTH, that has cached inherited 2269251881Speter properties for the BASE node of the path. 2270251881Speter 2271251881Speter Allocate *IPROP_PATHS in RESULT_POOL. 2272251881Speter Use SCRATCH_POOL for temporary allocations. */ 2273251881Spetersvn_error_t * 2274251881Spetersvn_wc__db_get_children_with_cached_iprops(apr_hash_t **iprop_paths, 2275251881Speter svn_depth_t depth, 2276251881Speter const char *local_abspath, 2277251881Speter svn_wc__db_t *db, 2278251881Speter apr_pool_t *result_pool, 2279251881Speter apr_pool_t *scratch_pool); 2280251881Speter 2281251881Speter/** Obtain a mapping of const char * local_abspaths to const svn_string_t* 2282251881Speter * property values in *VALUES, of all PROPNAME properties on LOCAL_ABSPATH 2283251881Speter * and its descendants. 2284251881Speter * 2285251881Speter * Allocate the result in RESULT_POOL, and perform temporary allocations in 2286251881Speter * SCRATCH_POOL. 2287251881Speter */ 2288251881Spetersvn_error_t * 2289251881Spetersvn_wc__db_prop_retrieve_recursive(apr_hash_t **values, 2290251881Speter svn_wc__db_t *db, 2291251881Speter const char *local_abspath, 2292251881Speter const char *propname, 2293251881Speter apr_pool_t *result_pool, 2294251881Speter apr_pool_t *scratch_pool); 2295251881Speter 2296251881Speter/* Set *CHILDREN to a new array of the (const char *) basenames of the 2297251881Speter immediate children of the working node at LOCAL_ABSPATH in DB. 2298251881Speter 2299251881Speter Return every path that refers to a child of the working node at 2300251881Speter LOCAL_ABSPATH. Do not include a path just because it was a child of a 2301251881Speter deleted directory that existed at LOCAL_ABSPATH if that directory is now 2302251881Speter scheduled to be replaced by the working node at LOCAL_ABSPATH. 2303251881Speter 2304251881Speter Allocate *CHILDREN in RESULT_POOL and do temporary allocations in 2305251881Speter SCRATCH_POOL. 2306251881Speter 2307251881Speter ### return some basic info for each child? e.g. kind. 2308251881Speter ### maybe the data in _read_get_info should be a structure, and this 2309251881Speter ### can return a struct for each one. 2310251881Speter ### however: _read_get_info can say "not interested", which isn't the 2311251881Speter ### case with a struct. thus, a struct requires fetching and/or 2312251881Speter ### computing all info. 2313251881Speter*/ 2314251881Spetersvn_error_t * 2315251881Spetersvn_wc__db_read_children_of_working_node(const apr_array_header_t **children, 2316251881Speter svn_wc__db_t *db, 2317251881Speter const char *local_abspath, 2318251881Speter apr_pool_t *result_pool, 2319251881Speter apr_pool_t *scratch_pool); 2320251881Speter 2321289180Spetersvn_error_t * 2322289180Spetersvn_wc__db_base_read_not_present_children( 2323289180Speter const apr_array_header_t **children, 2324289180Speter svn_wc__db_t *db, 2325289180Speter const char *local_abspath, 2326289180Speter apr_pool_t *result_pool, 2327289180Speter apr_pool_t *scratch_pool); 2328289180Speter 2329251881Speter/* Like svn_wc__db_read_children_of_working_node(), except also include any 2330251881Speter path that was a child of a deleted directory that existed at 2331251881Speter LOCAL_ABSPATH, even if that directory is now scheduled to be replaced by 2332251881Speter the working node at LOCAL_ABSPATH. 2333251881Speter*/ 2334251881Spetersvn_error_t * 2335251881Spetersvn_wc__db_read_children(const apr_array_header_t **children, 2336251881Speter svn_wc__db_t *db, 2337251881Speter const char *local_abspath, 2338251881Speter apr_pool_t *result_pool, 2339251881Speter apr_pool_t *scratch_pool); 2340251881Speter 2341251881Speter/* Read into *VICTIMS the basenames of the immediate children of 2342251881Speter LOCAL_ABSPATH in DB that are conflicted. 2343251881Speter 2344251881Speter In case of tree conflicts a victim doesn't have to be in the 2345251881Speter working copy. 2346251881Speter 2347251881Speter Allocate *VICTIMS in RESULT_POOL and do temporary allocations in 2348251881Speter SCRATCH_POOL */ 2349251881Speter/* ### This function will probably be removed. */ 2350251881Spetersvn_error_t * 2351251881Spetersvn_wc__db_read_conflict_victims(const apr_array_header_t **victims, 2352251881Speter svn_wc__db_t *db, 2353251881Speter const char *local_abspath, 2354251881Speter apr_pool_t *result_pool, 2355251881Speter apr_pool_t *scratch_pool); 2356251881Speter 2357251881Speter/* Read into *MARKER_FILES the absolute paths of the marker files 2358251881Speter of conflicts stored on LOCAL_ABSPATH and its immediate children in DB. 2359251881Speter The on-disk files may have been deleted by the user. 2360251881Speter 2361251881Speter Allocate *MARKER_FILES in RESULT_POOL and do temporary allocations 2362251881Speter in SCRATCH_POOL */ 2363251881Spetersvn_error_t * 2364251881Spetersvn_wc__db_get_conflict_marker_files(apr_hash_t **markers, 2365251881Speter svn_wc__db_t *db, 2366251881Speter const char *local_abspath, 2367251881Speter apr_pool_t *result_pool, 2368251881Speter apr_pool_t *scratch_pool); 2369251881Speter 2370251881Speter/* Read the conflict information recorded on LOCAL_ABSPATH in *CONFLICT, 2371289180Speter an editable conflict skel. If kind is not NULL, also read the node kind 2372289180Speter in *KIND. (SHOW_HIDDEN: false, SHOW_DELETED: true). If props is not NULL 2373289180Speter read the actual properties in this value if they exist. (Set to NULL in case 2374289180Speter the node is deleted, etc.) 2375251881Speter 2376251881Speter If the node exists, but does not have a conflict set *CONFLICT to NULL, 2377251881Speter otherwise return a SVN_ERR_WC_PATH_NOT_FOUND error. 2378251881Speter 2379251881Speter Allocate *CONFLICTS in RESULT_POOL and do temporary allocations in 2380251881Speter SCRATCH_POOL */ 2381251881Spetersvn_error_t * 2382251881Spetersvn_wc__db_read_conflict(svn_skel_t **conflict, 2383289180Speter svn_node_kind_t *kind, 2384289180Speter apr_hash_t **props, 2385251881Speter svn_wc__db_t *db, 2386251881Speter const char *local_abspath, 2387251881Speter apr_pool_t *result_pool, 2388251881Speter apr_pool_t *scratch_pool); 2389251881Speter 2390251881Speter 2391251881Speter/* Return the kind of the node in DB at LOCAL_ABSPATH. The WORKING tree will 2392251881Speter be examined first, then the BASE tree. If the node is not present in either 2393251881Speter tree and ALLOW_MISSING is TRUE, then svn_node_unknown is returned. 2394251881Speter If the node is missing and ALLOW_MISSING is FALSE, then it will return 2395251881Speter SVN_ERR_WC_PATH_NOT_FOUND. 2396251881Speter 2397251881Speter The SHOW_HIDDEN and SHOW_DELETED flags report certain states as kind none. 2398251881Speter 2399251881Speter When nodes have certain statee they are only reported when: 2400251881Speter svn_wc__db_status_not_present when show_hidden && show_deleted 2401251881Speter 2402251881Speter svn_wc__db_status_excluded when show_hidden 2403251881Speter svn_wc__db_status_server_excluded when show_hidden 2404251881Speter 2405251881Speter svn_wc__db_status_deleted when show_deleted 2406251881Speter 2407251881Speter In other cases these nodes are reported with *KIND as svn_node_none. 2408251881Speter (See also svn_wc_read_kind2()'s documentation) 2409251881Speter 2410251881Speter Uses SCRATCH_POOL for temporary allocations. */ 2411251881Spetersvn_error_t * 2412251881Spetersvn_wc__db_read_kind(svn_node_kind_t *kind, 2413251881Speter svn_wc__db_t *db, 2414251881Speter const char *local_abspath, 2415251881Speter svn_boolean_t allow_missing, 2416251881Speter svn_boolean_t show_deleted, 2417251881Speter svn_boolean_t show_hidden, 2418251881Speter apr_pool_t *scratch_pool); 2419251881Speter 2420251881Speter/* Checks if a node replaces a node in a different layer. Also check if it 2421251881Speter replaces a BASE (op_depth 0) node or just a node in a higher layer (a copy). 2422251881Speter Finally check if this is the root of the replacement, or if the replacement 2423251881Speter is initiated by the parent node. 2424251881Speter 2425251881Speter IS_REPLACE_ROOT (if not NULL) is set to TRUE if the node is the root of a 2426251881Speter replacement; otherwise to FALSE. 2427251881Speter 2428251881Speter BASE_REPLACE (if not NULL) is set to TRUE if the node directly or indirectly 2429251881Speter replaces a node in the BASE tree; otherwise to FALSE. 2430251881Speter 2431251881Speter IS_REPLACE (if not NULL) is set to TRUE if the node directly replaces a node 2432251881Speter in a lower layer; otherwise to FALSE. 2433251881Speter */ 2434251881Spetersvn_error_t * 2435251881Spetersvn_wc__db_node_check_replace(svn_boolean_t *is_replace_root, 2436251881Speter svn_boolean_t *base_replace, 2437251881Speter svn_boolean_t *is_replace, 2438251881Speter svn_wc__db_t *db, 2439251881Speter const char *local_abspath, 2440251881Speter apr_pool_t *scratch_pool); 2441251881Speter 2442251881Speter/* ### changelists. return an array, or an iterator interface? how big 2443251881Speter ### are these things? are we okay with an in-memory array? examine other 2444251881Speter ### changelist usage -- we may already assume the list fits in memory. 2445251881Speter*/ 2446251881Speter 2447251881Speter/* The DB-private version of svn_wc__is_wcroot(), which see. 2448251881Speter */ 2449251881Spetersvn_error_t * 2450251881Spetersvn_wc__db_is_wcroot(svn_boolean_t *is_wcroot, 2451251881Speter svn_wc__db_t *db, 2452251881Speter const char *local_abspath, 2453251881Speter apr_pool_t *scratch_pool); 2454251881Speter 2455251881Speter/* Check whether a node is a working copy root and/or switched. 2456251881Speter 2457251881Speter If LOCAL_ABSPATH is the root of a working copy, set *IS_WC_ROOT to TRUE, 2458251881Speter otherwise to FALSE. 2459251881Speter 2460251881Speter If LOCAL_ABSPATH is switched against its parent in the same working copy 2461251881Speter set *IS_SWITCHED to TRUE, otherwise to FALSE. 2462251881Speter 2463251881Speter If KIND is not null, set *KIND to the node type of LOCAL_ABSPATH. 2464251881Speter 2465251881Speter Any of the output arguments can be null to specify that the result is not 2466251881Speter interesting to the caller. 2467251881Speter 2468251881Speter Use SCRATCH_POOL for temporary allocations. 2469251881Speter */ 2470251881Spetersvn_error_t * 2471251881Spetersvn_wc__db_is_switched(svn_boolean_t *is_wcroot, 2472251881Speter svn_boolean_t *is_switched, 2473251881Speter svn_node_kind_t *kind, 2474251881Speter svn_wc__db_t *db, 2475251881Speter const char *local_abspath, 2476251881Speter apr_pool_t *scratch_pool); 2477251881Speter 2478251881Speter 2479251881Speter/* @} */ 2480251881Speter 2481251881Speter 2482251881Speter/* @defgroup svn_wc__db_global Operations that alter multiple trees 2483251881Speter @{ 2484251881Speter*/ 2485251881Speter 2486251881Speter/* Associate LOCAL_DIR_ABSPATH, and all its children with the repository at 2487251881Speter at REPOS_ROOT_URL. The relative path to the repos root will not change, 2488251881Speter just the repository root. The repos uuid will also remain the same. 2489251881Speter This also updates any locks which may exist for the node, as well as any 2490251881Speter copyfrom repository information. Finally, the DAV cache (aka 2491251881Speter "wcprops") will be reset for affected entries. 2492251881Speter 2493251881Speter Use SCRATCH_POOL for any temporary allocations. 2494251881Speter 2495251881Speter ### local_dir_abspath "should be" the wcroot or a switch root. all URLs 2496251881Speter ### under this directory (depth=infinity) will be rewritten. 2497251881Speter 2498251881Speter ### This API had a depth parameter, which was removed, should it be 2499251881Speter ### resurrected? What's the purpose if we claim relocate is infinitely 2500251881Speter ### recursive? 2501251881Speter 2502251881Speter ### Assuming the future ability to copy across repositories, should we 2503251881Speter ### refrain from resetting the copyfrom information in this operation? 2504251881Speter*/ 2505251881Spetersvn_error_t * 2506251881Spetersvn_wc__db_global_relocate(svn_wc__db_t *db, 2507251881Speter const char *local_dir_abspath, 2508251881Speter const char *repos_root_url, 2509251881Speter apr_pool_t *scratch_pool); 2510251881Speter 2511251881Speter 2512251881Speter/* ### docco 2513251881Speter 2514251881Speter ### collapse the WORKING and ACTUAL tree changes down into BASE, called 2515251881Speter for each committed node. 2516251881Speter 2517251881Speter NEW_REVISION must be the revision number of the revision created by 2518251881Speter the commit. It will become the BASE node's 'revnum' and 'changed_rev' 2519251881Speter values in the BASE_NODE table. 2520251881Speter 2521251881Speter CHANGED_REVISION is the new 'last changed' revision. If the node is 2522251881Speter modified its value is equivalent to NEW_REVISION, but in case of a 2523251881Speter descendant of a copy/move it can be an older revision. 2524251881Speter 2525251881Speter CHANGED_DATE is the (server-side) date of CHANGED_REVISION. It may be 0 if 2526251881Speter the revprop is missing on the revision. 2527251881Speter 2528251881Speter CHANGED_AUTHOR is the (server-side) author of CHANGED_REVISION. It may be 2529251881Speter NULL if the revprop is missing on the revision. 2530251881Speter 2531251881Speter WORK_ITEMS will be place into the work queue. 2532251881Speter*/ 2533251881Spetersvn_error_t * 2534251881Spetersvn_wc__db_global_commit(svn_wc__db_t *db, 2535251881Speter const char *local_abspath, 2536251881Speter svn_revnum_t new_revision, 2537251881Speter svn_revnum_t changed_revision, 2538251881Speter apr_time_t changed_date, 2539251881Speter const char *changed_author, 2540251881Speter const svn_checksum_t *new_checksum, 2541251881Speter apr_hash_t *new_dav_cache, 2542251881Speter svn_boolean_t keep_changelist, 2543251881Speter svn_boolean_t no_unlock, 2544251881Speter const svn_skel_t *work_items, 2545251881Speter apr_pool_t *scratch_pool); 2546251881Speter 2547251881Speter 2548251881Speter/* ### docco 2549251881Speter 2550251881Speter Perform an "update" operation at this node. It will create/modify a BASE 2551251881Speter node, and possibly update the ACTUAL tree's node (e.g put the node into 2552251881Speter a conflicted state). 2553251881Speter 2554251881Speter ### there may be cases where we need to tweak an existing WORKING node 2555251881Speter 2556251881Speter ### this operations on a single node, but may affect children 2557251881Speter 2558251881Speter ### the repository cannot be changed with this function, but a "switch" 2559251881Speter ### (aka changing repos_relpath) is possible 2560251881Speter 2561251881Speter ### one of NEW_CHILDREN, NEW_CHECKSUM, or NEW_TARGET must be provided. 2562251881Speter ### the other two values must be NULL. 2563251881Speter ### should this be broken out into an update_(directory|file|symlink) ? 2564251881Speter 2565251881Speter ### how does this differ from base_add_*? just the CONFLICT param. 2566251881Speter ### the WORK_ITEMS param is new here, but the base_add_* functions 2567251881Speter ### should probably grow that. should we instead just (re)use base_add 2568251881Speter ### rather than grow a new function? 2569251881Speter 2570251881Speter ### this does not allow a change of depth 2571251881Speter 2572251881Speter ### we do not update a file's TRANSLATED_SIZE here. at some future point, 2573251881Speter ### when the file is installed, then a TRANSLATED_SIZE will be set. 2574251881Speter*/ 2575251881Spetersvn_error_t * 2576251881Spetersvn_wc__db_global_update(svn_wc__db_t *db, 2577251881Speter const char *local_abspath, 2578251881Speter svn_node_kind_t new_kind, 2579251881Speter const char *new_repos_relpath, 2580251881Speter svn_revnum_t new_revision, 2581251881Speter const apr_hash_t *new_props, 2582251881Speter svn_revnum_t new_changed_rev, 2583251881Speter apr_time_t new_changed_date, 2584251881Speter const char *new_changed_author, 2585251881Speter const apr_array_header_t *new_children, 2586251881Speter const svn_checksum_t *new_checksum, 2587251881Speter const char *new_target, 2588251881Speter const apr_hash_t *new_dav_cache, 2589251881Speter const svn_skel_t *conflict, 2590251881Speter const svn_skel_t *work_items, 2591251881Speter apr_pool_t *scratch_pool); 2592251881Speter 2593251881Speter 2594251881Speter/* Modify the entry of working copy LOCAL_ABSPATH, presumably after an update 2595251881Speter of depth DEPTH completes. If LOCAL_ABSPATH doesn't exist, this routine 2596251881Speter does nothing. 2597251881Speter 2598251881Speter Set the node's repository relpath, repository root, repository uuid and 2599251881Speter revision to NEW_REPOS_RELPATH, NEW_REPOS_ROOT and NEW_REPOS_UUID. If 2600251881Speter NEW_REPOS_RELPATH is null, the repository location is untouched; if 2601251881Speter NEW_REVISION in invalid, the working revision field is untouched. 2602251881Speter The modifications are mutually exclusive. If NEW_REPOS_ROOT is non-NULL, 2603251881Speter set the repository root of the entry to NEW_REPOS_ROOT. 2604251881Speter 2605251881Speter If LOCAL_ABSPATH is a directory, then, walk entries below LOCAL_ABSPATH 2606251881Speter according to DEPTH thusly: 2607251881Speter 2608251881Speter If DEPTH is svn_depth_infinity, perform the following actions on 2609251881Speter every entry below PATH; if svn_depth_immediates, svn_depth_files, 2610251881Speter or svn_depth_empty, perform them only on LOCAL_ABSPATH. 2611251881Speter 2612251881Speter If NEW_REVISION is valid, then tweak every entry to have this new 2613251881Speter working revision (excluding files that are scheduled for addition 2614251881Speter or replacement). Likewise, if BASE_URL is non-null, then rewrite 2615251881Speter all urls to be "telescoping" children of the base_url. 2616251881Speter 2617251881Speter EXCLUDE_RELPATHS is a hash containing const char *local_relpath. Nodes 2618251881Speter for pathnames contained in EXCLUDE_RELPATHS are not touched by this 2619251881Speter function. These pathnames should be paths relative to the wcroot. 2620251881Speter 2621289180Speter If EMPTY_UPDATE is TRUE then no nodes at or below LOCAL_ABSPATH have been 2622289180Speter affected by the update/switch yet. 2623289180Speter 2624251881Speter If WCROOT_IPROPS is not NULL it is a hash mapping const char * absolute 2625251881Speter working copy paths to depth-first ordered arrays of 2626251881Speter svn_prop_inherited_item_t * structures. If LOCAL_ABSPATH exists in 2627251881Speter WCROOT_IPROPS, then set the hashed value as the node's inherited 2628251881Speter properties. 2629251881Speter*/ 2630251881Spetersvn_error_t * 2631251881Spetersvn_wc__db_op_bump_revisions_post_update(svn_wc__db_t *db, 2632251881Speter const char *local_abspath, 2633251881Speter svn_depth_t depth, 2634251881Speter const char *new_repos_relpath, 2635251881Speter const char *new_repos_root_url, 2636251881Speter const char *new_repos_uuid, 2637251881Speter svn_revnum_t new_revision, 2638251881Speter apr_hash_t *exclude_relpaths, 2639251881Speter apr_hash_t *wcroot_iprops, 2640289180Speter svn_boolean_t empty_update, 2641251881Speter svn_wc_notify_func2_t notify_func, 2642251881Speter void *notify_baton, 2643251881Speter apr_pool_t *scratch_pool); 2644251881Speter 2645251881Speter 2646251881Speter/* Record the RECORDED_SIZE and RECORDED_TIME for a versioned node. 2647251881Speter 2648251881Speter This function will record the information within the WORKING node, 2649251881Speter if present, or within the BASE tree. If neither node is present, then 2650251881Speter SVN_ERR_WC_PATH_NOT_FOUND will be returned. 2651251881Speter 2652251881Speter RECORDED_SIZE may be SVN_INVALID_FILESIZE, which will be recorded 2653251881Speter as such, implying "unknown size". 2654251881Speter 2655251881Speter RECORDED_TIME may be 0, which will be recorded as such, implying 2656251881Speter "unknown last mod time". 2657251881Speter*/ 2658251881Spetersvn_error_t * 2659251881Spetersvn_wc__db_global_record_fileinfo(svn_wc__db_t *db, 2660251881Speter const char *local_abspath, 2661251881Speter svn_filesize_t recorded_size, 2662251881Speter apr_time_t recorded_time, 2663251881Speter apr_pool_t *scratch_pool); 2664251881Speter 2665251881Speter 2666251881Speter/* ### post-commit handling. 2667251881Speter ### maybe multiple phases? 2668251881Speter ### 1) mark a changelist as being-committed 2669251881Speter ### 2) collect ACTUAL content, store for future use as TEXTBASE 2670251881Speter ### 3) caller performs commit 2671251881Speter ### 4) post-commit, integrate changelist into BASE 2672251881Speter*/ 2673251881Speter 2674251881Speter 2675251881Speter/* @} */ 2676251881Speter 2677251881Speter 2678251881Speter/* @defgroup svn_wc__db_lock Function to manage the LOCKS table. 2679251881Speter @{ 2680251881Speter*/ 2681251881Speter 2682251881Speter/* Add or replace LOCK for LOCAL_ABSPATH to DB. */ 2683251881Spetersvn_error_t * 2684251881Spetersvn_wc__db_lock_add(svn_wc__db_t *db, 2685251881Speter const char *local_abspath, 2686251881Speter const svn_wc__db_lock_t *lock, 2687251881Speter apr_pool_t *scratch_pool); 2688251881Speter 2689251881Speter 2690289180Speter/* Remove any lock for LOCAL_ABSPATH in DB and install WORK_ITEMS 2691289180Speter (if not NULL) in DB */ 2692251881Spetersvn_error_t * 2693251881Spetersvn_wc__db_lock_remove(svn_wc__db_t *db, 2694251881Speter const char *local_abspath, 2695289180Speter svn_skel_t *work_items, 2696251881Speter apr_pool_t *scratch_pool); 2697251881Speter 2698251881Speter 2699251881Speter/* @} */ 2700251881Speter 2701251881Speter 2702251881Speter/* @defgroup svn_wc__db_scan Functions to scan up a tree for further data. 2703251881Speter @{ 2704251881Speter*/ 2705251881Speter 2706251881Speter/* Scan upwards for information about a known addition to the WORKING tree. 2707251881Speter 2708251881Speter IFF a node's status as returned by svn_wc__db_read_info() is 2709251881Speter svn_wc__db_status_added (NOT obstructed_add!), then this function 2710251881Speter returns a refined status in *STATUS, which is one of: 2711251881Speter 2712251881Speter svn_wc__db_status_added -- this NODE is a simple add without history. 2713251881Speter OP_ROOT_ABSPATH will be set to the topmost node in the added subtree 2714251881Speter (implying its parent will be an unshadowed BASE node). The REPOS_* 2715251881Speter values will be implied by that ancestor BASE node and this node's 2716251881Speter position in the added subtree. ORIGINAL_* will be set to their 2717251881Speter NULL values (and SVN_INVALID_REVNUM for ORIGINAL_REVISION). 2718251881Speter 2719251881Speter svn_wc__db_status_copied -- this NODE is the root or child of a copy. 2720251881Speter The root of the copy will be stored in OP_ROOT_ABSPATH. Note that 2721251881Speter the parent of the operation root could be another WORKING node (from 2722251881Speter an add, copy, or move). The REPOS_* values will be implied by the 2723251881Speter ancestor unshadowed BASE node. ORIGINAL_* will indicate the source 2724251881Speter of the copy. 2725251881Speter 2726251881Speter svn_wc__db_status_incomplete -- this NODE is copied but incomplete. 2727251881Speter 2728251881Speter svn_wc__db_status_moved_here -- this NODE arrived as a result of a move. 2729251881Speter The root of the moved nodes will be stored in OP_ROOT_ABSPATH. 2730251881Speter Similar to the copied state, its parent may be a WORKING node or a 2731251881Speter BASE node. And again, the REPOS_* values are implied by this node's 2732251881Speter position in the subtree under the ancestor unshadowed BASE node. 2733251881Speter ORIGINAL_* will indicate the source of the move. 2734251881Speter 2735251881Speter All OUT parameters may be NULL to indicate a lack of interest in 2736251881Speter that piece of information. 2737251881Speter 2738251881Speter STATUS, OP_ROOT_ABSPATH, and REPOS_* will always be assigned a value 2739251881Speter if that information is requested (and assuming a successful return). 2740251881Speter 2741251881Speter ORIGINAL_REPOS_RELPATH will refer to the *root* of the operation. It 2742251881Speter does *not* correspond to the node given by LOCAL_ABSPATH. The caller 2743251881Speter can use the suffix on LOCAL_ABSPATH (relative to OP_ROOT_ABSPATH) in 2744251881Speter order to compute the source node which corresponds to LOCAL_ABSPATH. 2745251881Speter 2746251881Speter If the node given by LOCAL_ABSPATH does not have changes recorded in 2747251881Speter the WORKING tree, then SVN_ERR_WC_PATH_NOT_FOUND is returned. If it 2748251881Speter doesn't have an "added" status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS 2749251881Speter will be returned. 2750251881Speter 2751251881Speter All returned data will be allocated in RESULT_POOL. All temporary 2752251881Speter allocations will be made in SCRATCH_POOL. 2753251881Speter*/ 2754251881Spetersvn_error_t * 2755251881Spetersvn_wc__db_scan_addition(svn_wc__db_status_t *status, 2756251881Speter const char **op_root_abspath, 2757251881Speter const char **repos_relpath, 2758251881Speter const char **repos_root_url, 2759251881Speter const char **repos_uuid, 2760251881Speter const char **original_repos_relpath, 2761251881Speter const char **original_root_url, 2762251881Speter const char **original_uuid, 2763251881Speter svn_revnum_t *original_revision, 2764251881Speter svn_wc__db_t *db, 2765251881Speter const char *local_abspath, 2766251881Speter apr_pool_t *result_pool, 2767251881Speter apr_pool_t *scratch_pool); 2768251881Speter 2769251881Speter/* Scan the working copy for move information of the node LOCAL_ABSPATH. 2770289180Speter * If LOCAL_ABSPATH is not moved here return an 2771289180Speter * SVN_ERR_WC_PATH_UNEXPECTED_STATUS error. 2772251881Speter * 2773251881Speter * If not NULL *MOVED_FROM_ABSPATH will be set to the previous location 2774251881Speter * of LOCAL_ABSPATH, before it or an ancestror was moved. 2775251881Speter * 2776251881Speter * If not NULL *OP_ROOT_ABSPATH will be set to the new location of the 2777251881Speter * path that was actually moved 2778251881Speter * 2779251881Speter * If not NULL *OP_ROOT_MOVED_FROM_ABSPATH will be set to the old location 2780251881Speter * of the path that was actually moved. 2781251881Speter * 2782251881Speter * If not NULL *MOVED_FROM_DELETE_ABSPATH will be set to the ancestor of the 2783251881Speter * moved from location that deletes the original location 2784251881Speter * 2785251881Speter * Given a working copy 2786251881Speter * A/B/C 2787251881Speter * svn mv A/B D 2788251881Speter * svn rm A 2789251881Speter * 2790251881Speter * You can call this function on D and D/C. When called on D/C all output 2791251881Speter * MOVED_FROM_ABSPATH will be A/B/C 2792251881Speter * OP_ROOT_ABSPATH will be D 2793251881Speter * OP_ROOT_MOVED_FROM_ABSPATH will be A/B 2794251881Speter * MOVED_FROM_DELETE_ABSPATH will be A 2795251881Speter */ 2796251881Spetersvn_error_t * 2797251881Spetersvn_wc__db_scan_moved(const char **moved_from_abspath, 2798251881Speter const char **op_root_abspath, 2799251881Speter const char **op_root_moved_from_abspath, 2800251881Speter const char **moved_from_delete_abspath, 2801251881Speter svn_wc__db_t *db, 2802251881Speter const char *local_abspath, 2803251881Speter apr_pool_t *result_pool, 2804251881Speter apr_pool_t *scratch_pool); 2805251881Speter 2806251881Speter/* Scan upwards for additional information about a deleted node. 2807251881Speter 2808251881Speter When a deleted node is discovered in the WORKING tree, the situation 2809251881Speter may be quite complex. This function will provide the information to 2810251881Speter resolve the circumstances of the deletion. 2811251881Speter 2812251881Speter For discussion purposes, we will start with the most complex example 2813251881Speter and then demonstrate simplified examples. Consider node B/W/D/N has been 2814251881Speter found as deleted. B is an unmodified directory (thus, only in BASE). W is 2815251881Speter "replacement" content that exists in WORKING, shadowing a similar B/W 2816251881Speter directory in BASE. D is a deleted subtree in the WORKING tree, and N is 2817251881Speter the deleted node. 2818251881Speter 2819251881Speter In this example, BASE_DEL_ABSPATH will bet set to B/W. That is the root of 2820251881Speter the BASE tree (implicitly) deleted by the replacement. WORK_DEL_ABSPATH 2821251881Speter will be set to the subtree deleted within the replacement; in this case, 2822251881Speter B/W/D. No move-away took place, so MOVED_TO_ABSPATH is set to NULL. 2823251881Speter 2824251881Speter In another scenario, B/W was moved-away before W was put into the WORKING 2825251881Speter tree through an add/copy/move-here. MOVED_TO_ABSPATH will indicate where 2826251881Speter B/W was moved to. Note that further operations may have been performed 2827251881Speter post-move, but that is not known or reported by this function. 2828251881Speter 2829251881Speter If BASE does not have a B/W, then the WORKING B/W is not a replacement, 2830251881Speter but a simple add/copy/move-here. BASE_DEL_ABSPATH will be set to NULL. 2831251881Speter 2832251881Speter If B/W/D does not exist in the WORKING tree (we're only talking about a 2833251881Speter deletion of nodes of the BASE tree), then deleting B/W/D would have marked 2834251881Speter the subtree for deletion. BASE_DEL_ABSPATH will refer to B/W/D, 2835251881Speter MOVED_TO_ABSPATH will be NULL, and WORK_DEL_ABSPATH will be NULL. 2836251881Speter 2837251881Speter If the BASE node B/W/D was moved instead of deleted, then MOVED_TO_ABSPATH 2838251881Speter would indicate the target location (and other OUT values as above). 2839251881Speter 2840251881Speter When the user deletes B/W/D from the WORKING tree, there are a few 2841251881Speter additional considerations. If B/W is a simple addition (not a copy or 2842251881Speter a move-here), then the deletion will simply remove the nodes from WORKING 2843251881Speter and possibly leave behind "base-delete" markers in the WORKING tree. 2844251881Speter If the source is a copy/moved-here, then the nodes are replaced with 2845251881Speter deletion markers. 2846251881Speter 2847251881Speter If the user moves-away B/W/D from the WORKING tree, then behavior is 2848251881Speter again dependent upon the origination of B/W. For a plain add, the nodes 2849251881Speter simply move to the destination; this means that B/W/D ceases to be a 2850251881Speter node and so cannot be scanned. For a copy, a deletion is made at B/W/D, 2851251881Speter and a new copy (of a subtree of the original source) is made at the 2852251881Speter destination. For a move-here, a deletion is made, and a copy is made at 2853251881Speter the destination (we do not track multiple moves; the source is moved to 2854251881Speter B/W, then B/W/D is deleted; then a copy is made at the destination; 2855251881Speter however, note the double-move could have been performed by moving the 2856251881Speter subtree first, then moving the source to B/W). 2857251881Speter 2858251881Speter There are three further considerations when resolving a deleted node: 2859251881Speter 2860251881Speter If the BASE B/W/D was deleted explicitly *and* B/W is a replacement, 2861251881Speter then the explicit deletion is subsumed by the implicit deletion that 2862251881Speter occurred with the B/W replacement. Thus, BASE_DEL_ABSPATH will point 2863251881Speter to B/W as the root of the BASE deletion. IOW, we can detect the 2864251881Speter explicit move-away, but not an explicit deletion. 2865251881Speter 2866251881Speter If B/W/D/N refers to a node present in the BASE tree, and B/W was 2867251881Speter replaced by a shallow subtree, then it is possible for N to be 2868251881Speter reported as deleted (from BASE) yet no deletions occurred in the 2869251881Speter WORKING tree above N. Thus, WORK_DEL_ABSPATH will be set to NULL. 2870251881Speter 2871251881Speter 2872251881Speter Summary of OUT parameters: 2873251881Speter 2874251881Speter BASE_DEL_ABSPATH will specify the nearest ancestor of the explicit or 2875251881Speter implicit deletion (if any) that applies to the BASE tree. 2876251881Speter 2877251881Speter WORK_DEL_ABSPATH will specify the root of a deleted subtree within 2878251881Speter the WORKING tree (note there is no concept of layered delete operations 2879251881Speter in WORKING, so there is only one deletion root in the ancestry). 2880251881Speter 2881251881Speter MOVED_TO_ABSPATH will specify the path where this node was moved to 2882251881Speter if the node has moved-away. 2883251881Speter 2884251881Speter If the node was moved-away, MOVED_TO_OP_ROOT_ABSPATH will specify the 2885251881Speter target path of the root of the move operation. If LOCAL_ABSPATH itself 2886251881Speter is the source path of the root of the move operation, then 2887251881Speter MOVED_TO_OP_ROOT_ABSPATH equals MOVED_TO_ABSPATH. 2888251881Speter 2889251881Speter All OUT parameters may be set to NULL to indicate a lack of interest in 2890251881Speter that piece of information. 2891251881Speter 2892251881Speter If the node given by LOCAL_ABSPATH does not exist, then 2893251881Speter SVN_ERR_WC_PATH_NOT_FOUND is returned. If it doesn't have a "deleted" 2894251881Speter status, then SVN_ERR_WC_PATH_UNEXPECTED_STATUS will be returned. 2895251881Speter 2896251881Speter All returned data will be allocated in RESULT_POOL. All temporary 2897251881Speter allocations will be made in SCRATCH_POOL. 2898251881Speter*/ 2899251881Spetersvn_error_t * 2900251881Spetersvn_wc__db_scan_deletion(const char **base_del_abspath, 2901251881Speter const char **moved_to_abspath, 2902251881Speter const char **work_del_abspath, 2903251881Speter const char **moved_to_op_root_abspath, 2904251881Speter svn_wc__db_t *db, 2905251881Speter const char *local_abspath, 2906251881Speter apr_pool_t *result_pool, 2907251881Speter apr_pool_t *scratch_pool); 2908251881Speter 2909251881Speter 2910251881Speter/* @} */ 2911251881Speter 2912251881Speter 2913251881Speter/* @defgroup svn_wc__db_upgrade Functions for upgrading a working copy. 2914251881Speter @{ 2915251881Speter*/ 2916251881Speter 2917262250Speter/* Installs or updates Sqlite schema statistics for the current (aka latest) 2918262250Speter working copy schema. 2919262250Speter 2920262250Speter This function should be called once on initializing the database and after 2921262250Speter an schema update completes */ 2922262250Spetersvn_error_t * 2923262250Spetersvn_wc__db_install_schema_statistics(svn_sqlite__db_t *sdb, 2924262250Speter apr_pool_t *scratch_pool); 2925262250Speter 2926262250Speter 2927251881Speter/* Create a new wc.db file for LOCAL_DIR_ABSPATH, which is going to be a 2928251881Speter working copy for the repository REPOS_ROOT_URL with uuid REPOS_UUID. 2929251881Speter Return the raw sqlite handle, repository id and working copy id 2930251881Speter and store the database in WC_DB. 2931251881Speter 2932251881Speter Perform temporary allocations in SCRATCH_POOL. */ 2933251881Spetersvn_error_t * 2934251881Spetersvn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb, 2935251881Speter apr_int64_t *repos_id, 2936251881Speter apr_int64_t *wc_id, 2937251881Speter svn_wc__db_t *wc_db, 2938251881Speter const char *local_dir_abspath, 2939251881Speter const char *repos_root_url, 2940251881Speter const char *repos_uuid, 2941251881Speter apr_pool_t *scratch_pool); 2942251881Speter 2943251881Speter/* Simply insert (or replace) one row in the EXTERNALS table. */ 2944251881Spetersvn_error_t * 2945251881Spetersvn_wc__db_upgrade_insert_external(svn_wc__db_t *db, 2946251881Speter const char *local_abspath, 2947251881Speter svn_node_kind_t kind, 2948251881Speter const char *parent_abspath, 2949251881Speter const char *def_local_abspath, 2950251881Speter const char *repos_relpath, 2951251881Speter const char *repos_root_url, 2952251881Speter const char *repos_uuid, 2953251881Speter svn_revnum_t def_peg_revision, 2954251881Speter svn_revnum_t def_revision, 2955251881Speter apr_pool_t *scratch_pool); 2956251881Speter 2957251881Speter/* Upgrade the metadata concerning the WC at WCROOT_ABSPATH, in DB, 2958251881Speter * to the SVN_WC__VERSION format. 2959251881Speter * 2960251881Speter * This function is used for upgrading wc-ng working copies to a newer 2961251881Speter * wc-ng format. If a pre-1.7 working copy is found, this function 2962251881Speter * returns SVN_ERR_WC_UPGRADE_REQUIRED. 2963251881Speter * 2964251881Speter * Upgrading subdirectories of a working copy is not supported. 2965251881Speter * If WCROOT_ABSPATH is not a working copy root SVN_ERR_WC_INVALID_OP_ON_CWD 2966251881Speter * is returned. 2967253734Speter * 2968253734Speter * If BUMPED_FORMAT is not NULL, set *BUMPED_FORMAT to TRUE if the format 2969253734Speter * was bumped or to FALSE if the wc was already at the resulting format. 2970251881Speter */ 2971251881Spetersvn_error_t * 2972251881Spetersvn_wc__db_bump_format(int *result_format, 2973253734Speter svn_boolean_t *bumped_format, 2974253734Speter svn_wc__db_t *db, 2975251881Speter const char *wcroot_abspath, 2976251881Speter apr_pool_t *scratch_pool); 2977251881Speter 2978251881Speter/* @} */ 2979251881Speter 2980251881Speter 2981251881Speter/* @defgroup svn_wc__db_wq Work queue manipulation. see workqueue.h 2982251881Speter @{ 2983251881Speter*/ 2984251881Speter 2985251881Speter/* In the WCROOT associated with DB and WRI_ABSPATH, add WORK_ITEM to the 2986251881Speter wcroot's work queue. Use SCRATCH_POOL for all temporary allocations. */ 2987251881Spetersvn_error_t * 2988251881Spetersvn_wc__db_wq_add(svn_wc__db_t *db, 2989251881Speter const char *wri_abspath, 2990251881Speter const svn_skel_t *work_item, 2991251881Speter apr_pool_t *scratch_pool); 2992251881Speter 2993251881Speter 2994251881Speter/* In the WCROOT associated with DB and WRI_ABSPATH, fetch a work item that 2995251881Speter needs to be completed. Its identifier is returned in ID, and the data in 2996251881Speter WORK_ITEM. 2997251881Speter 2998251881Speter Items are returned in the same order they were queued. This allows for 2999251881Speter (say) queueing work on a parent node to be handled before that of its 3000251881Speter children. 3001251881Speter 3002251881Speter If there are no work items to be completed, then ID will be set to zero, 3003251881Speter and WORK_ITEM to NULL. 3004251881Speter 3005251881Speter If COMPLETED_ID is not 0, the wq item COMPLETED_ID will be marked as 3006251881Speter completed before returning the next item. 3007251881Speter 3008251881Speter RESULT_POOL will be used to allocate WORK_ITEM, and SCRATCH_POOL 3009251881Speter will be used for all temporary allocations. */ 3010251881Spetersvn_error_t * 3011251881Spetersvn_wc__db_wq_fetch_next(apr_uint64_t *id, 3012251881Speter svn_skel_t **work_item, 3013251881Speter svn_wc__db_t *db, 3014251881Speter const char *wri_abspath, 3015251881Speter apr_uint64_t completed_id, 3016251881Speter apr_pool_t *result_pool, 3017251881Speter apr_pool_t *scratch_pool); 3018251881Speter 3019251881Speter/* Special variant of svn_wc__db_wq_fetch_next(), which in the same transaction 3020251881Speter also records timestamps and sizes for one or more nodes */ 3021251881Spetersvn_error_t * 3022251881Spetersvn_wc__db_wq_record_and_fetch_next(apr_uint64_t *id, 3023251881Speter svn_skel_t **work_item, 3024251881Speter svn_wc__db_t *db, 3025251881Speter const char *wri_abspath, 3026251881Speter apr_uint64_t completed_id, 3027251881Speter apr_hash_t *record_map, 3028251881Speter apr_pool_t *result_pool, 3029251881Speter apr_pool_t *scratch_pool); 3030251881Speter 3031251881Speter 3032251881Speter/* @} */ 3033251881Speter 3034251881Speter 3035251881Speter/* Note: LEVELS_TO_LOCK is here strictly for backward compat. The access 3036251881Speter batons still have the notion of 'levels to lock' and we need to ensure 3037251881Speter that they still function correctly, even in the new world. 'levels to 3038251881Speter lock' should not be exposed through the wc-ng APIs at all: users either 3039251881Speter get to lock the entire tree (rooted at some subdir, of course), or none. 3040251881Speter 3041251881Speter An infinite depth lock is obtained with LEVELS_TO_LOCK set to -1, but until 3042251881Speter we move to a single DB only depth 0 is supported. 3043251881Speter*/ 3044251881Spetersvn_error_t * 3045251881Spetersvn_wc__db_wclock_obtain(svn_wc__db_t *db, 3046251881Speter const char *local_abspath, 3047251881Speter int levels_to_lock, 3048251881Speter svn_boolean_t steal_lock, 3049251881Speter apr_pool_t *scratch_pool); 3050251881Speter 3051362181Sdim/* Set LOCK_ABSPATH to the path of the directory that owns the 3052251881Speter lock on LOCAL_ABSPATH, or NULL, if LOCAL_ABSPATH is not locked. */ 3053251881Spetersvn_error_t* 3054251881Spetersvn_wc__db_wclock_find_root(const char **lock_abspath, 3055251881Speter svn_wc__db_t *db, 3056251881Speter const char *local_abspath, 3057251881Speter apr_pool_t *result_pool, 3058251881Speter apr_pool_t *scratch_pool); 3059251881Speter 3060251881Speter/* Check if somebody has a wclock on LOCAL_ABSPATH */ 3061251881Spetersvn_error_t * 3062251881Spetersvn_wc__db_wclocked(svn_boolean_t *locked, 3063251881Speter svn_wc__db_t *db, 3064251881Speter const char *local_abspath, 3065251881Speter apr_pool_t *scratch_pool); 3066251881Speter 3067251881Speter/* Release the previously obtained lock on LOCAL_ABSPATH */ 3068251881Spetersvn_error_t * 3069251881Spetersvn_wc__db_wclock_release(svn_wc__db_t *db, 3070251881Speter const char *local_abspath, 3071251881Speter apr_pool_t *scratch_pool); 3072251881Speter 3073251881Speter/* Checks whether DB currently owns a lock to operate on LOCAL_ABSPATH. 3074251881Speter If EXACT is TRUE only lock roots are checked. */ 3075251881Spetersvn_error_t * 3076251881Spetersvn_wc__db_wclock_owns_lock(svn_boolean_t *own_lock, 3077251881Speter svn_wc__db_t *db, 3078251881Speter const char *local_abspath, 3079251881Speter svn_boolean_t exact, 3080251881Speter apr_pool_t *scratch_pool); 3081251881Speter 3082251881Speter 3083251881Speter 3084251881Speter/* @defgroup svn_wc__db_temp Various temporary functions during transition 3085251881Speter 3086251881Speter ### These functions SHOULD be completely removed before 1.7 3087251881Speter 3088251881Speter @{ 3089251881Speter*/ 3090251881Speter 3091251881Speter/* Removes all references to LOCAL_ABSPATH from DB, while optionally leaving 3092251881Speter a not present node. 3093251881Speter 3094251881Speter This operation always recursively removes all nodes at and below 3095251881Speter LOCAL_ABSPATH from NODES and ACTUAL. 3096251881Speter 3097251881Speter If DESTROY_WC is TRUE, this operation *installs* workqueue operations to 3098251881Speter update the local filesystem after the database operation. If DESTROY_CHANGES 3099251881Speter is FALSE, modified and unversioned files are left after running this 3100251881Speter operation (and the WQ). If DESTROY_CHANGES and DESTROY_WC are TRUE, 3101251881Speter LOCAL_ABSPATH and everything below it will be removed by the WQ. 3102251881Speter 3103251881Speter 3104251881Speter Note: Unlike many similar functions it is a valid scenario for this 3105251881Speter function to be called on a wcroot! In this case it will just leave the root 3106251881Speter record in BASE 3107251881Speter */ 3108251881Spetersvn_error_t * 3109251881Spetersvn_wc__db_op_remove_node(svn_boolean_t *left_changes, 3110251881Speter svn_wc__db_t *db, 3111251881Speter const char *local_abspath, 3112251881Speter svn_boolean_t destroy_wc, 3113251881Speter svn_boolean_t destroy_changes, 3114251881Speter const svn_skel_t *conflict, 3115251881Speter const svn_skel_t *work_items, 3116251881Speter svn_cancel_func_t cancel_func, 3117251881Speter void *cancel_baton, 3118251881Speter apr_pool_t *scratch_pool); 3119251881Speter 3120251881Speter/* Sets the depth of LOCAL_ABSPATH in its working copy to DEPTH using DB. 3121251881Speter 3122251881Speter Returns SVN_ERR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not a BASE directory 3123251881Speter */ 3124251881Spetersvn_error_t * 3125251881Spetersvn_wc__db_op_set_base_depth(svn_wc__db_t *db, 3126251881Speter const char *local_abspath, 3127251881Speter svn_depth_t depth, 3128251881Speter apr_pool_t *scratch_pool); 3129251881Speter 3130251881Speter/* ### temp function. return the FORMAT for the directory LOCAL_ABSPATH. */ 3131251881Spetersvn_error_t * 3132251881Spetersvn_wc__db_temp_get_format(int *format, 3133251881Speter svn_wc__db_t *db, 3134251881Speter const char *local_dir_abspath, 3135251881Speter apr_pool_t *scratch_pool); 3136251881Speter 3137251881Speter/* ### temp functions to manage/store access batons within the DB. */ 3138251881Spetersvn_wc_adm_access_t * 3139251881Spetersvn_wc__db_temp_get_access(svn_wc__db_t *db, 3140251881Speter const char *local_dir_abspath, 3141251881Speter apr_pool_t *scratch_pool); 3142251881Spetervoid 3143251881Spetersvn_wc__db_temp_set_access(svn_wc__db_t *db, 3144251881Speter const char *local_dir_abspath, 3145251881Speter svn_wc_adm_access_t *adm_access, 3146251881Speter apr_pool_t *scratch_pool); 3147251881Spetersvn_error_t * 3148251881Spetersvn_wc__db_temp_close_access(svn_wc__db_t *db, 3149251881Speter const char *local_dir_abspath, 3150251881Speter svn_wc_adm_access_t *adm_access, 3151251881Speter apr_pool_t *scratch_pool); 3152251881Spetervoid 3153251881Spetersvn_wc__db_temp_clear_access(svn_wc__db_t *db, 3154251881Speter const char *local_dir_abspath, 3155251881Speter apr_pool_t *scratch_pool); 3156251881Speter 3157251881Speter/* ### shallow hash: abspath -> svn_wc_adm_access_t * */ 3158251881Speterapr_hash_t * 3159251881Spetersvn_wc__db_temp_get_all_access(svn_wc__db_t *db, 3160251881Speter apr_pool_t *result_pool); 3161251881Speter 3162251881Speter/* ### temp function to open the sqlite database to the appropriate location, 3163251881Speter ### then borrow it for a bit. 3164251881Speter ### The *only* reason for this function is because entries.c still 3165251881Speter ### manually hacks the sqlite database. 3166251881Speter 3167251881Speter ### No matter how tempted you may be DO NOT USE THIS FUNCTION! 3168251881Speter ### (if you do, gstein will hunt you down and burn your knee caps off 3169251881Speter ### in the middle of the night) 3170251881Speter ### "Bet on it." --gstein 3171251881Speter*/ 3172251881Spetersvn_error_t * 3173251881Spetersvn_wc__db_temp_borrow_sdb(svn_sqlite__db_t **sdb, 3174251881Speter svn_wc__db_t *db, 3175251881Speter const char *local_dir_abspath, 3176251881Speter apr_pool_t *scratch_pool); 3177251881Speter 3178251881Speter 3179251881Speter/* Return a directory in *TEMP_DIR_ABSPATH that is suitable for temporary 3180251881Speter files which may need to be moved (atomically and same-device) into the 3181251881Speter working copy indicated by WRI_ABSPATH. */ 3182251881Spetersvn_error_t * 3183251881Spetersvn_wc__db_temp_wcroot_tempdir(const char **temp_dir_abspath, 3184251881Speter svn_wc__db_t *db, 3185251881Speter const char *wri_abspath, 3186251881Speter apr_pool_t *result_pool, 3187251881Speter apr_pool_t *scratch_pool); 3188251881Speter 3189251881Speter/* Update the BASE_NODE of directory LOCAL_ABSPATH to be NEW_REPOS_RELPATH 3190251881Speter at revision NEW_REV with status incomplete. */ 3191251881Spetersvn_error_t * 3192251881Spetersvn_wc__db_temp_op_start_directory_update(svn_wc__db_t *db, 3193251881Speter const char *local_abspath, 3194251881Speter const char *new_repos_relpath, 3195251881Speter svn_revnum_t new_rev, 3196251881Speter apr_pool_t *scratch_pool); 3197251881Speter 3198251881Speter/* Marks a directory update started with 3199251881Speter svn_wc__db_temp_op_start_directory_update as completed, by removing 3200251881Speter the incomplete status */ 3201251881Spetersvn_error_t * 3202251881Spetersvn_wc__db_temp_op_end_directory_update(svn_wc__db_t *db, 3203251881Speter const char *local_dir_abspath, 3204251881Speter apr_pool_t *scratch_pool); 3205251881Speter 3206251881Speter 3207289180Speter/* When local_abspath has no WORKING layer, copy the base tree at 3208289180Speter LOCAL_ABSPATH into the working tree as copy, leaving any subtree 3209289180Speter additions and copies as-is. This may introduce multiple layers if 3210289180Speter the tree is mixed revision. 3211289180Speter 3212289180Speter When local_abspath has a WORKING node, but is not an op-root, copy 3213289180Speter all descendants at the same op-depth to the op-depth of local_abspath, 3214289180Speter thereby turning this node in a copy of what was already there. 3215289180Speter 3216289180Speter Fails with a SVN_ERR_WC_PATH_UNEXPECTED_STATUS error if LOCAL_RELPATH 3217289180Speter is already an op-root (as in that case it can't be copied as that 3218289180Speter would overwrite what is already there). 3219289180Speter 3220289180Speter After this operation the copied layer (E.g. BASE) can be removed, without 3221289180Speter the WORKING nodes chaning. Typical usecase: tree conflict handling */ 3222251881Spetersvn_error_t * 3223251881Spetersvn_wc__db_op_make_copy(svn_wc__db_t *db, 3224251881Speter const char *local_abspath, 3225251881Speter const svn_skel_t *conflicts, 3226251881Speter const svn_skel_t *work_items, 3227251881Speter apr_pool_t *scratch_pool); 3228251881Speter 3229251881Speter/* Close the wc root LOCAL_ABSPATH and remove any per-directory 3230251881Speter handles associated with it. */ 3231251881Spetersvn_error_t * 3232251881Spetersvn_wc__db_drop_root(svn_wc__db_t *db, 3233251881Speter const char *local_abspath, 3234251881Speter apr_pool_t *scratch_pool); 3235251881Speter 3236251881Speter/* Return the OP_DEPTH for LOCAL_RELPATH. */ 3237251881Speterint 3238251881Spetersvn_wc__db_op_depth_for_upgrade(const char *local_relpath); 3239251881Speter 3240251881Speter/* Set *HAVE_WORK TRUE if there is a working layer below the top layer and 3241251881Speter *HAVE_BASE if there is a base layer. Set *STATUS to the status of the 3242251881Speter highest layer below WORKING */ 3243251881Spetersvn_error_t * 3244251881Spetersvn_wc__db_info_below_working(svn_boolean_t *have_base, 3245251881Speter svn_boolean_t *have_work, 3246251881Speter svn_wc__db_status_t *status, 3247251881Speter svn_wc__db_t *db, 3248251881Speter const char *local_abspath, 3249251881Speter apr_pool_t *scratch_pool); 3250251881Speter 3251251881Speter 3252251881Speter/* Gets an array of const char *local_relpaths of descendants of LOCAL_ABSPATH, 3253251881Speter * which itself must be the op root of an addition, copy or move. 3254251881Speter * The descendants returned are at the same op_depth, but are to be deleted 3255251881Speter * by the commit processing because they are not present in the local copy. 3256251881Speter */ 3257251881Spetersvn_error_t * 3258251881Spetersvn_wc__db_get_not_present_descendants(const apr_array_header_t **descendants, 3259251881Speter svn_wc__db_t *db, 3260251881Speter const char *local_abspath, 3261251881Speter apr_pool_t *result_pool, 3262251881Speter apr_pool_t *scratch_pool); 3263251881Speter 3264251881Speter/* Gather revision status information about a working copy using DB. 3265251881Speter * 3266251881Speter * Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision 3267251881Speter * numbers found within LOCAL_ABSPATH. 3268251881Speter * Only nodes with op_depth zero and presence 'normal' or 'incomplete' 3269251881Speter * are considered, so that added, deleted or excluded nodes do not affect 3270251881Speter * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION 3271251881Speter * to the lowest and highest committed (i.e. "last changed") revision numbers, 3272251881Speter * respectively. 3273251881Speter * 3274251881Speter * Indicate in *IS_SPARSE_CHECKOUT whether any of the nodes within 3275251881Speter * LOCAL_ABSPATH is sparse. 3276289180Speter * Indicate in *IS_MODIFIED whether the working copy has local modifications 3277289180Speter * recorded for it in DB. 3278251881Speter * 3279251881Speter * Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH 3280251881Speter * is switched. If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH 3281251881Speter * itself is switched. It should be any trailing portion of LOCAL_ABSPATH's 3282251881Speter * expected URL, long enough to include any parts that the caller considers 3283251881Speter * might be changed by a switch. If it does not match the end of WC_PATH's 3284251881Speter * actual URL, then report a "switched" status. 3285251881Speter * 3286251881Speter * See also the functions below which provide a subset of this functionality. 3287251881Speter */ 3288251881Spetersvn_error_t * 3289251881Spetersvn_wc__db_revision_status(svn_revnum_t *min_revision, 3290251881Speter svn_revnum_t *max_revision, 3291251881Speter svn_boolean_t *is_sparse_checkout, 3292251881Speter svn_boolean_t *is_modified, 3293251881Speter svn_boolean_t *is_switched, 3294251881Speter svn_wc__db_t *db, 3295251881Speter const char *local_abspath, 3296251881Speter const char *trail_url, 3297251881Speter svn_boolean_t committed, 3298251881Speter apr_pool_t *scratch_pool); 3299251881Speter 3300251881Speter/* Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision 3301251881Speter * numbers found within LOCAL_ABSPATH in the working copy using DB. 3302251881Speter * Only nodes with op_depth zero and presence 'normal' or 'incomplete' 3303251881Speter * are considered, so that added, deleted or excluded nodes do not affect 3304251881Speter * the result. If COMMITTED is TRUE, set *MIN_REVISION and *MAX_REVISION 3305251881Speter * to the lowest and highest committed (i.e. "last changed") revision numbers, 3306251881Speter * respectively. Use SCRATCH_POOL for temporary allocations. 3307251881Speter * 3308251881Speter * Either of MIN_REVISION and MAX_REVISION may be passed as NULL if 3309251881Speter * the caller doesn't care about that return value. 3310251881Speter * 3311251881Speter * This function provides a subset of the functionality of 3312251881Speter * svn_wc__db_revision_status() and is more efficient if the caller 3313251881Speter * doesn't need all information returned by svn_wc__db_revision_status(). */ 3314251881Spetersvn_error_t * 3315251881Spetersvn_wc__db_min_max_revisions(svn_revnum_t *min_revision, 3316251881Speter svn_revnum_t *max_revision, 3317251881Speter svn_wc__db_t *db, 3318251881Speter const char *local_abspath, 3319251881Speter svn_boolean_t committed, 3320251881Speter apr_pool_t *scratch_pool); 3321251881Speter 3322251881Speter/* Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH 3323251881Speter * is switched, using DB. Use SCRATCH_POOL for temporary allocations. 3324251881Speter * 3325251881Speter * If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH itself 3326251881Speter * is switched. It should be any trailing portion of LOCAL_ABSPATH's 3327251881Speter * expected URL, long enough to include any parts that the caller considers 3328251881Speter * might be changed by a switch. If it does not match the end of WC_PATH's 3329251881Speter * actual URL, then report a "switched" status. 3330251881Speter * 3331251881Speter * This function provides a subset of the functionality of 3332251881Speter * svn_wc__db_revision_status() and is more efficient if the caller 3333251881Speter * doesn't need all information returned by svn_wc__db_revision_status(). */ 3334251881Spetersvn_error_t * 3335251881Spetersvn_wc__db_has_switched_subtrees(svn_boolean_t *is_switched, 3336251881Speter svn_wc__db_t *db, 3337251881Speter const char *local_abspath, 3338251881Speter const char *trail_url, 3339251881Speter apr_pool_t *scratch_pool); 3340251881Speter 3341251881Speter/* Set @a *excluded_subtrees to a hash mapping <tt>const char *</tt> 3342251881Speter * local absolute paths to <tt>const char *</tt> local absolute paths for 3343251881Speter * every path under @a local_abspath in @a db which are excluded by 3344251881Speter * the server (e.g. due to authz), or user. If no such paths are found then 3345251881Speter * @a *server_excluded_subtrees is set to @c NULL. 3346251881Speter * Allocate the hash and all items therein from @a result_pool. 3347251881Speter */ 3348251881Spetersvn_error_t * 3349251881Spetersvn_wc__db_get_excluded_subtrees(apr_hash_t **server_excluded_subtrees, 3350251881Speter svn_wc__db_t *db, 3351251881Speter const char *local_abspath, 3352251881Speter apr_pool_t *result_pool, 3353251881Speter apr_pool_t *scratch_pool); 3354251881Speter 3355251881Speter/* Indicate in *IS_MODIFIED whether the working copy has local modifications, 3356251881Speter * using DB. Use SCRATCH_POOL for temporary allocations. 3357251881Speter * 3358289180Speter * This function does not check the working copy state, but is a lot more 3359289180Speter * efficient than a full status walk. */ 3360251881Spetersvn_error_t * 3361289180Spetersvn_wc__db_has_db_mods(svn_boolean_t *is_modified, 3362289180Speter svn_wc__db_t *db, 3363289180Speter const char *local_abspath, 3364289180Speter apr_pool_t *scratch_pool); 3365251881Speter 3366251881Speter 3367251881Speter/* Verify the consistency of metadata concerning the WC that contains 3368251881Speter * WRI_ABSPATH, in DB. Return an error if any problem is found. */ 3369251881Spetersvn_error_t * 3370251881Spetersvn_wc__db_verify(svn_wc__db_t *db, 3371251881Speter const char *wri_abspath, 3372251881Speter apr_pool_t *scratch_pool); 3373251881Speter 3374251881Speter 3375251881Speter/* Possibly need two structures, one with relpaths and with abspaths? 3376251881Speter * Only exposed for testing at present. */ 3377251881Speterstruct svn_wc__db_moved_to_t { 3378251881Speter const char *local_relpath; /* moved-to destination */ 3379251881Speter int op_depth; /* op-root of source */ 3380251881Speter}; 3381251881Speter 3382251881Speter/* Set *FINAL_ABSPATH to an array of svn_wc__db_moved_to_t for 3383251881Speter * LOCAL_ABSPATH after following any and all nested moves. 3384251881Speter * Only exposed for testing at present. */ 3385251881Spetersvn_error_t * 3386251881Spetersvn_wc__db_follow_moved_to(apr_array_header_t **moved_tos, 3387251881Speter svn_wc__db_t *db, 3388251881Speter const char *local_abspath, 3389251881Speter apr_pool_t *result_pool, 3390251881Speter apr_pool_t *scratch_pool); 3391251881Speter 3392289180Speter/* Update a moved-away tree conflict victim LOCAL_ABSPATH, deleted in 3393289180Speter DELETE_OP_ABSPATH with changes from the original location. */ 3394251881Spetersvn_error_t * 3395251881Spetersvn_wc__db_update_moved_away_conflict_victim(svn_wc__db_t *db, 3396289180Speter const char *local_abspath, 3397289180Speter const char *delete_op_abspath, 3398289180Speter svn_wc_operation_t operation, 3399289180Speter svn_wc_conflict_action_t action, 3400289180Speter svn_wc_conflict_reason_t reason, 3401289180Speter svn_cancel_func_t cancel_func, 3402289180Speter void *cancel_baton, 3403251881Speter svn_wc_notify_func2_t notify_func, 3404251881Speter void *notify_baton, 3405251881Speter apr_pool_t *scratch_pool); 3406251881Speter 3407362181Sdim/* Merge local changes from tree conflict victim at LOCAL_ABSPATH into the 3408362181Sdim directory at DEST_ABSPATH. This function requires that LOCAL_ABSPATH is 3409362181Sdim a directory and a tree-conflict victim. DST_ABSPATH must be a directory. */ 3410362181Sdimsvn_error_t * 3411362181Sdimsvn_wc__db_update_incoming_move(svn_wc__db_t *db, 3412362181Sdim const char *local_abspath, 3413362181Sdim const char *dest_abspath, 3414362181Sdim svn_wc_operation_t operation, 3415362181Sdim svn_wc_conflict_action_t action, 3416362181Sdim svn_wc_conflict_reason_t reason, 3417362181Sdim svn_cancel_func_t cancel_func, 3418362181Sdim void *cancel_baton, 3419362181Sdim svn_wc_notify_func2_t notify_func, 3420362181Sdim void *notify_baton, 3421362181Sdim apr_pool_t *scratch_pool); 3422362181Sdim 3423362181Sdim/* Merge locally added dir tree conflict victim at LOCAL_ABSPATH with the 3424362181Sdim * directory since added to the BASE layer by an update operation. */ 3425362181Sdimsvn_error_t * 3426362181Sdimsvn_wc__db_update_local_add(svn_wc__db_t *db, 3427362181Sdim const char *local_abspath, 3428362181Sdim svn_cancel_func_t cancel_func, 3429362181Sdim void *cancel_baton, 3430362181Sdim svn_wc_notify_func2_t notify_func, 3431362181Sdim void *notify_baton, 3432362181Sdim apr_pool_t *scratch_pool); 3433362181Sdim 3434251881Speter/* LOCAL_ABSPATH is moved to MOVE_DST_ABSPATH. MOVE_SRC_ROOT_ABSPATH 3435251881Speter * is the root of the move to MOVE_DST_OP_ROOT_ABSPATH. 3436289180Speter * DELETE_ABSPATH is the op-root of the move; it's the same 3437251881Speter * as MOVE_SRC_ROOT_ABSPATH except for moves inside deletes when it is 3438251881Speter * the op-root of the delete. */ 3439251881Spetersvn_error_t * 3440251881Spetersvn_wc__db_base_moved_to(const char **move_dst_abspath, 3441251881Speter const char **move_dst_op_root_abspath, 3442251881Speter const char **move_src_root_abspath, 3443289180Speter const char **delete_abspath, 3444251881Speter svn_wc__db_t *db, 3445251881Speter const char *local_abspath, 3446251881Speter apr_pool_t *result_pool, 3447251881Speter apr_pool_t *scratch_pool); 3448251881Speter 3449251881Speter/* Recover space from the database file for LOCAL_ABSPATH by running 3450251881Speter * the "vacuum" command. */ 3451251881Spetersvn_error_t * 3452251881Spetersvn_wc__db_vacuum(svn_wc__db_t *db, 3453251881Speter const char *local_abspath, 3454251881Speter apr_pool_t *scratch_pool); 3455251881Speter 3456251881Speter/* This raises move-edit tree-conflicts on any moves inside the 3457251881Speter delete-edit conflict on LOCAL_ABSPATH. This is experimental: see 3458251881Speter comment in resolve_conflict_on_node about combining with another 3459251881Speter function. */ 3460251881Spetersvn_error_t * 3461289180Spetersvn_wc__db_op_raise_moved_away(svn_wc__db_t *db, 3462289180Speter const char *local_abspath, 3463289180Speter svn_wc_notify_func2_t notify_func, 3464289180Speter void *notify_baton, 3465289180Speter apr_pool_t *scratch_pool); 3466251881Speter 3467289180Speter/* Breaks all moves of nodes that exist at or below LOCAL_ABSPATH as 3468362181Sdim shadowed (read: deleted) by the operation rooted at 3469289180Speter delete_op_root_abspath. 3470289180Speter */ 3471251881Spetersvn_error_t * 3472289180Spetersvn_wc__db_op_break_moved_away(svn_wc__db_t *db, 3473289180Speter const char *local_abspath, 3474289180Speter const char *delete_op_root_abspath, 3475289180Speter svn_boolean_t mark_tc_resolved, 3476289180Speter svn_wc_notify_func2_t notify_func, 3477289180Speter void *notify_baton, 3478289180Speter apr_pool_t *scratch_pool); 3479251881Speter 3480251881Speter/* Set *REQUIRED_ABSPATH to the path that should be locked to ensure 3481251881Speter * that the lock covers all paths affected by resolving the conflicts 3482251881Speter * in the tree LOCAL_ABSPATH. */ 3483251881Spetersvn_error_t * 3484251881Spetersvn_wc__required_lock_for_resolve(const char **required_abspath, 3485251881Speter svn_wc__db_t *db, 3486251881Speter const char *local_abspath, 3487251881Speter apr_pool_t *result_pool, 3488251881Speter apr_pool_t *scratch_pool); 3489362181Sdim 3490362181Sdim/* Return an array of const char * elements, which represent local absolute 3491362181Sdim * paths for nodes, within the working copy indicated by WRI_ABSPATH, which 3492362181Sdim * correspond to REPOS_RELPATH. If no such nodes exist, return an empty array. 3493362181Sdim * 3494362181Sdim * Note that this function returns each and every such node that is known 3495362181Sdim * in the WC, including, for example, nodes that were children of a directory 3496362181Sdim * which has been replaced. 3497362181Sdim */ 3498362181Sdimsvn_error_t * 3499362181Sdimsvn_wc__db_find_repos_node_in_wc(apr_array_header_t **local_abspath_list, 3500362181Sdim svn_wc__db_t *db, 3501362181Sdim const char *wri_abspath, 3502362181Sdim const char *repos_relpath, 3503362181Sdim apr_pool_t *result_pool, 3504362181Sdim apr_pool_t *scratch_pool); 3505362181Sdim 3506362181Sdim/* Return an array of const char * elements, which represent local absolute 3507362181Sdim * paths for nodes, within the working copy indicated by WRI_ABSPATH, which 3508362181Sdim * have a basename matching BASENAME and have node kind KIND. 3509362181Sdim * If no such nodes exist, return an empty array. 3510362181Sdim * 3511362181Sdim * This function returns only paths to nodes which are present in the highest 3512362181Sdim * layer of the WC. In other words, paths to deleted and/or excluded nodes are 3513362181Sdim * never returned. 3514362181Sdim */ 3515362181Sdimsvn_error_t * 3516362181Sdimsvn_wc__db_find_working_nodes_with_basename(apr_array_header_t **local_abspaths, 3517362181Sdim svn_wc__db_t *db, 3518362181Sdim const char *wri_abspath, 3519362181Sdim const char *basename, 3520362181Sdim svn_node_kind_t kind, 3521362181Sdim apr_pool_t *result_pool, 3522362181Sdim apr_pool_t *scratch_pool); 3523362181Sdim 3524362181Sdim/* Return an array of const char * elements, which represent local absolute 3525362181Sdim * paths for nodes, within the working copy indicated by WRI_ABSPATH, which 3526362181Sdim * are copies of REPOS_RELPATH and have node kind KIND. 3527362181Sdim * If no such nodes exist, return an empty array. 3528362181Sdim * 3529362181Sdim * This function returns only paths to nodes which are present in the highest 3530362181Sdim * layer of the WC. In other words, paths to deleted and/or excluded nodes are 3531362181Sdim * never returned. 3532362181Sdim */ 3533362181Sdimsvn_error_t * 3534362181Sdimsvn_wc__db_find_copies_of_repos_path(apr_array_header_t **local_abspaths, 3535362181Sdim svn_wc__db_t *db, 3536362181Sdim const char *wri_abspath, 3537362181Sdim const char *repos_relpath, 3538362181Sdim svn_node_kind_t kind, 3539362181Sdim apr_pool_t *result_pool, 3540362181Sdim apr_pool_t *scratch_pool); 3541251881Speter/* @} */ 3542251881Speter 3543289180Spetertypedef svn_error_t * (*svn_wc__db_verify_cb_t)(void *baton, 3544289180Speter const char *wc_abspath, 3545289180Speter const char *local_relpath, 3546289180Speter int op_depth, 3547289180Speter int id, 3548289180Speter const char *description, 3549289180Speter apr_pool_t *scratch_pool); 3550251881Speter 3551289180Speter/* Checks the database for FULL-correctness according to the spec. 3552289180Speter 3553289180Speter Note that typical 1.7-1.9 databases WILL PRODUCE warnings. 3554289180Speter 3555289180Speter This is mainly useful for WC-NG developers, as there will be 3556289180Speter warnings without the database being corrupt 3557289180Speter*/ 3558289180Spetersvn_error_t * 3559289180Spetersvn_wc__db_verify_db_full(svn_wc__db_t *db, 3560289180Speter const char *wri_abspath, 3561289180Speter svn_wc__db_verify_cb_t callback, 3562289180Speter void *baton, 3563289180Speter apr_pool_t *scratch_pool); 3564289180Speter 3565289180Speter 3566251881Speter#ifdef __cplusplus 3567251881Speter} 3568251881Speter#endif /* __cplusplus */ 3569251881Speter 3570251881Speter#endif /* SVN_WC_DB_H */ 3571