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.)
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
16 * http://www.apache.org/licenses/LICENSE-2.0
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
24 * ====================================================================
28 #ifndef SVN_LIBSVN_WC_ADM_FILES_H
29 #define SVN_LIBSVN_WC_ADM_FILES_H
31 #include <apr_pools.h>
32 #include "svn_types.h"
39 #endif /* __cplusplus */
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,
48 apr_pool_t *result_pool);
50 /* Return TRUE if the administrative area exists for this directory. */
51 svn_boolean_t svn_wc__adm_area_exists(const char *adm_abspath,
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.
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.
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
68 * For more detail, see the description of svn_wc_get_pristine_contents2().
71 svn_wc__get_pristine_contents(svn_stream_t **contents,
74 const char *local_abspath,
75 apr_pool_t *result_pool,
76 apr_pool_t *scratch_pool);
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.
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.
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.
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.
93 If the node LOCAL_ABSPATH has no such pristine text, return an error of
94 type SVN_ERR_WC_PATH_UNEXPECTED_STATUS.
96 Allocate *RESULT_PATH in RESULT_POOL. */
98 svn_wc__text_base_path_to_read(const char **result_abspath,
100 const char *local_abspath,
101 apr_pool_t *result_pool,
102 apr_pool_t *scratch_pool);
105 /*** Opening all kinds of adm files ***/
107 /* Open `PATH/<adminstrative_subdir>/FNAME'. */
108 svn_error_t *svn_wc__open_adm_stream(svn_stream_t **stream,
109 const char *dir_abspath,
111 apr_pool_t *result_pool,
112 apr_pool_t *scratch_pool);
115 /* Open a writable stream to a temporary (normal or revert) text base,
116 associated with the versioned file LOCAL_ABSPATH in DB. Set *STREAM to
117 the opened stream and *TEMP_BASE_ABSPATH to the path to the temporary
118 file. The temporary file will have an arbitrary unique name, in contrast
119 to the deterministic name that svn_wc__text_base_deterministic_tmp_path()
122 Arrange that, on stream closure, *MD5_CHECKSUM and *SHA1_CHECKSUM will be
123 set to the MD-5 and SHA-1 checksums respectively of that file.
124 MD5_CHECKSUM and/or SHA1_CHECKSUM may be NULL if not wanted.
126 Allocate the new stream, path and checksums in RESULT_POOL.
129 svn_wc__open_writable_base(svn_stream_t **stream,
130 const char **temp_base_abspath,
131 svn_checksum_t **md5_checksum,
132 svn_checksum_t **sha1_checksum,
134 const char *wri_abspath,
135 apr_pool_t *result_pool,
136 apr_pool_t *scratch_pool);
139 /* Blow away the admistrative directory associated with DIR_ABSPATH.
140 For single-db this doesn't perform actual work unless the wcroot is passed.
142 svn_error_t *svn_wc__adm_destroy(svn_wc__db_t *db,
143 const char *dir_abspath,
144 svn_cancel_func_t cancel_func,
146 apr_pool_t *scratch_pool);
149 /* Cleanup the temporary storage area of the administrative
150 directory (assuming temp and admin areas exist). */
152 svn_wc__adm_cleanup_tmp_area(svn_wc__db_t *db,
153 const char *adm_abspath,
154 apr_pool_t *scratch_pool);
159 #endif /* __cplusplus */
161 #endif /* SVN_LIBSVN_WC_ADM_FILES_H */