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 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at http://subversion.tigris.org/license-1.html.
13 * If newer versions of this license are posted there, you may use a
14 * newer version instead, at your option.
16 * This software consists of voluntary contributions made by many
17 * individuals. For exact contribution history, see the revision
18 * history and logs, available at http://subversion.tigris.org/.
19 * ====================================================================
23 #ifndef SVN_LIBSVN_WC_ADM_FILES_H
24 #define SVN_LIBSVN_WC_ADM_FILES_H
26 #include <apr_pools.h>
27 #include "svn_types.h"
33 #endif /* __cplusplus */
37 /* Return a path to something in PATH's administrative area.
38 * Return path to the thing in the tmp area if TMP is non-zero.
39 * Varargs are (const char *)'s, the final one must be NULL.
41 const char * svn_wc__adm_path(const char *path
,
47 /* Return TRUE if a thing in the administrative area exists, FALSE
49 svn_boolean_t
svn_wc__adm_path_exists(const char *path
,
55 /* Make `PATH/<adminstrative_subdir>/THING'. */
56 svn_error_t
*svn_wc__make_adm_thing(svn_wc_adm_access_t
*adm_access
,
59 apr_fileperms_t perms
,
63 /* Create a killme file in the administrative area, indicating that the
64 directory containing the administrative area should be removed.
66 If ADM_ONLY is true then remove only the administrative areas for the
67 directory and subdirectories. */
68 svn_error_t
*svn_wc__make_killme(svn_wc_adm_access_t
*adm_access
,
69 svn_boolean_t adm_only
,
72 /* Set EXISTS to TRUE if a killme file exists in the administrative area,
75 If EXISTS is true, set KILL_ADM_ONLY to the value passed to
76 svn_wc__make_killme() above. */
77 svn_error_t
*svn_wc__check_killme(svn_wc_adm_access_t
*adm_access
,
78 svn_boolean_t
*exists
,
79 svn_boolean_t
*kill_adm_only
,
82 /* Atomically rename a temporary text-base file to its canonical
83 location. The tmp file should be closed already. */
85 svn_wc__sync_text_base(const char *path
, apr_pool_t
*pool
);
88 /* Return a path to PATH's text-base file.
89 If TMP is set, return a path to the tmp text-base file. */
90 const char *svn_wc__text_base_path(const char *path
,
95 /* Return a path to PATH's revert file.
96 If TMP is set, return a path to the tmp revert file. */
98 svn_wc__text_revert_path(const char *path
,
103 /* Set *PROP_PATH to PATH's PROPS_KIND properties file.
104 If TMP is set, return a path to the tmp working property file.
105 PATH can be a directory or file, and even have changed w.r.t. the
106 working copy's adm knowledge. Valid values for NODE_KIND are svn_node_dir
107 and svn_node_file. */
108 svn_error_t
*svn_wc__prop_path(const char **prop_path
,
110 svn_node_kind_t node_kind
,
111 svn_wc__props_kind_t props_kind
,
117 /*** Opening all kinds of adm files ***/
119 /* Yo, read this if you open and close files in the adm area:
121 * When you open a file for writing with svn_wc__open_foo(), the file
122 * is actually opened in the corresponding location in the tmp/
123 * directory. Opening with APR_APPEND is not supported. You are
124 * guaranteed to be the owner of the new file.
126 * Somehow, this tmp file must eventually get renamed to its real
127 * destination in the adm area. You can do it either by passing the
128 * SYNC flag to svn_wc__close_foo(), or by calling
129 * svn_wc__sync_foo() (though of course you should still have
130 * called svn_wc__close_foo() first, just without the SYNC flag).
132 * In other words, the adm area is only capable of modifying files
133 * atomically, but you get some control over when the rename happens.
136 /* Open `PATH/<adminstrative_subdir>/FNAME'. */
137 svn_error_t
*svn_wc__open_adm_file(apr_file_t
**handle
,
144 /* Close `PATH/<adminstrative_subdir>/FNAME'. */
145 svn_error_t
*svn_wc__close_adm_file(apr_file_t
*fp
,
151 /* Remove `PATH/<adminstrative_subdir>/THING'. */
152 svn_error_t
*svn_wc__remove_adm_file(const char *path
,
156 /* Open the text-base for FILE.
157 * FILE can be any kind of path ending with a filename.
158 * Behaves like svn_wc__open_adm_file(), which see.
160 svn_error_t
*svn_wc__open_text_base(apr_file_t
**handle
,
165 /* Open the revert-base for FILE.
166 * FILE can be any kind of path ending with a filename.
167 * Behaves like svn_wc__open_adm_file(), which see.
169 svn_error_t
*svn_wc__open_revert_base(apr_file_t
**handle
,
174 /* Close the text-base for FILE.
175 * FP was obtained from svn_wc__open_text_base().
176 * Behaves like svn_wc__close_adm_file(), which see.
178 svn_error_t
*svn_wc__close_text_base(apr_file_t
*fp
,
183 /* Close the revert-base for FILE.
184 * FP was obtained from svn_wc__open_revert_base().
185 * Behaves like svn_wc__close_adm_file(), which see.
187 svn_error_t
*svn_wc__close_revert_base(apr_file_t
*fp
,
192 /* Open the property file for PATH.
193 * PATH can be any kind of path, either file or dir.
195 * If BASE is set, then the "pristine" property file will be opened.
196 * If WCPROPS is set, then the "wc" property file will be opened.
198 * (Don't set BASE and WCPROPS at the same time; this is meaningless.)
200 svn_error_t
*svn_wc__open_props(apr_file_t
**handle
,
202 svn_node_kind_t kind
,
205 svn_boolean_t wcprops
,
208 /* Close the property file for PATH.
209 * FP was obtained from svn_wc__open_props().
211 * The BASE and WCPROPS must have the same state used to open the file!
213 * Like svn_wc__close_adm_file(), SYNC indicates the file should be
214 * atomically written.
216 svn_error_t
*svn_wc__close_props(apr_file_t
*fp
,
218 svn_node_kind_t kind
,
220 svn_boolean_t wcprops
,
225 /* Blow away the admistrative directory associated with the access baton
226 ADM_ACCESS. This closes ADM_ACCESS, but it is safe to close ADM_ACCESS
227 again, after calling this function. */
228 svn_error_t
*svn_wc__adm_destroy(svn_wc_adm_access_t
*adm_access
,
232 /* Cleanup the temporary storage area of the administrative
234 svn_error_t
*svn_wc__adm_cleanup_tmp_area(svn_wc_adm_access_t
*adm_access
,
240 #endif /* __cplusplus */
242 #endif /* SVN_LIBSVN_WC_ADM_FILES_H */