1 /* 2 * adm_files.h : handles locations inside the wc adm area 3 * (This should be the only code that actually knows 4 * *where* things are in .svn/. If you can't get to 5 * something via these interfaces, something's wrong.) 6 * 7 * ==================================================================== 8 * Licensed to the Apache Software Foundation (ASF) under one 9 * or more contributor license agreements. See the NOTICE file 10 * distributed with this work for additional information 11 * regarding copyright ownership. The ASF licenses this file 12 * to you under the Apache License, Version 2.0 (the 13 * "License"); you may not use this file except in compliance 14 * with the License. You may obtain a copy of the License at 15 * 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, 19 * software distributed under the License is distributed on an 20 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 * KIND, either express or implied. See the License for the 22 * specific language governing permissions and limitations 23 * under the License. 24 * ==================================================================== 25 */ 26 27 28 #ifndef SVN_LIBSVN_WC_ADM_FILES_H 29 #define SVN_LIBSVN_WC_ADM_FILES_H 30 31 #include <apr_pools.h> 32 #include "svn_types.h" 33 34 #include "props.h" 35 #include "wc_db.h" 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif /* __cplusplus */ 40 41 42 43 /* Return a path to CHILD in the administrative area of PATH. If CHILD is 44 NULL, then the path to the admin area is returned. The result is 45 allocated in RESULT_POOL. */ 46 const char *svn_wc__adm_child(const char *path, 47 const char *child, 48 apr_pool_t *result_pool); 49 50 /* Return TRUE if the administrative area exists for this directory. */ 51 svn_boolean_t svn_wc__adm_area_exists(const char *adm_abspath, 52 apr_pool_t *pool); 53 54 55 /* Set *CONTENTS to a readonly stream on the pristine text of the working 56 * version of the file LOCAL_ABSPATH in DB. If the file is locally copied 57 * or moved to this path, this means the pristine text of the copy source, 58 * even if the file replaces a previously existing base node at this path. 59 * 60 * Set *CONTENTS to NULL if there is no pristine text because the file is 61 * locally added (even if it replaces an existing base node). Return an 62 * error if there is no pristine text for any other reason. 63 * 64 * If SIZE is not NULL, set *SIZE to the length of the pristine stream in 65 * BYTES or to SVN_INVALID_FILESIZE if no pristine is available for this 66 * file. 67 * 68 * For more detail, see the description of svn_wc_get_pristine_contents2(). 69 */ 70 svn_error_t * 71 svn_wc__get_pristine_contents(svn_stream_t **contents, 72 svn_filesize_t *size, 73 svn_wc__db_t *db, 74 const char *local_abspath, 75 apr_pool_t *result_pool, 76 apr_pool_t *scratch_pool); 77 78 /* Set *RESULT_ABSPATH to the absolute path to a readable file containing 79 the WC-1 "normal text-base" of LOCAL_ABSPATH in DB. 80 81 "Normal text-base" means the same as in svn_wc__text_base_path(). 82 ### May want to check the callers' exact requirements and replace this 83 definition with something easier to comprehend. 84 85 What the callers want: 86 A path to a file that will remain available and unchanged as long as 87 the caller wants it - such as for the lifetime of RESULT_POOL. 88 89 What the current implementation provides: 90 A path to the file in the pristine store. This file will be removed or 91 replaced the next time this or another Subversion client updates the WC. 92 93 If the node LOCAL_ABSPATH has no such pristine text, return an error of 94 type SVN_ERR_WC_PATH_UNEXPECTED_STATUS. 95 96 Allocate *RESULT_PATH in RESULT_POOL. */ 97 svn_error_t * 98 svn_wc__text_base_path_to_read(const char **result_abspath, 99 svn_wc__db_t *db, 100 const char *local_abspath, 101 apr_pool_t *result_pool, 102 apr_pool_t *scratch_pool); 103 104 105 /*** Opening all kinds of adm files ***/ 106 107 /* Open `PATH/<adminstrative_subdir>/FNAME'. */ 108 svn_error_t *svn_wc__open_adm_stream(svn_stream_t **stream, 109 const char *dir_abspath, 110 const char *fname, 111 apr_pool_t *result_pool, 112 apr_pool_t *scratch_pool); 113 114 115 /* Blow away the admistrative directory associated with DIR_ABSPATH. 116 For single-db this doesn't perform actual work unless the wcroot is passed. 117 */ 118 svn_error_t *svn_wc__adm_destroy(svn_wc__db_t *db, 119 const char *dir_abspath, 120 svn_cancel_func_t cancel_func, 121 void *cancel_baton, 122 apr_pool_t *scratch_pool); 123 124 125 /* Cleanup the temporary storage area of the administrative 126 directory (assuming temp and admin areas exist). */ 127 svn_error_t * 128 svn_wc__adm_cleanup_tmp_area(svn_wc__db_t *db, 129 const char *adm_abspath, 130 apr_pool_t *scratch_pool); 131 132 133 #ifdef __cplusplus 134 } 135 #endif /* __cplusplus */ 136 137 #endif /* SVN_LIBSVN_WC_ADM_FILES_H */ 138