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 * ====================================================================
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
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
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
,
57 /* URL is guaranteed to have what get_repos_root() returns as a prefix. */
58 svn_error_t
*(*reparent
)(svn_ra_session_t
*session
,
61 svn_error_t
*(*get_session_url
)(svn_ra_session_t
*session
,
64 svn_error_t
*(*get_latest_revnum
)(svn_ra_session_t
*session
,
65 svn_revnum_t
*latest_revnum
,
67 svn_error_t
*(*get_dated_revision
)(svn_ra_session_t
*session
,
68 svn_revnum_t
*revision
,
71 svn_error_t
*(*change_rev_prop
)(svn_ra_session_t
*session
,
74 const svn_string_t
*value
,
77 svn_error_t
*(*rev_proplist
)(svn_ra_session_t
*session
,
81 svn_error_t
*(*rev_prop
)(svn_ra_session_t
*session
,
86 svn_error_t
*(*get_commit_editor
)(svn_ra_session_t
*session
,
87 const svn_delta_editor_t
**editor
,
89 apr_hash_t
*revprop_table
,
90 svn_commit_callback2_t callback
,
92 apr_hash_t
*lock_tokens
,
93 svn_boolean_t keep_locks
,
95 svn_error_t
*(*get_file
)(svn_ra_session_t
*session
,
97 svn_revnum_t revision
,
99 svn_revnum_t
*fetched_rev
,
102 svn_error_t
*(*get_dir
)(svn_ra_session_t
*session
,
103 apr_hash_t
**dirents
,
104 svn_revnum_t
*fetched_rev
,
107 svn_revnum_t revision
,
108 apr_uint32_t dirent_fields
,
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
,
117 svn_error_t
*(*do_update
)(svn_ra_session_t
*session
,
118 const svn_ra_reporter3_t
**reporter
,
120 svn_revnum_t revision_to_update_to
,
121 const char *update_target
,
123 svn_boolean_t send_copyfrom_args
,
124 const svn_delta_editor_t
*update_editor
,
127 svn_error_t
*(*do_switch
)(svn_ra_session_t
*session
,
128 const svn_ra_reporter3_t
**reporter
,
130 svn_revnum_t revision_to_switch_to
,
131 const char *switch_target
,
133 const char *switch_url
,
134 const svn_delta_editor_t
*switch_editor
,
137 svn_error_t
*(*do_status
)(svn_ra_session_t
*session
,
138 const svn_ra_reporter3_t
**reporter
,
140 const char *status_target
,
141 svn_revnum_t revision
,
143 const svn_delta_editor_t
*status_editor
,
146 svn_error_t
*(*do_diff
)(svn_ra_session_t
*session
,
147 const svn_ra_reporter3_t
**reporter
,
149 svn_revnum_t revision
,
150 const char *diff_target
,
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
,
158 svn_error_t
*(*get_log
)(svn_ra_session_t
*session
,
159 const apr_array_header_t
*paths
,
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
,
170 svn_error_t
*(*check_path
)(svn_ra_session_t
*session
,
172 svn_revnum_t revision
,
173 svn_node_kind_t
*kind
,
175 svn_error_t
*(*stat
)(svn_ra_session_t
*session
,
177 svn_revnum_t revision
,
178 svn_dirent_t
**dirent
,
180 svn_error_t
*(*get_uuid
)(svn_ra_session_t
*session
,
183 svn_error_t
*(*get_repos_root
)(svn_ra_session_t
*session
,
186 svn_error_t
*(*get_locations
)(svn_ra_session_t
*session
,
187 apr_hash_t
**locations
,
189 svn_revnum_t peg_revision
,
190 apr_array_header_t
*location_revisions
,
192 svn_error_t
*(*get_location_segments
)(svn_ra_session_t
*session
,
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
,
200 svn_error_t
*(*get_file_revs
)(svn_ra_session_t
*session
,
204 svn_boolean_t include_merged_revisions
,
205 svn_file_rev_handler_t handler
,
208 svn_error_t
*(*lock
)(svn_ra_session_t
*session
,
209 apr_hash_t
*path_revs
,
212 svn_ra_lock_callback_t lock_func
,
215 svn_error_t
*(*unlock
)(svn_ra_session_t
*session
,
216 apr_hash_t
*path_tokens
,
218 svn_ra_lock_callback_t lock_func
,
221 svn_error_t
*(*get_lock
)(svn_ra_session_t
*session
,
225 svn_error_t
*(*get_locks
)(svn_ra_session_t
*session
,
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
,
236 svn_error_t
*(*has_capability
)(svn_ra_session_t
*session
,
238 const char *capability
,
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
,
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. */
259 /* Private data for the RA implementation. */
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
,
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
,
282 svn_error_t
*svn_ra_svn__init(const svn_version_t
*loader_version
,
283 const svn_ra__vtable_t
**vtable
,
285 svn_error_t
*svn_ra_neon__init(const svn_version_t
*loader_version
,
286 const svn_ra__vtable_t
**vtable
,
288 svn_error_t
*svn_ra_serf__init(const svn_version_t
*loader_version
,
289 const svn_ra__vtable_t
**vtable
,
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
312 svn_ra__locations_from_log(svn_ra_session_t
*session
,
313 apr_hash_t
**locations_p
,
315 svn_revnum_t peg_revision
,
316 apr_array_header_t
*location_revisions
,
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.
339 svn_ra__location_segments_from_log(svn_ra_session_t
*session
,
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
,
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
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.
372 svn_ra__file_revs_from_log(svn_ra_session_t
*session
,
376 svn_file_rev_handler_t handler
,