Skip a test when run against old servers.
[svn.git] / subversion / libsvn_ra / ra_loader.h
blob29968d97845664020dd4b6fc11bdfbf1dcb66ad9
1 /**
2 * @copyright
3 * ====================================================================
4 * Copyright (c) 2005-2008 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 * ====================================================================
16 * @endcopyright
18 * @file ra_loader.h
19 * @brief structures related to repository access, private to libsvn_ra and the
20 * RA implementation libraries.
25 #ifndef LIBSVN_RA_RA_LOADER_H
26 #define LIBSVN_RA_RA_LOADER_H
28 #include "svn_ra.h"
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 /* The RA layer vtable. */
35 typedef struct svn_ra__vtable_t {
36 /* This field should always remain first in the vtable. */
37 const svn_version_t *(*get_version)(void);
39 /* Return a short description of the RA implementation, as a localized
40 * string. */
41 const char *(*get_description)(void);
43 /* Return a list of actual URI schemes supported by this implementation.
44 * The returned array is NULL-terminated. */
45 const char * const *(*get_schemes)(apr_pool_t *pool);
47 /* Implementations of the public API functions. */
49 /* All fields in SESSION, except priv, have been initialized by the
50 time this is called. SESSION->priv may be set by this function. */
51 svn_error_t *(*open_session)(svn_ra_session_t *session,
52 const char *repos_URL,
53 const svn_ra_callbacks2_t *callbacks,
54 void *callback_baton,
55 apr_hash_t *config,
56 apr_pool_t *pool);
57 /* URL is guaranteed to have what get_repos_root() returns as a prefix. */
58 svn_error_t *(*reparent)(svn_ra_session_t *session,
59 const char *url,
60 apr_pool_t *pool);
61 svn_error_t *(*get_session_url)(svn_ra_session_t *session,
62 const char **url,
63 apr_pool_t *pool);
64 svn_error_t *(*get_latest_revnum)(svn_ra_session_t *session,
65 svn_revnum_t *latest_revnum,
66 apr_pool_t *pool);
67 svn_error_t *(*get_dated_revision)(svn_ra_session_t *session,
68 svn_revnum_t *revision,
69 apr_time_t tm,
70 apr_pool_t *pool);
71 svn_error_t *(*change_rev_prop)(svn_ra_session_t *session,
72 svn_revnum_t rev,
73 const char *name,
74 const svn_string_t *value,
75 apr_pool_t *pool);
77 svn_error_t *(*rev_proplist)(svn_ra_session_t *session,
78 svn_revnum_t rev,
79 apr_hash_t **props,
80 apr_pool_t *pool);
81 svn_error_t *(*rev_prop)(svn_ra_session_t *session,
82 svn_revnum_t rev,
83 const char *name,
84 svn_string_t **value,
85 apr_pool_t *pool);
86 svn_error_t *(*get_commit_editor)(svn_ra_session_t *session,
87 const svn_delta_editor_t **editor,
88 void **edit_baton,
89 apr_hash_t *revprop_table,
90 svn_commit_callback2_t callback,
91 void *callback_baton,
92 apr_hash_t *lock_tokens,
93 svn_boolean_t keep_locks,
94 apr_pool_t *pool);
95 svn_error_t *(*get_file)(svn_ra_session_t *session,
96 const char *path,
97 svn_revnum_t revision,
98 svn_stream_t *stream,
99 svn_revnum_t *fetched_rev,
100 apr_hash_t **props,
101 apr_pool_t *pool);
102 svn_error_t *(*get_dir)(svn_ra_session_t *session,
103 apr_hash_t **dirents,
104 svn_revnum_t *fetched_rev,
105 apr_hash_t **props,
106 const char *path,
107 svn_revnum_t revision,
108 apr_uint32_t dirent_fields,
109 apr_pool_t *pool);
110 svn_error_t *(*get_mergeinfo)(svn_ra_session_t *session,
111 svn_mergeinfo_catalog_t *mergeinfo,
112 const apr_array_header_t *paths,
113 svn_revnum_t revision,
114 svn_mergeinfo_inheritance_t inherit,
115 svn_boolean_t include_merged_revisions,
116 apr_pool_t *pool);
117 svn_error_t *(*do_update)(svn_ra_session_t *session,
118 const svn_ra_reporter3_t **reporter,
119 void **report_baton,
120 svn_revnum_t revision_to_update_to,
121 const char *update_target,
122 svn_depth_t depth,
123 svn_boolean_t send_copyfrom_args,
124 const svn_delta_editor_t *update_editor,
125 void *update_baton,
126 apr_pool_t *pool);
127 svn_error_t *(*do_switch)(svn_ra_session_t *session,
128 const svn_ra_reporter3_t **reporter,
129 void **report_baton,
130 svn_revnum_t revision_to_switch_to,
131 const char *switch_target,
132 svn_depth_t depth,
133 const char *switch_url,
134 const svn_delta_editor_t *switch_editor,
135 void *switch_baton,
136 apr_pool_t *pool);
137 svn_error_t *(*do_status)(svn_ra_session_t *session,
138 const svn_ra_reporter3_t **reporter,
139 void **report_baton,
140 const char *status_target,
141 svn_revnum_t revision,
142 svn_depth_t depth,
143 const svn_delta_editor_t *status_editor,
144 void *status_baton,
145 apr_pool_t *pool);
146 svn_error_t *(*do_diff)(svn_ra_session_t *session,
147 const svn_ra_reporter3_t **reporter,
148 void **report_baton,
149 svn_revnum_t revision,
150 const char *diff_target,
151 svn_depth_t depth,
152 svn_boolean_t ignore_ancestry,
153 svn_boolean_t text_deltas,
154 const char *versus_url,
155 const svn_delta_editor_t *diff_editor,
156 void *diff_baton,
157 apr_pool_t *pool);
158 svn_error_t *(*get_log)(svn_ra_session_t *session,
159 const apr_array_header_t *paths,
160 svn_revnum_t start,
161 svn_revnum_t end,
162 int limit,
163 svn_boolean_t discover_changed_paths,
164 svn_boolean_t strict_node_history,
165 svn_boolean_t include_merged_revisions,
166 const apr_array_header_t *revprops,
167 svn_log_entry_receiver_t receiver,
168 void *receiver_baton,
169 apr_pool_t *pool);
170 svn_error_t *(*check_path)(svn_ra_session_t *session,
171 const char *path,
172 svn_revnum_t revision,
173 svn_node_kind_t *kind,
174 apr_pool_t *pool);
175 svn_error_t *(*stat)(svn_ra_session_t *session,
176 const char *path,
177 svn_revnum_t revision,
178 svn_dirent_t **dirent,
179 apr_pool_t *pool);
180 svn_error_t *(*get_uuid)(svn_ra_session_t *session,
181 const char **uuid,
182 apr_pool_t *pool);
183 svn_error_t *(*get_repos_root)(svn_ra_session_t *session,
184 const char **url,
185 apr_pool_t *pool);
186 svn_error_t *(*get_locations)(svn_ra_session_t *session,
187 apr_hash_t **locations,
188 const char *path,
189 svn_revnum_t peg_revision,
190 apr_array_header_t *location_revisions,
191 apr_pool_t *pool);
192 svn_error_t *(*get_location_segments)(svn_ra_session_t *session,
193 const char *path,
194 svn_revnum_t peg_revision,
195 svn_revnum_t start_rev,
196 svn_revnum_t end_rev,
197 svn_location_segment_receiver_t rcvr,
198 void *receiver_baton,
199 apr_pool_t *pool);
200 svn_error_t *(*get_file_revs)(svn_ra_session_t *session,
201 const char *path,
202 svn_revnum_t start,
203 svn_revnum_t end,
204 svn_boolean_t include_merged_revisions,
205 svn_file_rev_handler_t handler,
206 void *handler_baton,
207 apr_pool_t *pool);
208 svn_error_t *(*lock)(svn_ra_session_t *session,
209 apr_hash_t *path_revs,
210 const char *comment,
211 svn_boolean_t force,
212 svn_ra_lock_callback_t lock_func,
213 void *lock_baton,
214 apr_pool_t *pool);
215 svn_error_t *(*unlock)(svn_ra_session_t *session,
216 apr_hash_t *path_tokens,
217 svn_boolean_t force,
218 svn_ra_lock_callback_t lock_func,
219 void *lock_baton,
220 apr_pool_t *pool);
221 svn_error_t *(*get_lock)(svn_ra_session_t *session,
222 svn_lock_t **lock,
223 const char *path,
224 apr_pool_t *pool);
225 svn_error_t *(*get_locks)(svn_ra_session_t *session,
226 apr_hash_t **locks,
227 const char *path,
228 apr_pool_t *pool);
229 svn_error_t *(*replay)(svn_ra_session_t *session,
230 svn_revnum_t revision,
231 svn_revnum_t low_water_mark,
232 svn_boolean_t text_deltas,
233 const svn_delta_editor_t *editor,
234 void *edit_baton,
235 apr_pool_t *pool);
236 svn_error_t *(*has_capability)(svn_ra_session_t *session,
237 svn_boolean_t *has,
238 const char *capability,
239 apr_pool_t *pool);
240 svn_error_t *
241 (*replay_range)(svn_ra_session_t *session,
242 svn_revnum_t start_revision,
243 svn_revnum_t end_revision,
244 svn_revnum_t low_water_mark,
245 svn_boolean_t text_deltas,
246 svn_ra_replay_revstart_callback_t revstart_func,
247 svn_ra_replay_revfinish_callback_t revfinish_func,
248 void *replay_baton,
249 apr_pool_t *pool);
250 } svn_ra__vtable_t;
252 /* The RA session object. */
253 struct svn_ra_session_t {
254 const svn_ra__vtable_t *vtable;
256 /* Pool used to manage this session. */
257 apr_pool_t *pool;
259 /* Private data for the RA implementation. */
260 void *priv;
263 /* Each libsvn_ra_foo defines a function named svn_ra_foo__init of this type.
265 * The LOADER_VERSION parameter must remain first in the list, and the
266 * function must use the C calling convention on all platforms, so that
267 * the init functions can safely read the version parameter.
269 * POOL will be available as long as this module is being used.
271 * ### need to force this to be __cdecl on Windows... how??
273 typedef svn_error_t *
274 (*svn_ra__init_func_t)(const svn_version_t *loader_version,
275 const svn_ra__vtable_t **vtable,
276 apr_pool_t *pool);
278 /* Declarations of the init functions for the available RA libraries. */
279 svn_error_t *svn_ra_local__init(const svn_version_t *loader_version,
280 const svn_ra__vtable_t **vtable,
281 apr_pool_t *pool);
282 svn_error_t *svn_ra_svn__init(const svn_version_t *loader_version,
283 const svn_ra__vtable_t **vtable,
284 apr_pool_t *pool);
285 svn_error_t *svn_ra_neon__init(const svn_version_t *loader_version,
286 const svn_ra__vtable_t **vtable,
287 apr_pool_t *pool);
288 svn_error_t *svn_ra_serf__init(const svn_version_t *loader_version,
289 const svn_ra__vtable_t **vtable,
290 apr_pool_t *pool);
294 /*** Compat Functions ***/
297 * Set *LOCATIONS to the locations (at the repository revisions
298 * LOCATION_REVISIONS) of the file identified by PATH in PEG_REVISION.
299 * PATH is relative to the URL to which SESSION was opened.
300 * LOCATION_REVISIONS is an array of svn_revnum_t's. *LOCATIONS will
301 * be a mapping from the revisions to their appropriate absolute
302 * paths. If the file doesn't exist in a location_revision, that
303 * revision will be ignored.
305 * Use POOL for all allocations.
307 * NOTE: This function uses the RA get_log interfaces to do its work,
308 * as a fallback mechanism for servers which don't support the native
309 * get_locations API.
311 svn_error_t *
312 svn_ra__locations_from_log(svn_ra_session_t *session,
313 apr_hash_t **locations_p,
314 const char *path,
315 svn_revnum_t peg_revision,
316 apr_array_header_t *location_revisions,
317 apr_pool_t *pool);
320 * Call RECEIVER (with RECEIVER_BATON) for each segment in the
321 * location history of PATH in START_REV, working backwards in time
322 * from START_REV to END_REV.
324 * END_REV may be SVN_INVALID_REVNUM to indicate that you want to
325 * trace the history of the object to its origin.
327 * START_REV may be SVN_INVALID_REVNUM to indicate that you want to
328 * trace the history of the object beginning in the HEAD revision.
329 * Otherwise, START_REV must be younger than END_REV (unless END_REV
330 * is SVN_INVALID_REVNUM).
332 * Use POOL for all allocations.
334 * NOTE: This function uses the RA get_log interfaces to do its work,
335 * as a fallback mechanism for servers which don't support the native
336 * get_location_segments API.
338 svn_error_t *
339 svn_ra__location_segments_from_log(svn_ra_session_t *session,
340 const char *path,
341 svn_revnum_t peg_revision,
342 svn_revnum_t start_rev,
343 svn_revnum_t end_rev,
344 svn_location_segment_receiver_t receiver,
345 void *receiver_baton,
346 apr_pool_t *pool);
349 * Retrieve a subset of the interesting revisions of a file PATH
350 * as seen in revision END (see svn_fs_history_prev() for a
351 * definition of "interesting revisions"). Invoke HANDLER with
352 * @a handler_baton as its first argument for each such revision.
353 * @a session is an open RA session. Use POOL for all allocations.
355 * If there is an interesting revision of the file that is less than or
356 * equal to START, the iteration will begin at that revision.
357 * Else, the iteration will begin at the first revision of the file in
358 * the repository, which has to be less than or equal to END. Note
359 * that if the function succeeds, HANDLER will have been called at
360 * least once.
362 * In a series of calls to HANDLER, the file contents for the first
363 * interesting revision will be provided as a text delta against the
364 * empty file. In the following calls, the delta will be against the
365 * fulltext contents for the previous call.
367 * NOTE: This function uses the RA get_log interfaces to do its work,
368 * as a fallback mechanism for servers which don't support the native
369 * get_location_segments API.
371 svn_error_t *
372 svn_ra__file_revs_from_log(svn_ra_session_t *session,
373 const char *path,
374 svn_revnum_t start,
375 svn_revnum_t end,
376 svn_file_rev_handler_t handler,
377 void *handler_baton,
378 apr_pool_t *pool);
380 #ifdef __cplusplus
382 #endif
384 #endif