00001 /**
00002 * @copyright
00003 * ====================================================================
00004 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
00005 *
00006 * This software is licensed as described in the file COPYING, which
00007 * you should have received as part of this distribution. The terms
00008 * are also available at http://subversion.tigris.org/license-1.html.
00009 * If newer versions of this license are posted there, you may use a
00010 * newer version instead, at your option.
00011 *
00012 * This software consists of voluntary contributions made by many
00013 * individuals. For exact contribution history, see the revision
00014 * history and logs, available at http://subversion.tigris.org/.
00015 * ====================================================================
00016 * @endcopyright
00017 *
00018 * @file svn_ra.h
00019 * @brief structures related to repository access
00020 */
00021
00022
00023
00024
00025 #ifndef SVN_RA_H
00026 #define SVN_RA_H
00027
00028 #include <apr_pools.h>
00029 #include <apr_tables.h>
00030
00031 #include "svn_error.h"
00032 #include "svn_delta.h"
00033 #include "svn_auth.h"
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif /* __cplusplus */
00038
00039
00040
00041 /* Misc. declarations */
00042
00043 /**
00044 * Get libsvn_ra version information.
00045 * @since New in 1.1.
00046 */
00047 const svn_version_t *svn_ra_version (void);
00048
00049
00050 /** This is a function type which allows the RA layer to fetch working
00051 * copy (WC) properties.
00052 *
00053 * The @a baton is provided along with the function pointer and should
00054 * be passed back in. This will be the @a callback_baton or the
00055 * @a close_baton as appropriate.
00056 *
00057 * @a path is relative to the "root" of the session, defined by the
00058 * @a repos_url passed to the @c RA->open() vtable call.
00059 *
00060 * @a name is the name of the property to fetch. If the property is present,
00061 * then it is returned in @a value. Otherwise, @a *value is set to @c NULL.
00062 */
00063 typedef svn_error_t *(*svn_ra_get_wc_prop_func_t) (void *baton,
00064 const char *relpath,
00065 const char *name,
00066 const svn_string_t **value,
00067 apr_pool_t *pool);
00068
00069 /** This is a function type which allows the RA layer to store new
00070 * working copy properties during update-like operations. See the
00071 * comments for @c svn_ra_get_wc_prop_func_t for @a baton, @a path, and
00072 * @a name. The @a value is the value that will be stored for the property;
00073 * a null @a value means the property will be deleted.
00074 */
00075 typedef svn_error_t *(*svn_ra_set_wc_prop_func_t) (void *baton,
00076 const char *path,
00077 const char *name,
00078 const svn_string_t *value,
00079 apr_pool_t *pool);
00080
00081 /** This is a function type which allows the RA layer to store new
00082 * working copy properties as part of a commit. See the comments for
00083 * @c svn_ra_get_wc_prop_func_t for @a baton, @a path, and @a name.
00084 * The @a value is the value that will be stored for the property; a
00085 * @c NULL @a value means the property will be deleted.
00086 *
00087 * Note that this might not actually store the new property before
00088 * returning, but instead schedule it to be changed as part of
00089 * post-commit processing (in which case a successful commit means the
00090 * properties got written). Thus, during the commit, it is possible
00091 * to invoke this function to set a new value for a wc prop, then read
00092 * the wc prop back from the working copy and get the *old* value.
00093 * Callers beware.
00094 */
00095 typedef svn_error_t *(*svn_ra_push_wc_prop_func_t) (void *baton,
00096 const char *path,
00097 const char *name,
00098 const svn_string_t *value,
00099 apr_pool_t *pool);
00100
00101 /** This is a function type which allows the RA layer to invalidate
00102 * (i.e., remove) wcprops. See the documentation for
00103 * @c svn_ra_get_wc_prop_func_t for @a baton, @a path, and @a name.
00104 *
00105 * Unlike @c svn_ra_push_wc_prop_func_t, this has immediate effect. If
00106 * it returns success, the wcprops have been removed.
00107 */
00108 typedef svn_error_t *(*svn_ra_invalidate_wc_props_func_t) (void *baton,
00109 const char *path,
00110 const char *name,
00111 apr_pool_t *pool);
00112
00113
00114 /** A function type for retrieving the youngest revision from a repos. */
00115 typedef svn_error_t *(*svn_ra_get_latest_revnum_func_t)
00116 (void *session_baton,
00117 svn_revnum_t *latest_revnum);
00118
00119 /** @since New in 1.1.
00120 * A callback function type for use in @c get_file_revs.
00121 * @a baton is provided by the caller, @a path is the pathname of the file
00122 * in revision @a rev and @a rev_props are the revision properties.
00123 * If @a delta_handler and @a delta_baton are non-NULL, they may be set to a
00124 * handler/baton which will be called with the delta between the previous
00125 * revision and this one after the return of this callback. They may be
00126 * left as NULL/NULL.
00127 * @a prop_diffs is an array of svn_prop_t elements indicating the property
00128 * delta for this and the previous revision.
00129 * @a pool may be used for temporary allocations, but you can't rely
00130 * on objects allocated to live outside of this particular call and the
00131 * immediately following calls to @a *delta_handler, if any. */
00132 typedef svn_error_t *(*svn_ra_file_rev_handler_t)
00133 (void *baton,
00134 const char *path,
00135 svn_revnum_t rev,
00136 apr_hash_t *rev_props,
00137 svn_txdelta_window_handler_t *delta_handler,
00138 void **delta_baton,
00139 apr_array_header_t *prop_diffs,
00140 apr_pool_t *pool);
00141
00142
00143 /** The update Reporter.
00144 *
00145 * A vtable structure which allows a working copy to describe a subset
00146 * (or possibly all) of its working-copy to an RA layer, for the
00147 * purposes of an update, switch, status, or diff operation.
00148 *
00149 * Paths for report calls are relative to the target (not the anchor)
00150 * of the operation. Report calls must be made in depth-first order:
00151 * parents before children, all children of a parent before any
00152 * siblings of the parent. The first report call must be a set_path
00153 * with a @a path argument of "" and a valid revision. (If the target
00154 * of the operation is locally deleted or missing, use the anchor's
00155 * revision.) If the target of the operation is deleted or switched
00156 * relative to the anchor, follow up the initial set_path call with a
00157 * link_path or delete_path call with a @a path argument of "" to
00158 * indicate that. In no other case may there be two report
00159 * descriptions for the same path. If the target of the operation is
00160 * a locally added file or directory (which previously did not exist),
00161 * it may be reported as having revision 0 or as having the parent
00162 * directory's revision.
00163 */
00164 typedef struct svn_ra_reporter_t
00165 {
00166 /** Describe a working copy @a path as being at a particular @a revision.
00167 *
00168 * If @a START_EMPTY is set and @a path is a directory, the
00169 * implementor should assume the directory has no entries or props.
00170 *
00171 * This will *override* any previous @c set_path() calls made on parent
00172 * paths. @a path is relative to the URL specified in @c open().
00173 *
00174 * All temporary allocations are done in @a pool.
00175 */
00176 svn_error_t *(*set_path) (void *report_baton,
00177 const char *path,
00178 svn_revnum_t revision,
00179 svn_boolean_t start_empty,
00180 apr_pool_t *pool);
00181
00182 /** Describing a working copy @a path as missing.
00183 *
00184 * All temporary allocations are done in @a pool.
00185 */
00186 svn_error_t *(*delete_path) (void *report_baton,
00187 const char *path,
00188 apr_pool_t *pool);
00189
00190 /** Like @c set_path(), but differs in that @a path in the working copy
00191 * (relative to the root of the report driver) isn't a reflection of
00192 * @a path in the repository (relative to the URL specified when
00193 * opening the RA layer), but is instead a reflection of a different
00194 * repository @a url at @a revision.
00195 *
00196 * If @a START_EMPTY is set and @a path is a directory,
00197 * the implementor should assume the directory has no entries or props.
00198 *
00199 * All temporary allocations are done in @a pool.
00200 */
00201 svn_error_t *(*link_path) (void *report_baton,
00202 const char *path,
00203 const char *url,
00204 svn_revnum_t revision,
00205 svn_boolean_t start_empty,
00206 apr_pool_t *pool);
00207
00208 /** WC calls this when the state report is finished; any directories
00209 * or files not explicitly `set' above are assumed to be at the
00210 * baseline revision originally passed into @c do_update().
00211 */
00212 svn_error_t *(*finish_report) (void *report_baton,
00213 apr_pool_t *pool);
00214
00215 /** If an error occurs during a report, this routine should cause the
00216 * filesystem transaction to be aborted & cleaned up.
00217 */
00218 svn_error_t *(*abort_report) (void *report_baton,
00219 apr_pool_t *pool);
00220
00221 } svn_ra_reporter_t;
00222
00223
00224
00225 /** A collection of callbacks implemented by libsvn_client which allows
00226 * an RA layer to "pull" information from the client application, or
00227 * possibly store information. libsvn_client passes this vtable to
00228 * @c RA->open().
00229 *
00230 * Each routine takes a @a callback_baton originally provided with the
00231 * vtable.
00232 */
00233 typedef struct svn_ra_callbacks_t
00234 {
00235 /** Open a unique temporary file for writing in the working copy.
00236 * This file will be automatically deleted when @a fp is closed.
00237 */
00238 svn_error_t *(*open_tmp_file) (apr_file_t **fp,
00239 void *callback_baton,
00240 apr_pool_t *pool);
00241
00242 /** An authentication baton, created by the application, which is
00243 * capable of retrieving all known types of credentials.
00244 */
00245 svn_auth_baton_t *auth_baton;
00246
00247 /*** The following items may be set to NULL to disallow the RA layer
00248 to perform the respective operations of the vtable functions.
00249 Perhaps WC props are not defined or are in invalid for this
00250 session, or perhaps the commit operation this RA session will
00251 perform is a server-side only one that shouldn't do post-commit
00252 processing on a working copy path. ***/
00253
00254 /** Fetch working copy properties.
00255 *
00256 *<pre> ### we might have a problem if the RA layer ever wants a property
00257 * ### that corresponds to a different revision of the file than
00258 * ### what is in the WC. we'll cross that bridge one day...</pre>
00259 */
00260 svn_ra_get_wc_prop_func_t get_wc_prop;
00261
00262 /** Immediately set new values for working copy properties. */
00263 svn_ra_set_wc_prop_func_t set_wc_prop;
00264
00265 /** Schedule new values for working copy properties. */
00266 svn_ra_push_wc_prop_func_t push_wc_prop;
00267
00268 /** Invalidate working copy properties. */
00269 svn_ra_invalidate_wc_props_func_t invalidate_wc_props;
00270
00271 } svn_ra_callbacks_t;
00272
00273
00274
00275 /*----------------------------------------------------------------------*/
00276
00277 /** The RA Library.
00278 *
00279 * A vtable structure which encapsulates all the functionality of a
00280 * particular repository-access implementation.
00281 *
00282 * Note: libsvn_client will keep an array of these objects,
00283 * representing all RA libraries that it has simultaneously loaded
00284 * into memory. Depending on the situation, the client can look
00285 * through this array and find the appropriate implementation it
00286 * needs.
00287 */
00288 typedef struct svn_ra_plugin_t
00289 {
00290 /** The proper name of the RA library, (like "ra_dav" or "ra_local") */
00291 const char *name;
00292
00293 /** Short doc string printed out by `svn --version` */
00294 const char *description;
00295
00296 /* The vtable hooks */
00297
00298 /** Open a repository session to @a repos_url. Return an opaque object
00299 * representing this session in @a *session_baton, allocated in @a pool.
00300 *
00301 * @a callbacks/@a callback_baton is a table of callbacks provided by the
00302 * client; see @c svn_ra_callbacks_t above.
00303 *
00304 * @a config is a hash mapping <tt>const char *</tt> keys to
00305 * @c svn_config_t * values. For example, the @c svn_config_t for the
00306 * "~/.subversion/config" file is under the key "config".
00307 *
00308 * All RA requests require a @a session_baton; they will continue to
00309 * use @a pool for memory allocation.
00310 */
00311 svn_error_t *(*open) (void **session_baton,
00312 const char *repos_URL,
00313 const svn_ra_callbacks_t *callbacks,
00314 void *callback_baton,
00315 apr_hash_t *config,
00316 apr_pool_t *pool);
00317
00318 /** Get the latest revision number from the repository. This is
00319 * useful for the `svn status' command. :)
00320 *
00321 * Use @a pool for memory allocation.
00322 */
00323 svn_error_t *(*get_latest_revnum) (void *session_baton,
00324 svn_revnum_t *latest_revnum,
00325 apr_pool_t *pool);
00326
00327 /** Get the latest revision number at time @a tm.
00328 *
00329 * Use @a pool for memory allocation.
00330 */
00331 svn_error_t *(*get_dated_revision) (void *session_baton,
00332 svn_revnum_t *revision,
00333 apr_time_t tm,
00334 apr_pool_t *pool);
00335
00336 /** Set the property @a name to @a value on revision @a rev.
00337 *
00338 * If @a value is @c NULL, delete the named revision property.
00339 *
00340 * Please note that properties attached to revisions are **unversioned**.
00341 *
00342 * Use @a pool for memory allocation.
00343 */
00344 svn_error_t *(*change_rev_prop) (void *session_baton,
00345 svn_revnum_t rev,
00346 const char *name,
00347 const svn_string_t *value,
00348 apr_pool_t *pool);
00349
00350 /** Set @a *props to the list of unversioned properties attached to
00351 * revision @a rev. The hash maps (<tt>const char *</tt>) names to
00352 * (<tt>@c svn_string_t *</tt>) values.
00353 *
00354 * Use @a pool for memory allocation.
00355 */
00356 svn_error_t *(*rev_proplist) (void *session_baton,
00357 svn_revnum_t rev,
00358 apr_hash_t **props,
00359 apr_pool_t *pool);
00360
00361 /** Set @a *value to the value of unversioned property @a name attached to
00362 * revision @a rev. If @a rev has no property by that name, set @a *value
00363 * to @c NULL.
00364 *
00365 * Use @a pool for memory allocation.
00366 */
00367 svn_error_t *(*rev_prop) (void *session_baton,
00368 svn_revnum_t rev,
00369 const char *name,
00370 svn_string_t **value,
00371 apr_pool_t *pool);
00372
00373 /** Set @a *editor and @a *edit_baton to an editor for committing changes
00374 * to the repository, using @a log_msg as the log message. The
00375 * revisions being committed against are passed to the editor
00376 * functions, starting with the rev argument to @c open_root. The path
00377 * root of the commit is in the @a session_baton's url.
00378 *
00379 * These three functions all share @c close_baton:
00380 *
00381 * * @c get_func is used by the RA layer to fetch any WC properties
00382 * during the commit.
00383 *
00384 * * @c set_func is used by the RA layer to set any WC properties,
00385 * after the commit completes.
00386 *
00387 * * @c close_func is used by the RA layer to bump the revisions of
00388 * each committed item, after the commit completes. It may be
00389 * called multiple times.
00390 *
00391 * Any of these functions may be @c NULL.
00392 *
00393 * Before @c close_edit returns, but after the commit has succeeded,
00394 * it will invoke @a callback with the new revision number, the
00395 * commit date (as a <tt>const char *</tt>), commit author (as a
00396 * <tt>const char *</tt>), and @a callback_baton as arguments. If
00397 * @a callback returns an error, that error will be returned from @c
00398 * close_edit, otherwise @c close_edit will return successfully
00399 * (unless it encountered an error before invoking @a callback).
00400 *
00401 * The callback will not be called if the commit was a no-op
00402 * (i.e. nothing was committed);
00403 *
00404 * The caller may not perform any RA operations using
00405 * @a session_baton before finishing the edit.
00406 *
00407 * Use @a pool for memory allocation.
00408 */
00409 svn_error_t *(*get_commit_editor) (void *session_baton,
00410 const svn_delta_editor_t **editor,
00411 void **edit_baton,
00412 const char *log_msg,
00413 svn_commit_callback_t callback,
00414 void *callback_baton,
00415 apr_pool_t *pool);
00416
00417 /** Fetch the contents and properties of file @a path at @a revision.
00418 * Interpret @a path relative to the url in @a session_baton. Use
00419 * @a pool for all allocations.
00420 *
00421 * If @a revision is @c SVN_INVALID_REVNUM (meaning 'head') and
00422 * @a *fetched_rev is not @c NULL, then this function will set
00423 * @a *fetched_rev to the actual revision that was retrieved. (Some
00424 * callers want to know, and some don't.)
00425 *
00426 * If @a stream is non @c NULL, push the contents of the file at @a stream.
00427 *
00428 * If @a props is non @c NULL, set @a *props to contain the properties of
00429 * the file. This means *all* properties: not just ones controlled by
00430 * the user and stored in the repository fs, but non-tweakable ones
00431 * generated by the SCM system itself (e.g. 'wcprops', 'entryprops',
00432 * etc.) The keys are <tt>const char *</tt>, values are
00433 * <tt>@c svn_string_t *</tt>.
00434 *
00435 * The stream handlers for @a stream may not perform any RA
00436 * operations using @a session_baton.
00437 */
00438 svn_error_t *(*get_file) (void *session_baton,
00439 const char *path,
00440 svn_revnum_t revision,
00441 svn_stream_t *stream,
00442 svn_revnum_t *fetched_rev,
00443 apr_hash_t **props,
00444 apr_pool_t *pool);
00445
00446 /** If @a dirents is non @c NULL, set @a *dirents to contain all the entries
00447 * of directory @a path at @a revision. The keys of @a dirents will be
00448 * entry names (<tt>const char *</tt>), and the values dirents
00449 * (<tt>@c svn_dirent_t *</tt>). Use @a pool for all allocations.
00450 *
00451 * @a path is interpreted relative to the url in @a session_baton.
00452 *
00453 * If @a revision is @c SVN_INVALID_REVNUM (meaning 'head') and
00454 * @a *fetched_rev is not @c NULL, then this function will set
00455 * @a *fetched_rev to the actual revision that was retrieved. (Some
00456 * callers want to know, and some don't.)
00457 *
00458 * If @a props is non @c NULL, set @a *props to contain the properties of
00459 * the directory. This means *all* properties: not just ones controlled by
00460 * the user and stored in the repository fs, but non-tweakable ones
00461 * generated by the SCM system itself (e.g. 'wcprops', 'entryprops',
00462 * etc.) The keys are <tt>const char *</tt>, values are
00463 * <tt>@c svn_string_t *</tt>.
00464 */
00465 svn_error_t *(*get_dir) (void *session_baton,
00466 const char *path,
00467 svn_revnum_t revision,
00468 apr_hash_t **dirents,
00469 svn_revnum_t *fetched_rev,
00470 apr_hash_t **props,
00471 apr_pool_t *pool);
00472
00473 /** Ask the network layer to update a working copy.
00474 *
00475 * The client initially provides an @a update_editor/@a baton to the
00476 * RA layer; this editor contains knowledge of where the change will
00477 * begin in the working copy (when @c open_root() is called).
00478 *
00479 * In return, the client receives a @a reporter/@a report_baton. The
00480 * client then describes its working-copy revision numbers by making
00481 * calls into the @a reporter structure; the RA layer assumes that all
00482 * paths are relative to the URL used to create @a session_baton.
00483 *
00484 * When finished, the client calls @a reporter->finish_report(). The
00485 * RA layer then does a complete drive of @a update_editor, ending with
00486 * @c close_edit(), to update the working copy.
00487 *
00488 * @a update_target is an optional single path component will restrict
00489 * the scope of things affected by the update to an entry in the
00490 * directory represented by the @a session_baton's URL, or empty if the
00491 * entire directory is meant to be updated.
00492 *
00493 * The working copy will be updated to @a revision_to_update_to, or the
00494 * "latest" revision if this arg is invalid.
00495 *
00496 * The caller may not perform any RA operations using
00497 * @a session_baton before finishing the report, and may not perform
00498 * any RA operations using @a session_baton from within the editing
00499 * operations of @a update_editor.
00500 *
00501 * Use @a pool for memory allocation.
00502 */
00503 svn_error_t *(*do_update) (void *session_baton,
00504 const svn_ra_reporter_t **reporter,
00505 void **report_baton,
00506 svn_revnum_t revision_to_update_to,
00507 const char *update_target,
00508 svn_boolean_t recurse,
00509 const svn_delta_editor_t *update_editor,
00510 void *update_baton,
00511 apr_pool_t *pool);
00512
00513 /** Ask the network layer to 'switch' a working copy to a new
00514 * @a switch_url; it's another form of @c do_update().
00515 *
00516 * The client initially provides an @a switch_editor/@a baton to the RA
00517 * layer; this editor contains knowledge of where the change will
00518 * begin in the working copy (when @c open_root() is called).
00519 *
00520 * In return, the client receives a @a reporter/@a report_baton. The
00521 * client then describes its working-copy revision numbers by making
00522 * calls into the @a reporter structure; the RA layer assumes that all
00523 * paths are relative to the URL used to create @a session_baton.
00524 *
00525 * When finished, the client calls @a reporter->finish_report(). The
00526 * RA layer then does a complete drive of @a switch_editor, ending with
00527 * @c close_edit(), to switch the working copy.
00528 *
00529 * @a switch_target is an optional single path component will restrict
00530 * the scope of things affected by the switch to an entry in the
00531 * directory represented by the @a session_baton's URL, or empty if the
00532 * entire directory is meant to be switched.
00533 *
00534 * The working copy will be switched to @a revision_to_switch_to, or the
00535 * "latest" revision if this arg is invalid.
00536 *
00537 * The caller may not perform any RA operations using
00538 * @a session_baton before finishing the report, and may not perform
00539 * any RA operations using @a session_baton from within the editing
00540 * operations of @a switch_editor.
00541 *
00542 * Use @a pool for memory allocation.
00543 */
00544 svn_error_t *(*do_switch) (void *session_baton,
00545 const svn_ra_reporter_t **reporter,
00546 void **report_baton,
00547 svn_revnum_t revision_to_switch_to,
00548 const char *switch_target,
00549 svn_boolean_t recurse,
00550 const char *switch_url,
00551 const svn_delta_editor_t *switch_editor,
00552 void *switch_baton,
00553 apr_pool_t *pool);
00554
00555 /** Ask the network layer to describe the status of a working copy
00556 * with respect to @a revision of the repository (or HEAD, if @a
00557 * revision is invalid).
00558 *
00559 * The client initially provides an @a status_editor/@a baton to the RA
00560 * layer; this editor contains knowledge of where the change will
00561 * begin in the working copy (when @c open_root() is called).
00562 *
00563 * In return, the client receives a @a reporter/@a report_baton. The
00564 * client then describes its working-copy revision numbers by making
00565 * calls into the @a reporter structure; the RA layer assumes that all
00566 * paths are relative to the URL used to create @a session_baton.
00567 *
00568 * When finished, the client calls @a reporter->finish_report(). The RA
00569 * layer then does a complete drive of @a status_editor, ending with
00570 * @c close_edit(), to report, essentially, what would be modified in
00571 * the working copy were the client to call @c do_update().
00572 * @a status_target is an optional single path component will restrict
00573 * the scope of the status report to an entry in the directory
00574 * represented by the @a session_baton's URL, or empty if the entire
00575 * directory is meant to be examined.
00576 *
00577 * The caller may not perform any RA operations using
00578 * @a session_baton before finishing the report, and may not perform
00579 * any RA operations using @a session_baton from within the editing
00580 * operations of @a status_editor.
00581 *
00582 * Use @a pool for memory allocation.
00583 */
00584 svn_error_t *(*do_status) (void *session_baton,
00585 const svn_ra_reporter_t **reporter,
00586 void **report_baton,
00587 const char *status_target,
00588 svn_revnum_t revision,
00589 svn_boolean_t recurse,
00590 const svn_delta_editor_t *status_editor,
00591 void *status_baton,
00592 apr_pool_t *pool);
00593
00594
00595 /** Ask the network layer to 'diff' a working copy against @a versus_url;
00596 * it's another form of @c do_update().
00597 *
00598 * [Please note: this function cannot be used to diff a single
00599 * file, only a working copy directory. See the do_switch()
00600 * function for more details.]
00601 *
00602 * The client initially provides a @a diff_editor/@a baton to the RA
00603 * layer; this editor contains knowledge of where the common diff
00604 * root is in the working copy (when @c open_root() is called).
00605 *
00606 * In return, the client receives a @a reporter/@a report_baton. The
00607 * client then describes its working-copy revision numbers by making
00608 * calls into the @a reporter structure; the RA layer assumes that all
00609 * paths are relative to the URL used to create @a session_baton.
00610 *
00611 * When finished, the client calls @a reporter->finish_report(). The
00612 * RA layer then does a complete drive of @a diff_editor, ending with
00613 * @c close_edit(), to transmit the diff.
00614 *
00615 * @a diff_target is an optional single path component will restrict
00616 * the scope of the diff to an entry in the directory represented by
00617 * the @a session_baton's URL, or empty if the entire directory is
00618 * meant to be one of the diff paths.
00619 *
00620 * The working copy will be diffed against @a versus_url as it exists
00621 * in revision @a revision, or as it is in head if @a revision is
00622 * @c SVN_INVALID_REVNUM.
00623 *
00624 * Use @a ignore_ancestry to control whether or not items being
00625 * diffed will be checked for relatedness first. Unrelated items
00626 * are typically transmitted to the editor as a deletion of one thing
00627 * and the addition of another, but if this flag is @c TRUE,
00628 * unrelated items will be diffed as if they were related.
00629 *
00630 * The caller may not perform any RA operations using
00631 * @a session_baton before finishing the report, and may not perform
00632 * any RA operations using @a session_baton from within the editing
00633 * operations of @a diff_editor.
00634 *
00635 * Use @a pool for memory allocation.
00636 */
00637 svn_error_t *(*do_diff) (void *session_baton,
00638 const svn_ra_reporter_t **reporter,
00639 void **report_baton,
00640 svn_revnum_t revision,
00641 const char *diff_target,
00642 svn_boolean_t recurse,
00643 svn_boolean_t ignore_ancestry,
00644 const char *versus_url,
00645 const svn_delta_editor_t *diff_editor,
00646 void *diff_baton,
00647 apr_pool_t *pool);
00648
00649 /** Invoke @a receiver with @a receiver_baton on each log message from
00650 * @a start to @a end. @a start may be greater or less than @a end;
00651 * this just controls whether the log messages are processed in descending
00652 * or ascending revision number order.
00653 *
00654 * If @a start or @a end is @c SVN_INVALID_REVNUM, it defaults to youngest.
00655 *
00656 * If @a paths is non-null and has one or more elements, then only show
00657 * revisions in which at least one of @a paths was changed (i.e., if
00658 * file, text or props changed; if dir, props changed or an entry
00659 * was added or deleted). Each path is an <tt>const char *</tt>, relative
00660 * to the session's common parent.
00661 *
00662 * If @a discover_changed_paths, then each call to receiver passes a
00663 * <tt>const apr_hash_t *</tt> for the receiver's @a changed_paths argument;
00664 * the hash's keys are all the paths committed in that revision.
00665 * Otherwise, each call to receiver passes null for @a changed_paths.
00666 *
00667 * If @a strict_node_history is set, copy history will not be traversed
00668 * (if any exists) when harvesting the revision logs for each path.
00669 *
00670 * If any invocation of @a receiver returns error, return that error
00671 * immediately and without wrapping it.
00672 *
00673 * If @a start or @a end is a non-existent revision, return the error
00674 * @c SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
00675 *
00676 * See also the documentation for @c svn_log_message_receiver_t.
00677 *
00678 * The caller may not invoke any RA operations using
00679 * @a session_baton from within @a receiver.
00680 *
00681 * Use @a pool for memory allocation.
00682 */
00683 svn_error_t *(*get_log) (void *session_baton,
00684 const apr_array_header_t *paths,
00685 svn_revnum_t start,
00686 svn_revnum_t end,
00687 svn_boolean_t discover_changed_paths,
00688 svn_boolean_t strict_node_history,
00689 svn_log_message_receiver_t receiver,
00690 void *receiver_baton,
00691 apr_pool_t *pool);
00692
00693 /* Yoshiki Hayashi <yoshiki@xemacs.org> points out that a more
00694 generic way to support 'discover_changed_paths' in logs would be
00695 to have these two functions:
00696
00697 svn_error_t *(*get_rev_prop) (void *session_baton,
00698 svn_string_t **value,
00699 svn_string_t *name,
00700 svn_revnum_t revision);
00701
00702 svn_error_t *(get_changed_paths) (void *session_baton,
00703 apr_array_header_t **changed_paths,
00704 svn_revnum_t revision);
00705
00706 Although log requests are common enough to deserve special
00707 support (to optimize network usage), these two more generic
00708 functions are still good ideas. Don't want to implement them
00709 right now, as am concentrating on the log functionality, but we
00710 will probably want them eventually, hence this start block. */
00711
00712
00713 /** Set @a *kind to node kind associated with @a path at @a revision.
00714 * If @a path does not exist under @a revision, set @a *kind to
00715 * @c svn_node_none. @a path is relative to the session's parent URL.
00716 *
00717 * Use @a pool for memory allocation.
00718 */
00719 svn_error_t *(*check_path) (void *session_baton,
00720 const char *path,
00721 svn_revnum_t revision,
00722 svn_node_kind_t *kind,
00723 apr_pool_t *pool);
00724
00725 /** Set @a *uuid to the repository's UUID.
00726 *
00727 * NOTE: the UUID has the same lifetime as the session_baton.
00728 *
00729 * Use @a pool for temporary memory allocation.
00730 */
00731 svn_error_t *(*get_uuid) (void *session_baton,
00732 const char **uuid,
00733 apr_pool_t *pool);
00734
00735 /** Set @a *url to the repository's root URL. The value
00736 * will not include a trailing '/'. The returned URL is guaranteed
00737 * to be a prefix of the session's parent URL.
00738 *
00739 * NOTE: the URL has the same lifetime as the session_baton.
00740 *
00741 * Use @a pool for temporary memory allocation.
00742 */
00743 svn_error_t *(*get_repos_root) (void *session_baton,
00744 const char **url,
00745 apr_pool_t *pool);
00746
00747 /** @since New in 1.1.
00748 *
00749 * Set @a *locations to the locations at the repository revisions
00750 * @a location_revisions of the file @a path present at the repository in
00751 * revision @a peg_revision. @a path is a path relative to the URL to which
00752 * the RA session was opened. @a location_revisions is an array of
00753 * svn_revnum_t's. @a *locations will be a mapping from the revisions to
00754 * their appropriate absolute paths. If the file doesn't exist in a
00755 * in location_revision, that revision will be ignored.
00756 *
00757 * NOTE: For servers older than 1.1, this function will return an
00758 * SVN_ERR_RA_NOT_IMPLEMENTED error.
00759 *
00760 * Use @a pool for all allocations.
00761 *
00762 * NOTE: This functionality is not available in pre-1.1 servers. If the
00763 * server doesn't implement it, an @c SVN_ERR_RA_NOT_IMPLEMENTED error is
00764 * returned.
00765 */
00766 svn_error_t *(*get_locations) (void *session_baton,
00767 apr_hash_t **locations,
00768 const char *path,
00769 svn_revnum_t peg_revision,
00770 apr_array_header_t *location_revisions,
00771 apr_pool_t *pool);
00772
00773 /** @since New in 1.1.
00774 * Retrieve a subset of the interesting revisions of a file @a path
00775 * as seen in revision @a end. Invoke @a handler with @a handler_baton
00776 * as its first argument for each such revision. @a sesson_baton is
00777 * an open RA session. @a pool is used for all allocations. See
00778 * @c svn_fs_history_prev for a discussion of interesting revisions.
00779 *
00780 * If there is an interesting revision of the file that is less than or
00781 * equal to start, the iteration will start at that revision. Else, the
00782 * iteration will start at the first revision of the file in the repository,
00783 * whic has to be less than or equal to end. Note that if the function
00784 * succeeds, @a handler will have been called at least once.
00785 *
00786 * In a series of calls, the file contents for the first interesting revision
00787 * will be provided as a text delta against the empty file. In the following
00788 * calls, the delta will be against the contents for the previous call.
00789 *
00790 * NOTE: This functionality is not available in pre-1.1 servers. If the
00791 * server doesn't implement it, an @c SVN_ERR_RA_NOT_IMPLEMENTED error is
00792 * returned. */
00793 svn_error_t *(*get_file_revs) (void *session_baton,
00794 const char *path,
00795 svn_revnum_t start,
00796 svn_revnum_t end,
00797 svn_ra_file_rev_handler_t handler,
00798 void *handler_baton,
00799 apr_pool_t *pool);
00800
00801 /** @since New in 1.1.
00802 * Return the plugin's version information.
00803 */
00804 /* FIXME: This is broken. The get_version function should be at the
00805 beginning of the vtable, just after the description, and should
00806 not move even between major releases (see, e.g., the FS library
00807 vtable). That's the only safe way for the RA loader to retreive
00808 the plugin's version regardless of ABI changes. Obviously we
00809 can't fix this before 2.0, and the fix will cause undetectable
00810 ABI breakage. */
00811 const svn_version_t *(*get_version) (void);
00812 } svn_ra_plugin_t;
00813
00814
00815 /**
00816 * libsvn_client will be responsible for loading each RA DSO it needs.
00817 * However, all "ra_FOO" implementations *must* export a function named
00818 * @c svn_ra_FOO_init() of type @c svn_ra_init_func_t.
00819 *
00820 * When called by libsvn_client, this routine adds an entry (or
00821 * entries) to the hash table for any URL schemes it handles. The hash
00822 * value must be of type (<tt>@c svn_ra_plugin_t *</tt>). @a pool is a
00823 * pool for allocating configuration / one-time data.
00824 *
00825 * This type is defined to use the "C Calling Conventions" to ensure that
00826 * abi_version is the first parameter. The RA plugin must check that value
00827 * before accessing the other parameters.
00828 *
00829 * ### need to force this to be __cdecl on Windows... how??
00830 */
00831 typedef svn_error_t *(*svn_ra_init_func_t) (int abi_version,
00832 apr_pool_t *pool,
00833 apr_hash_t *hash);
00834
00835 /** The current ABI (Application Binary Interface) version for the
00836 * RA plugin model. This version number will change when the ABI
00837 * between the SVN core (e.g. libsvn_client) and the RA plugin changes.
00838 *
00839 * An RA plugin should verify that the passed version number is acceptable
00840 * before accessing the rest of the parameters, and before returning any
00841 * information.
00842 *
00843 * It is entirely acceptable for an RA plugin to accept multiple ABI
00844 * versions. It can simply interpret the parameters based on the version,
00845 * and it can return different plugin structures.
00846 *
00847 *
00848 * <pre>
00849 * VSN DATE REASON FOR CHANGE
00850 * --- ---------- ------------------------------------------------
00851 * 1 2001-02-17 Initial revision.
00852 * 2 2004-06-29 Preparing for svn 1.1, which adds new RA vtable funcs.
00853 * </pre>
00854 *
00855 * @deprecated Provided for backward compatibility with the 1.0 API.
00856 */
00857 #define SVN_RA_ABI_VERSION 2
00858
00859
00860 /* Public RA implementations: ADD MORE HERE as necessary. */
00861
00862 /** initialize libsvn_ra_dav. */
00863 svn_error_t * svn_ra_dav_init (int abi_version,
00864 apr_pool_t *pool,
00865 apr_hash_t *hash);
00866
00867 /** initialize libsvn_ra_local. */
00868 svn_error_t * svn_ra_local_init (int abi_version,
00869 apr_pool_t *pool,
00870 apr_hash_t *hash);
00871
00872 /** initialize libsvn_ra_svn. */
00873 svn_error_t * svn_ra_svn_init (int abi_version,
00874 apr_pool_t *pool,
00875 apr_hash_t *hash);
00876
00877
00878
00879 /* Public Interfaces */
00880
00881 /** Initialize the RA libraries.
00882 *
00883 * Every user of the RA layer *must* call this routine and hold on to
00884 * the @a ra_baton returned. This baton contains all known methods of
00885 * accessing a repository, for use within most @c svn_client_* routines.
00886 */
00887 svn_error_t * svn_ra_init_ra_libs (void **ra_baton, apr_pool_t *pool);
00888
00889
00890 /** Return an RA vtable-@a library (already within @a ra_baton) which can
00891 * handle URL. A number of svn_client_* routines will call this
00892 * internally, but client apps might use it too.
00893 *
00894 * For reference, note that according to W3 RFC 1738, a valid URL is
00895 * of the following form:
00896 *
00897 * scheme://<user>:<password>\@<host>:<port>/<url-path>
00898 *
00899 * Common URLs are as follows:
00900 *
00901 * http://subversion.tigris.org/index.html
00902 * file:///home/joeuser/documents/resume.txt
00903 *
00904 * Of interest is the file URL schema, which takes the form
00905 * file://<host>/<path>, where <host> and <path> are optional. The
00906 * `/' between <host> and <path> is NOT part of path, yet the RFC doesn't
00907 * specify how <path> should be formatted. SVN will count on the
00908 * portability layer to be able to handle the specific formatting of
00909 * the <path> on a per-system basis.
00910 */
00911 svn_error_t *svn_ra_get_ra_library (svn_ra_plugin_t **library,
00912 void *ra_baton,
00913 const char *url,
00914 apr_pool_t *pool);
00915
00916 /** Return a @a *descriptions string (allocated in @a pool) that is a textual
00917 * list of all available RA libraries.
00918 */
00919 svn_error_t *svn_ra_print_ra_libraries (svn_stringbuf_t **descriptions,
00920 void *ra_baton,
00921 apr_pool_t *pool);
00922
00923
00924
00925
00926
00927 #ifdef __cplusplus
00928 }
00929 #endif /* __cplusplus */
00930
00931 #endif /* SVN_RA_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002