Change the format of the revprops block sent in svnserve for
[svn.git] / subversion / libsvn_repos / repos.h
blob83eaa69a676f5b180fddc52ad16f0e67ac6fe463
1 /* repos.h : interface to Subversion repository, private to libsvn_repos
3 * ====================================================================
4 * Copyright (c) 2000-2007 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
18 #ifndef SVN_LIBSVN_REPOS_H
19 #define SVN_LIBSVN_REPOS_H
21 #include <apr_pools.h>
22 #include <apr_hash.h>
24 #include "svn_fs.h"
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
31 /* Repository format number.
33 Formats 0, 1 and 2 were pre-1.0.
35 Format 3 was current for 1.0 through to 1.3.
37 Format 4 was an abortive experiment during the development of the
38 locking feature in the lead up to 1.2.
40 Format 5 was new in 1.4, and is the first format which may contain
41 BDB or FSFS filesystems with a FS format other than 1, since prior
42 formats are accepted by some versions of Subversion which do not
43 pay attention to the FS format number.
45 #define SVN_REPOS__FORMAT_NUMBER 5
46 #define SVN_REPOS__FORMAT_NUMBER_LEGACY 3
49 /*** Repository layout. ***/
51 /* The top-level repository dir contains a README and various
52 subdirectories. */
53 #define SVN_REPOS__README "README.txt" /* Explanation for trespassers. */
54 #define SVN_REPOS__FORMAT "format" /* Stores the current version
55 of the repository. */
56 #define SVN_REPOS__DB_DIR "db" /* Where Berkeley lives. */
57 #define SVN_REPOS__DAV_DIR "dav" /* DAV sandbox, for pre-1.5 */
58 #define SVN_REPOS__LOCK_DIR "locks" /* Lock files live here. */
59 #define SVN_REPOS__HOOK_DIR "hooks" /* Hook programs. */
60 #define SVN_REPOS__CONF_DIR "conf" /* Configuration files. */
62 /* Things for which we keep lockfiles. */
63 #define SVN_REPOS__DB_LOCKFILE "db.lock" /* Our Berkeley lockfile. */
64 #define SVN_REPOS__DB_LOGS_LOCKFILE "db-logs.lock" /* BDB logs lockfile. */
66 /* In the repository hooks directory, look for these files. */
67 #define SVN_REPOS__HOOK_START_COMMIT "start-commit"
68 #define SVN_REPOS__HOOK_PRE_COMMIT "pre-commit"
69 #define SVN_REPOS__HOOK_POST_COMMIT "post-commit"
70 #define SVN_REPOS__HOOK_READ_SENTINEL "read-sentinels"
71 #define SVN_REPOS__HOOK_WRITE_SENTINEL "write-sentinels"
72 #define SVN_REPOS__HOOK_PRE_REVPROP_CHANGE "pre-revprop-change"
73 #define SVN_REPOS__HOOK_POST_REVPROP_CHANGE "post-revprop-change"
74 #define SVN_REPOS__HOOK_PRE_LOCK "pre-lock"
75 #define SVN_REPOS__HOOK_POST_LOCK "post-lock"
76 #define SVN_REPOS__HOOK_PRE_UNLOCK "pre-unlock"
77 #define SVN_REPOS__HOOK_POST_UNLOCK "post-unlock"
80 /* The extension added to the names of example hook scripts. */
81 #define SVN_REPOS__HOOK_DESC_EXT ".tmpl"
84 /* The configuration file for svnserve, in the repository conf directory. */
85 #define SVN_REPOS__CONF_SVNSERVE_CONF "svnserve.conf"
87 /* In the svnserve default configuration, these are the suggested
88 locations for the passwd and authz files (in the repository conf
89 directory), and we put example templates there. */
90 #define SVN_REPOS__CONF_PASSWD "passwd"
91 #define SVN_REPOS__CONF_AUTHZ "authz"
93 /* The Repository object, created by svn_repos_open() and
94 svn_repos_create(). */
95 struct svn_repos_t
97 /* A Subversion filesystem object. */
98 svn_fs_t *fs;
100 /* The path to the repository's top-level directory. */
101 char *path;
103 /* The path to the repository's conf directory. */
104 char *conf_path;
106 /* The path to the repository's hooks directory. */
107 char *hook_path;
109 /* The path to the repository's locks directory. */
110 char *lock_path;
112 /* The path to the Berkeley DB filesystem environment. */
113 char *db_path;
115 /* The format number of this repository. */
116 int format;
118 /* The FS backend in use within this repository. */
119 const char *fs_type;
121 /* If non-null, a list of all the capabilities the client (on the
122 current connection) has self-reported. Each element is a
123 'const char *', one of SVN_RA_CAPABILITY_*.
125 Note: it is somewhat counterintuitive that we store the client's
126 capabilities, which are session-specific, on the repository
127 object. You'd think the capabilities here would represent the
128 *repository's* capabilities, but no, they represent the
129 client's -- we just don't have any other place to persist them. */
130 apr_array_header_t *client_capabilities;
132 /* Maps SVN_REPOS_CAPABILITY_foo keys to "yes" or "no" values.
133 If a capability is not yet discovered, it is absent from the table.
134 Most likely the keys and values are constants anyway (and
135 sufficiently well-informed internal code may just compare against
136 those constants' addresses, therefore). */
137 apr_hash_t *repository_capabilities;
141 /*** Hook-running Functions ***/
143 /* Run the start-commit hook for REPOS. Use POOL for any temporary
144 allocations. If the hook fails, return SVN_ERR_REPOS_HOOK_FAILURE.
146 USER is the authenticated name of the user starting the commit.
147 CAPABILITIES is a list of 'const char *' capability names (using
148 SVN_RA_CAPABILITY_*) that the client has self-reported. Note that
149 there is no guarantee the client is telling the truth: the hook
150 should not make security assumptions based on the capabilities. */
151 svn_error_t *
152 svn_repos__hooks_start_commit(svn_repos_t *repos,
153 const char *user,
154 apr_array_header_t *capabilities,
155 apr_pool_t *pool);
157 /* Run the pre-commit hook for REPOS. Use POOL for any temporary
158 allocations. If the hook fails, return SVN_ERR_REPOS_HOOK_FAILURE.
160 TXN_NAME is the name of the transaction that is being committed. */
161 svn_error_t *
162 svn_repos__hooks_pre_commit(svn_repos_t *repos,
163 const char *txn_name,
164 apr_pool_t *pool);
166 /* Run the post-commit hook for REPOS. Use POOL for any temporary
167 allocations. If the hook fails, run SVN_ERR_REPOS_HOOK_FAILURE.
169 REV is the revision that was created as a result of the commit. */
170 svn_error_t *
171 svn_repos__hooks_post_commit(svn_repos_t *repos,
172 svn_revnum_t rev,
173 apr_pool_t *pool);
175 /* Run the pre-revprop-change hook for REPOS. Use POOL for any
176 temporary allocations. If the hook fails, return
177 SVN_ERR_REPOS_HOOK_FAILURE.
179 REV is the revision whose property is being changed.
180 AUTHOR is the authenticated name of the user changing the prop.
181 NAME is the name of the property being changed.
182 NEW_VALUE is the new value of the property.
183 ACTION is indicates if the property is being 'A'dded, 'M'odified,
184 or 'D'eleted.
186 The pre-revprop-change hook will have the new property value
187 written to its stdin. If the property is being deleted, no data
188 will be written. */
189 svn_error_t *
190 svn_repos__hooks_pre_revprop_change(svn_repos_t *repos,
191 svn_revnum_t rev,
192 const char *author,
193 const char *name,
194 const svn_string_t *new_value,
195 char action,
196 apr_pool_t *pool);
198 /* Run the pre-revprop-change hook for REPOS. Use POOL for any
199 temporary allocations. If the hook fails, return
200 SVN_ERR_REPOS_HOOK_FAILURE.
202 REV is the revision whose property was changed.
203 AUTHOR is the authenticated name of the user who changed the prop.
204 NAME is the name of the property that was changed, and OLD_VALUE is
205 that property's value immediately before the change, or null if
206 none. ACTION indicates if the property was 'A'dded, 'M'odified,
207 or 'D'eleted.
209 The old value will be passed to the post-revprop hook on stdin. If
210 the property is being created, no data will be written. */
211 svn_error_t *
212 svn_repos__hooks_post_revprop_change(svn_repos_t *repos,
213 svn_revnum_t rev,
214 const char *author,
215 const char *name,
216 svn_string_t *old_value,
217 char action,
218 apr_pool_t *pool);
220 /* Run the pre-lock hook for REPOS. Use POOL for any temporary
221 allocations. If the hook fails, return SVN_ERR_REPOS_HOOK_FAILURE.
223 PATH is the path being locked, USERNAME is the person doing it. */
224 svn_error_t *
225 svn_repos__hooks_pre_lock(svn_repos_t *repos,
226 const char *path,
227 const char *username,
228 apr_pool_t *pool);
230 /* Run the post-lock hook for REPOS. Use POOL for any temporary
231 allocations. If the hook fails, return SVN_ERR_REPOS_HOOK_FAILURE.
233 PATHS is an array of paths being locked, USERNAME is the person
234 who did it. */
235 svn_error_t *
236 svn_repos__hooks_post_lock(svn_repos_t *repos,
237 apr_array_header_t *paths,
238 const char *username,
239 apr_pool_t *pool);
241 /* Run the pre-unlock hook for REPOS. Use POOL for any temporary
242 allocations. If the hook fails, return SVN_ERR_REPOS_HOOK_FAILURE.
244 PATH is the path being unlocked, USERNAME is the person doing it. */
245 svn_error_t *
246 svn_repos__hooks_pre_unlock(svn_repos_t *repos,
247 const char *path,
248 const char *username,
249 apr_pool_t *pool);
251 /* Run the post-unlock hook for REPOS. Use POOL for any temporary
252 allocations. If the hook fails, return SVN_ERR_REPOS_HOOK_FAILURE.
254 PATHS is an array of paths being unlocked, USERNAME is the person
255 who did it. */
256 svn_error_t *
257 svn_repos__hooks_post_unlock(svn_repos_t *repos,
258 apr_array_header_t *paths,
259 const char *username,
260 apr_pool_t *pool);
263 /*** Utility Functions ***/
265 /* Set *CHANGED_P to TRUE if ROOT1/PATH1 and ROOT2/PATH2 have
266 different contents, FALSE if they have the same contents.
267 Use POOL for temporary allocation. */
268 svn_error_t *
269 svn_repos__compare_files(svn_boolean_t *changed_p,
270 svn_fs_root_t *root1,
271 const char *path1,
272 svn_fs_root_t *root2,
273 const char *path2,
274 apr_pool_t *pool);
276 #ifdef __cplusplus
278 #endif /* __cplusplus */
280 #endif /* SVN_LIBSVN_REPOS_H */