Change the format of the revprops block sent in svnserve for
[svn.git] / subversion / libsvn_wc / adm_files.h
blob8676bedd638c70ce92b735e857ec98ff7e466958
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.)
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"
29 #include "props.h"
31 #ifdef __cplusplus
32 extern "C" {
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,
42 svn_boolean_t tmp,
43 apr_pool_t *pool,
44 ...);
47 /* Return TRUE if a thing in the administrative area exists, FALSE
48 otherwise. */
49 svn_boolean_t svn_wc__adm_path_exists(const char *path,
50 svn_boolean_t tmp,
51 apr_pool_t *pool,
52 ...);
55 /* Make `PATH/<adminstrative_subdir>/THING'. */
56 svn_error_t *svn_wc__make_adm_thing(svn_wc_adm_access_t *adm_access,
57 const char *thing,
58 svn_node_kind_t type,
59 apr_fileperms_t perms,
60 svn_boolean_t tmp,
61 apr_pool_t *pool);
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,
70 apr_pool_t *pool);
72 /* Set EXISTS to TRUE if a killme file exists in the administrative area,
73 FALSE otherwise.
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,
80 apr_pool_t *pool);
82 /* Atomically rename a temporary text-base file to its canonical
83 location. The tmp file should be closed already. */
84 svn_error_t *
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,
91 svn_boolean_t tmp,
92 apr_pool_t *pool);
95 /* Return a path to PATH's revert file.
96 If TMP is set, return a path to the tmp revert file. */
97 const char *
98 svn_wc__text_revert_path(const char *path,
99 svn_boolean_t tmp,
100 apr_pool_t *pool);
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,
109 const char *path,
110 svn_node_kind_t node_kind,
111 svn_wc__props_kind_t props_kind,
112 svn_boolean_t tmp,
113 apr_pool_t *pool);
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,
138 const char *path,
139 const char *fname,
140 apr_int32_t flags,
141 apr_pool_t *pool);
144 /* Close `PATH/<adminstrative_subdir>/FNAME'. */
145 svn_error_t *svn_wc__close_adm_file(apr_file_t *fp,
146 const char *path,
147 const char *fname,
148 int sync,
149 apr_pool_t *pool);
151 /* Remove `PATH/<adminstrative_subdir>/THING'. */
152 svn_error_t *svn_wc__remove_adm_file(const char *path,
153 apr_pool_t *pool,
154 ...);
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,
161 const char *file,
162 apr_int32_t flags,
163 apr_pool_t *pool);
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,
170 const char *file,
171 apr_int32_t flags,
172 apr_pool_t *pool);
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,
179 const char *file,
180 int sync,
181 apr_pool_t *pool);
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,
188 const char *file,
189 int sync,
190 apr_pool_t *pool);
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,
201 const char *path,
202 svn_node_kind_t kind,
203 apr_int32_t flags,
204 svn_boolean_t base,
205 svn_boolean_t wcprops,
206 apr_pool_t *pool);
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,
217 const char *path,
218 svn_node_kind_t kind,
219 svn_boolean_t base,
220 svn_boolean_t wcprops,
221 int sync,
222 apr_pool_t *pool);
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,
229 apr_pool_t *pool);
232 /* Cleanup the temporary storage area of the administrative
233 directory. */
234 svn_error_t *svn_wc__adm_cleanup_tmp_area(svn_wc_adm_access_t *adm_access,
235 apr_pool_t *pool);
238 #ifdef __cplusplus
240 #endif /* __cplusplus */
242 #endif /* SVN_LIBSVN_WC_ADM_FILES_H */