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_client.h
00019 * @brief Public interface for libsvn_client.
00020 */
00021
00022
00023
00024 /*** Includes ***/
00025
00026 /*
00027 * Requires: The working copy library and repository access library.
00028 * Provides: Broad wrappers around working copy library functionality.
00029 * Used By: Client programs.
00030 */
00031
00032 #ifndef SVN_CLIENT_H
00033 #define SVN_CLIENT_H
00034
00035 #include <apr_tables.h>
00036
00037 #include "svn_types.h"
00038 #include "svn_wc.h"
00039 #include "svn_string.h"
00040 #include "svn_error.h"
00041 #include "svn_opt.h"
00042 #include "svn_version.h"
00043
00044
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif /* __cplusplus */
00048
00049
00050 /* ### TODO: Multiple Targets
00051
00052 - Up for debate: an update on multiple targets is *not* atomic.
00053 Right now, svn_client_update only takes one path. What's
00054 debatable is whether this should ever change. On the one hand,
00055 it's kind of losing to have the client application loop over
00056 targets and call svn_client_update() on each one; each call to
00057 update initializes a whole new repository session (network
00058 overhead, etc.) On the other hand, it's a very simple
00059 implementation, and allows for the possibility that different
00060 targets may come from different repositories. */
00061
00062
00063 /**
00064 * Get libsvn_client version information.
00065 * @since New in 1.1.
00066 */
00067 const svn_version_t *svn_client_version (void);
00068
00069
00070
00071 /*** Authentication stuff ***/
00072
00073 /* The new authentication system allows the RA layer to "pull"
00074 information as needed from libsvn_client. See svn_ra.h */
00075
00076 /** Create and return @a *provider, an authentication provider of type
00077 * svn_auth_cred_simple_t that gets information by prompting the user
00078 * with @a prompt_func and @a prompt_baton. Allocate @a *provider in
00079 * @a pool.
00080 *
00081 * If both @c SVN_AUTH_PARAM_DEFAULT_USERNAME and
00082 * @c SVN_AUTH_PARAM_DEFAULT_PASSWORD are defined as runtime
00083 * parameters in the @c auth_baton, then @a *provider will return the
00084 * default arguments when @c svn_auth_first_credentials is called. If
00085 * @c svn_auth_first_credentials fails, then @a *provider will
00086 * re-prompt @a retry_limit times (via @c svn_auth_next_credentials).
00087 */
00088 void svn_client_get_simple_prompt_provider (
00089 svn_auth_provider_object_t **provider,
00090 svn_auth_simple_prompt_func_t prompt_func,
00091 void *prompt_baton,
00092 int retry_limit,
00093 apr_pool_t *pool);
00094
00095
00096 /** Create and return @a *provider, an authentication provider of type @c
00097 * svn_auth_cred_username_t that gets information by prompting the
00098 * user with @a prompt_func and @a prompt_baton. Allocate @a *provider
00099 * in @a pool.
00100 *
00101 * If @c SVN_AUTH_PARAM_DEFAULT_USERNAME is defined as a runtime
00102 * parameter in the @c auth_baton, then @a *provider will return the
00103 * default argument when @c svn_auth_first_credentials is called. If
00104 * @c svn_auth_first_credentials fails, then @a *provider will
00105 * re-prompt @a retry_limit times (via @c svn_auth_next_credentials).
00106 */
00107 void svn_client_get_username_prompt_provider (
00108 svn_auth_provider_object_t **provider,
00109 svn_auth_username_prompt_func_t prompt_func,
00110 void *prompt_baton,
00111 int retry_limit,
00112 apr_pool_t *pool);
00113
00114
00115 /** Create and return @a *provider, an authentication provider of type @c
00116 * svn_auth_cred_simple_t that gets/sets information from the user's
00117 * ~/.subversion configuration directory. Allocate @a *provider in
00118 * @a pool.
00119 *
00120 * If a default username or password is available, @a *provider will
00121 * honor them as well, and return them when @c
00122 * svn_auth_first_credentials is called. (see @c
00123 * SVN_AUTH_PARAM_DEFAULT_USERNAME and @c
00124 * SVN_AUTH_PARAM_DEFAULT_PASSWORD).
00125 */
00126 void svn_client_get_simple_provider (svn_auth_provider_object_t **provider,
00127 apr_pool_t *pool);
00128
00129
00130 /** Create and return @a *provider, an authentication provider of type @c
00131 * svn_auth_cred_username_t that gets/sets information from a user's
00132 * ~/.subversion configuration directory. Allocate @a *provider in
00133 * @a pool.
00134 *
00135 * If a default username is available, @a *provider will honor it,
00136 * and return it when @c svn_auth_first_credentials is called. (see
00137 * @c SVN_AUTH_PARAM_DEFAULT_USERNAME).
00138 */
00139 void svn_client_get_username_provider (svn_auth_provider_object_t **provider,
00140 apr_pool_t *pool);
00141
00142
00143 /** Create and return @a *provider, an authentication provider of type @c
00144 * svn_auth_cred_ssl_server_trust_t, allocated in @a pool.
00145 *
00146 * @a *provider retrieves its credentials from the configuration
00147 * mechanism. The returned credential is used to override SSL
00148 * security on an error.
00149 */
00150 void svn_client_get_ssl_server_trust_file_provider (
00151 svn_auth_provider_object_t **provider,
00152 apr_pool_t *pool);
00153
00154
00155 /** Create and return @a *provider, an authentication provider of type @c
00156 * svn_auth_cred_ssl_client_cert_t, allocated in @a pool.
00157 *
00158 * @a *provider retrieves its credentials from the configuration
00159 * mechanism. The returned credential is used to load the appropriate
00160 * client certificate for authentication when requested by a server.
00161 */
00162 void svn_client_get_ssl_client_cert_file_provider (
00163 svn_auth_provider_object_t **provider,
00164 apr_pool_t *pool);
00165
00166
00167 /** Create and return @a *provider, an authentication provider of type @c
00168 * svn_auth_cred_ssl_client_cert_pw_t, allocated in @a pool.
00169 *
00170 * @a *provider retrieves its credentials from the configuration
00171 * mechanism. The returned credential is used when a loaded client
00172 * certificate is protected by a passphrase.
00173 */
00174 void svn_client_get_ssl_client_cert_pw_file_provider (
00175 svn_auth_provider_object_t **provider,
00176 apr_pool_t *pool);
00177
00178
00179 /** Create and return @a *provider, an authentication provider of type @c
00180 * svn_auth_cred_ssl_server_trust_t, allocated in @a pool.
00181 *
00182 * @a *provider retrieves its credentials by using the @a prompt_func
00183 * and @a prompt_baton. The returned credential is used to override
00184 * SSL security on an error.
00185 */
00186 void svn_client_get_ssl_server_trust_prompt_provider (
00187 svn_auth_provider_object_t **provider,
00188 svn_auth_ssl_server_trust_prompt_func_t prompt_func,
00189 void *prompt_baton,
00190 apr_pool_t *pool);
00191
00192
00193 /** Create and return @a *provider, an authentication provider of type @c
00194 * svn_auth_cred_ssl_client_cert_t, allocated in @a pool.
00195 *
00196 * @a *provider retrieves its credentials by using the @a prompt_func
00197 * and @a prompt_baton. The returned credential is used to load the
00198 * appropriate client certificate for authentication when requested by
00199 * a server. The prompt will be retried @a retry_limit times.
00200 */
00201 void svn_client_get_ssl_client_cert_prompt_provider (
00202 svn_auth_provider_object_t **provider,
00203 svn_auth_ssl_client_cert_prompt_func_t prompt_func,
00204 void *prompt_baton,
00205 int retry_limit,
00206 apr_pool_t *pool);
00207
00208
00209 /** Create and return @a *provider, an authentication provider of type @c
00210 * svn_auth_cred_ssl_client_cert_pw_t, allocated in @a pool.
00211 *
00212 * @a *provider retrieves its credentials by using the @a prompt_func
00213 * and @a prompt_baton. The returned credential is used when a loaded
00214 * client certificate is protected by a passphrase. The prompt will
00215 * be retried @a retry_limit times.
00216 */
00217 void svn_client_get_ssl_client_cert_pw_prompt_provider (
00218 svn_auth_provider_object_t **provider,
00219 svn_auth_ssl_client_cert_pw_prompt_func_t prompt_func,
00220 void *prompt_baton,
00221 int retry_limit,
00222 apr_pool_t *pool);
00223
00224
00225 /** This is a structure which stores a filename and a hash of property
00226 * names and values.
00227 */
00228 typedef struct svn_client_proplist_item_t
00229 {
00230 /** The name of the node on which these properties are set. */
00231 svn_stringbuf_t *node_name;
00232
00233 /** A hash of (const char *) property names, and (svn_string_t *) property
00234 * values. */
00235 apr_hash_t *prop_hash;
00236
00237 } svn_client_proplist_item_t;
00238
00239
00240 /** Information about commits passed back to client from this module. */
00241 typedef struct svn_client_commit_info_t
00242 {
00243 /** just-committed revision. */
00244 svn_revnum_t revision;
00245
00246 /** server-side date of the commit. */
00247 const char *date;
00248
00249 /** author of the commit. */
00250 const char *author;
00251
00252 } svn_client_commit_info_t;
00253
00254
00255 /** State flags for use with the @c svn_client_commit_item_t structure
00256 *
00257 * (see the note about the namespace for that structure, which also
00258 * applies to these flags).
00259 * @defgroup svn_client_commit_item_flags state flags
00260 * @{
00261 */
00262 #define SVN_CLIENT_COMMIT_ITEM_ADD 0x01
00263 #define SVN_CLIENT_COMMIT_ITEM_DELETE 0x02
00264 #define SVN_CLIENT_COMMIT_ITEM_TEXT_MODS 0x04
00265 #define SVN_CLIENT_COMMIT_ITEM_PROP_MODS 0x08
00266 #define SVN_CLIENT_COMMIT_ITEM_IS_COPY 0x10
00267 /** @} */
00268
00269 /** The commit candidate structure. */
00270 typedef struct svn_client_commit_item_t
00271 {
00272 /** absolute working-copy path of item */
00273 const char *path;
00274
00275 /** node kind (dir, file) */
00276 svn_node_kind_t kind;
00277
00278 /** commit URL for this item */
00279 const char *url;
00280
00281 /** revision (copyfrom-rev if _IS_COPY) */
00282 svn_revnum_t revision;
00283
00284 /** copyfrom-url */
00285 const char *copyfrom_url;
00286
00287 /** state flags */
00288 apr_byte_t state_flags;
00289
00290 /** An array of `svn_prop_t *' changes to wc properties. If adding
00291 * to this array, allocate the svn_prop_t and its contents in
00292 * wcprop_changes->pool, so that it has the same lifetime as this
00293 * svn_client_commit_item_t.
00294 *
00295 * See http://subversion.tigris.org/issues/show_bug.cgi?id=806 for
00296 * what would happen if the post-commit process didn't group these
00297 * changes together with all other changes to the item :-).
00298 */
00299 apr_array_header_t *wcprop_changes;
00300
00301 } svn_client_commit_item_t;
00302
00303
00304 /** Callback type used by commit-y operations to get a commit log message
00305 * from the caller.
00306 *
00307 * Set @a *log_msg to the log message for the commit, allocated in @a
00308 * pool, or @c NULL if wish to abort the commit process. Set @a *tmpfile
00309 * to the path of any temporary file which might be holding that log
00310 * message, or @c NULL if no such file exists (though, if @a *log_msg is
00311 * @c NULL, this value is undefined). The log message MUST be a UTF8
00312 * string with LF line separators.
00313 *
00314 * @a commit_items is an array of @c svn_client_commit_item_t structures,
00315 * which may be fully or only partially filled-in, depending on the
00316 * type of commit operation.
00317 *
00318 * @a baton is provided along with the callback for use by the handler.
00319 *
00320 * All allocations should be performed in @a pool.
00321 */
00322 typedef svn_error_t *
00323 (*svn_client_get_commit_log_t) (const char **log_msg,
00324 const char **tmp_file,
00325 apr_array_header_t *commit_items,
00326 void *baton,
00327 apr_pool_t *pool);
00328
00329 /** Callback type used by svn_client_blame() to notify the caller
00330 * that line @a line_no of the blamed file was last changed in
00331 * @a revision by @a author on @a date, and that the contents were
00332 * @a line.
00333 *
00334 * All allocations should be performed in @a pool.
00335 *
00336 * NOTE: If there is no blame information for this line, @a revision will be
00337 * invalid and @a author and @a date will be NULL.
00338 */
00339 typedef svn_error_t *
00340 (*svn_client_blame_receiver_t) (void *baton,
00341 apr_int64_t line_no,
00342 svn_revnum_t revision,
00343 const char *author,
00344 const char *date,
00345 const char *line,
00346 apr_pool_t *pool);
00347
00348
00349 /** A client context structure, which holds client specific callbacks,
00350 * batons, serves as a cache for configuration options, and other various
00351 * and sundry things. In order to avoid backwards compatability problems
00352 * clients should use @c svn_client_create_context() to allocate and
00353 * intialize this structure instead of doing so themselves.
00354 */
00355 typedef struct svn_client_ctx_t
00356 {
00357 /** main authentication baton. */
00358 svn_auth_baton_t *auth_baton;
00359
00360 /** notification callback function */
00361 svn_wc_notify_func_t notify_func;
00362
00363 /** notification callback baton */
00364 void *notify_baton;
00365
00366 /** log message callback function */
00367 svn_client_get_commit_log_t log_msg_func;
00368
00369 /** log message callback baton */
00370 void *log_msg_baton;
00371
00372 /** a hash mapping of <tt>const char *</tt> configuration file names to
00373 * @c svn_config_t *'s, for example, the '~/.subversion/config' file's
00374 * contents should have the key "config".
00375 */
00376 apr_hash_t *config;
00377
00378 /** a callback to be used to see if the client wishes to cancel the running
00379 * operation. */
00380 svn_cancel_func_t cancel_func;
00381
00382 /** a baton to pass to the cancellation callback. */
00383 void *cancel_baton;
00384
00385 } svn_client_ctx_t;
00386
00387
00388 /** Names of files that contain authentication information.
00389 *
00390 * These filenames are decided by libsvn_client, since this library
00391 * implements all the auth-protocols; libsvn_wc does nothing but
00392 * blindly store and retrieve these files from protected areas.
00393 *
00394 * @defgroup svn_client_auth_files authentication files
00395 * @{
00396 */
00397 #define SVN_CLIENT_AUTH_USERNAME "username"
00398 #define SVN_CLIENT_AUTH_PASSWORD "password"
00399 /** @} */
00400
00401
00402 /** Initialize a client context.
00403 * Set @a *ctx to a client context object, allocated in @a pool, that
00404 * represents a particular instance of an svn client.
00405 *
00406 * In order to avoid backwards compatability problems, clients must
00407 * use this function to intialize and allocate the
00408 * @c svn_client_ctx_t structure rather than doing so themselves, as
00409 * the size of this structure may change in the future.
00410 *
00411 * The current implementation never returns error, but callers should
00412 * still check for error, for compatibility with future versions.
00413 */
00414 svn_error_t *
00415 svn_client_create_context (svn_client_ctx_t **ctx,
00416 apr_pool_t *pool);
00417
00418 /** Checkout a working copy of @a URL at @a revision, using @a path as
00419 * the root directory of the newly checked out working copy, and
00420 * authenticating with the authentication baton cached in @a ctx. If
00421 * @a result_rev is not @c NULL, set @a *result_rev to the value of
00422 * the revision actually checked out from the repository.
00423 *
00424 * @a revision must be of kind @c svn_opt_revision_number,
00425 * @c svn_opt_revision_head, or @c svn_opt_revision_date. If
00426 * @c revision does not meet these requirements, return the error
00427 * @c SVN_ERR_CLIENT_BAD_REVISION.
00428 *
00429 * If @a ctx->notify_func is non-null, invoke @a ctx->notify_func with
00430 * @a ctx->notify_baton as the checkout progresses.
00431 *
00432 * Use @a pool for any temporary allocation.
00433 */
00434 svn_error_t *
00435 svn_client_checkout (svn_revnum_t *result_rev,
00436 const char *URL,
00437 const char *path,
00438 const svn_opt_revision_t *revision,
00439 svn_boolean_t recurse,
00440 svn_client_ctx_t *ctx,
00441 apr_pool_t *pool);
00442
00443
00444 /** Update working tree @a path to @a revision, authenticating with
00445 * the authentication baton cached in @a ctx. If @a result_rev is not
00446 * @c NULL, set @a *result_rev to the value of the revision to which
00447 * the working copy was actually updated.
00448 *
00449 * @a revision must be of kind @c svn_opt_revision_number,
00450 * @c svn_opt_revision_head, or @c svn_opt_revision_date. If @a
00451 * revision does not meet these requirements, return the error
00452 * @c SVN_ERR_CLIENT_BAD_REVISION.
00453 *
00454 * If @a ctx->notify_func is non-null, invoke @a ctx->notify_func with
00455 * @a ctx->notify_baton for each item handled by the update, and also for
00456 * files restored from text-base.
00457 *
00458 * If @a path is not found, return the error @c SVN_ERR_ENTRY_NOT_FOUND.
00459 *
00460 * Use @a pool for any temporary allocation.
00461 */
00462 svn_error_t *
00463 svn_client_update (svn_revnum_t *result_rev,
00464 const char *path,
00465 const svn_opt_revision_t *revision,
00466 svn_boolean_t recurse,
00467 svn_client_ctx_t *ctx,
00468 apr_pool_t *pool);
00469
00470
00471 /** Switch working tree @a path to @a url at @a revision,
00472 * authenticating with the authentication baton cached in @a ctx. If
00473 * @a result_rev is not @c NULL, set @a *result_rev to the value of
00474 * the revision to which the working copy was actually switched.
00475 *
00476 * Summary of purpose: this is normally used to switch a working
00477 * directory over to another line of development, such as a branch or
00478 * a tag. Switching an existing working directory is more efficient
00479 * than checking out @a url from scratch.
00480 *
00481 * @a revision must be of kind @c svn_opt_revision_number,
00482 * @c svn_opt_revision_head, or @c svn_opt_revision_date; otherwise,
00483 * return @c SVN_ERR_CLIENT_BAD_REVISION.
00484 *
00485 * If @a ctx->notify_func is non-null, invoke it with @a ctx->notify_baton
00486 * on paths affected by the switch. Also invoke it for files may be restored
00487 * from the text-base because they were removed from the working copy.
00488 *
00489 * Use @a pool for any temporary allocation.
00490 */
00491 svn_error_t *
00492 svn_client_switch (svn_revnum_t *result_rev,
00493 const char *path,
00494 const char *url,
00495 const svn_opt_revision_t *revision,
00496 svn_boolean_t recurse,
00497 svn_client_ctx_t *ctx,
00498 apr_pool_t *pool);
00499
00500
00501 /** Schedule a working copy @a path for addition to the repository.
00502 *
00503 * @a path's parent must be under revision control already, but @a
00504 * path is not. If @a recursive is set, then assuming @a path is a
00505 * directory, all of its contents will be scheduled for addition as
00506 * well.
00507 *
00508 * If @a force is not set and @a path is already under version
00509 * control, return the error @c SVN_ERR_ENTRY_EXISTS. If @a force is
00510 * set, do not error on already-versioned items. When used on a
00511 * directory in conjunction with the @a recursive flag, this has the
00512 * effect of scheduling for addition unversioned files and directories
00513 * scattered deep within a versioned tree.
00514 *
00515 * If @a ctx->notify_func is non-null, then for each added item, call
00516 * @a ctx->notify_func with @a ctx->notify_baton and the path of the
00517 * added item.
00518 *
00519 * Important: this is a *scheduling* operation. No changes will
00520 * happen to the repository until a commit occurs. This scheduling
00521 * can be removed with svn_client_revert.
00522 */
00523 svn_error_t *
00524 svn_client_add2 (const char *path,
00525 svn_boolean_t recursive,
00526 svn_boolean_t force,
00527 svn_client_ctx_t *ctx,
00528 apr_pool_t *pool);
00529
00530 /**
00531 * @deprecated Provided for backward compatibility with the 1.0.0 API.
00532 *
00533 * Similar to svn_client_add2(), but with the @a force parameter
00534 * always set to @c FALSE.
00535 */
00536 svn_error_t *
00537 svn_client_add (const char *path,
00538 svn_boolean_t recursive,
00539 svn_client_ctx_t *ctx,
00540 apr_pool_t *pool);
00541
00542 /** Create a directory, either in a repository or a working copy.
00543 *
00544 * If @a paths contains URLs, use the authentication baton in @a ctx
00545 * and @a message to immediately attempt to commit the creation of the
00546 * directories in @a paths in the repository. If the commit succeeds,
00547 * allocate (in @a pool) and populate @a *commit_info.
00548 *
00549 * Else, create the directories on disk, and attempt to schedule them
00550 * for addition (using @c svn_client_add, whose docstring you should
00551 * read).
00552 *
00553 * @a ctx->log_msg_func/@a ctx->log_msg_baton are a callback/baton combo that
00554 * this function can use to query for a commit log message when one is
00555 * needed.
00556 *
00557 * If @a ctx->notify_func is non-null, when the directory has been created
00558 * (successfully) in the working copy, call @a ctx->notify_func with
00559 * @a ctx->notify_baton and the path of the new directory. Note that this is
00560 * only called for items added to the working copy. */
00561 svn_error_t *
00562 svn_client_mkdir (svn_client_commit_info_t **commit_info,
00563 const apr_array_header_t *paths,
00564 svn_client_ctx_t *ctx,
00565 apr_pool_t *pool);
00566
00567
00568 /** Delete items from a repository or working copy.
00569 *
00570 * If the paths in @a paths are URLs, use the authentication baton in
00571 * @a ctx and @a ctx->log_msg_func/@a ctx->log_msg_baton to
00572 * immediately attempt to commit a deletion of the URLs from the
00573 * repository. If the commit succeeds, allocate (in @a pool) and
00574 * populate @a *commit_info. Every path must belong to the same
00575 * repository.
00576 *
00577 * Else, schedule the working copy paths in @a paths for removal from
00578 * the repository. Each path's parent must be under revision control.
00579 * This is just a *scheduling* operation. No changes will happen to
00580 * the repository until a commit occurs. This scheduling can be
00581 * removed with @c svn_client_revert. If a path is a file it is
00582 * immediately removed from the working copy. If the path is a
00583 * directory it will remain in the working copy but all the files, and
00584 * all unversioned items, it contains will be removed. If @a force is
00585 * not set then this operation will fail if any path contains locally
00586 * modified and/or unversioned items. If @a force is set such items
00587 * will be deleted.
00588 *
00589 * @a ctx->log_msg_func/@a ctx->log_msg_baton are a callback/baton combo that
00590 * this function can use to query for a commit log message when one is
00591 * needed.
00592 *
00593 * If @a ctx->notify_func is non-null, then for each item deleted, call
00594 * @a ctx->notify_func with @a ctx->notify_baton and the path of the deleted
00595 * item. */
00596 svn_error_t *
00597 svn_client_delete (svn_client_commit_info_t **commit_info,
00598 const apr_array_header_t *paths,
00599 svn_boolean_t force,
00600 svn_client_ctx_t *ctx,
00601 apr_pool_t *pool);
00602
00603
00604 /** Import file or directory @a path into repository directory @a url at
00605 * head, authenticating with the authentication baton cached in @a ctx,
00606 * and using @a ctx->log_msg_func/@a ctx->log_msg_baton to get a log message
00607 * for the (implied) commit. Set @a *commit_info to the results of the
00608 * commit, allocated in @a pool. If some components of @a url do not exist
00609 * then create parent directories as necessary.
00610 *
00611 * If @a path is a directory, the contents of that directory are
00612 * imported directly into the directory identified by @a url. Note that the
00613 * directory @a path itself is not imported -- that is, the basename of
00614 * @a path is not part of the import.
00615 *
00616 * If @a path is a file, then the dirname of @a url is the directory
00617 * receiving the import. The basename of @a url is the filename in the
00618 * repository. In this case if @a url already exists, return error.
00619 *
00620 * If @a ctx->notify_func is non-null, then call @a ctx->notify_func with
00621 * @a ctx->notify_baton as the import progresses, with any of the following
00622 * actions: @c svn_wc_notify_commit_added,
00623 * @c svn_wc_notify_commit_postfix_txdelta.
00624 *
00625 * Use @a pool for any temporary allocation.
00626 *
00627 * @a ctx->log_msg_func/@a ctx->log_msg_baton are a callback/baton combo that
00628 * this function can use to query for a commit log message when one is needed.
00629 *
00630 * Use @a nonrecursive to indicate that imported directories should not
00631 * recurse into any subdirectories they may have.
00632 *
00633 * ### kff todo: This import is similar to cvs import, in that it does
00634 * not change the source tree into a working copy. However, this
00635 * behavior confuses most people, and I think eventually svn _should_
00636 * turn the tree into a working copy, or at least should offer the
00637 * option. However, doing so is a bit involved, and we don't need it
00638 * right now.
00639 */
00640 svn_error_t *svn_client_import (svn_client_commit_info_t **commit_info,
00641 const char *path,
00642 const char *url,
00643 svn_boolean_t nonrecursive,
00644 svn_client_ctx_t *ctx,
00645 apr_pool_t *pool);
00646
00647
00648 /** Commit file or directory @a path into repository, authenticating with
00649 * the authentication baton cached in @a ctx, and using
00650 * @a ctx->log_msg_func/@a ctx->log_msg_baton to obtain the log message.
00651 * Set @a *commit_info to the results of the commit, allocated in @a pool.
00652 *
00653 * @a targets is an array of <tt>const char *</tt> paths to commit. They
00654 * need not be canonicalized nor condensed; this function will take care of
00655 * that. If @a targets has zero elements, then do nothing and return
00656 * immediately without error.
00657 *
00658 * If @a notify_func is non-null, then call @a ctx->notify_func with
00659 * @a ctx->notify_baton as the commit progresses, with any of the following
00660 * actions: @c svn_wc_notify_commit_modified, @c svn_wc_notify_commit_added,
00661 * @c svn_wc_notify_commit_deleted, @c svn_wc_notify_commit_replaced,
00662 * @c svn_wc_notify_commit_postfix_txdelta.
00663 *
00664 * Use @a nonrecursive to indicate that subdirectories of directory
00665 * @a targets should be ignored.
00666 *
00667 * Use @a pool for any temporary allocation.
00668 *
00669 * If no error is returned and @a (*commit_info)->revision is set to
00670 * @c SVN_INVALID_REVNUM, then the commit was a no-op; nothing needed to
00671 * be committed.
00672 */
00673 svn_error_t *
00674 svn_client_commit (svn_client_commit_info_t **commit_info,
00675 const apr_array_header_t *targets,
00676 svn_boolean_t nonrecursive,
00677 svn_client_ctx_t *ctx,
00678 apr_pool_t *pool);
00679
00680
00681 /** Given @a path to a working copy directory (or single file), call
00682 * @a status_func/status_baton with a set of @c svn_wc_status_t *
00683 * structures which describe the status of @a path and its children.
00684 *
00685 * - If @a descend is non-zero, recurse fully, else do only
00686 * immediate children.
00687 *
00688 * - If @a get_all is set, retrieve all entries; otherwise,
00689 * retrieve only "interesting" entries (local mods and/or
00690 * out-of-date).
00691 *
00692 * - If @a update is set, contact the repository and augment the
00693 * status structures with information about out-of-dateness (with
00694 * respect to @a revision). Also, if @a result_rev is not @c NULL,
00695 * set @a *result_rev to the actual revision against which the
00696 * working copy was compared (@a *result_rev is not meaningful unless
00697 * @a update is set).
00698 *
00699 * This function recurses into externals definitions ('svn:externals')
00700 * after handling the main target, if any exist. The function calls
00701 * the client notification function (in @a ctx) with the @c
00702 * svn_wc_notify_status_external action before handling each externals
00703 * definition, and with @c svn_wc_notify_status_completed after each.
00704 */
00705 svn_error_t *
00706 svn_client_status (svn_revnum_t *result_rev,
00707 const char *path,
00708 svn_opt_revision_t *revision,
00709 svn_wc_status_func_t status_func,
00710 void *status_baton,
00711 svn_boolean_t descend,
00712 svn_boolean_t get_all,
00713 svn_boolean_t update,
00714 svn_boolean_t no_ignore,
00715 svn_client_ctx_t *ctx,
00716 apr_pool_t *pool);
00717
00718
00719 /** Invoke @a receiver with @a receiver_baton on each log message from @a
00720 * start to @a end in turn, inclusive (but never invoke @a receiver on a
00721 * given log message more than once).
00722 *
00723 * @a targets contains all the working copy paths (as <tt>const char
00724 * *</tt>'s) for which log messages are desired. The repository info is
00725 * determined by taking the common prefix of the target entries' URLs.
00726 * @a receiver is invoked only on messages
00727 * whose revisions involved a change to some path in @a targets.
00728 *
00729 * ### todo: the above paragraph is not fully implemented yet.
00730 *
00731 * If @a discover_changed_paths is set, then the `@a changed_paths' argument
00732 * to @a receiver will be passed on each invocation.
00733 *
00734 * If @a strict_node_history is set, copy history (if any exists) will
00735 * not be traversed while harvesting revision logs for each target.
00736 *
00737 * If @a start->kind or @a end->kind is @c svn_opt_revision_unspecified,
00738 * return the error @c SVN_ERR_CLIENT_BAD_REVISION.
00739 *
00740 * Use @a pool for any temporary allocation.
00741 *
00742 * Special case for repositories at revision 0:
00743 *
00744 * If @a start->kind is @c svn_opt_revision_head, and @a end->kind is
00745 * @c svn_opt_revision_number && @a end->number is @c 1, then handle an
00746 * empty (no revisions) repository specially: instead of erroring
00747 * because requested revision 1 when the highest revision is 0, just
00748 * invoke @a receiver on revision 0, passing @c NULL for changed paths and
00749 * empty strings for the author and date. This is because that
00750 * particular combination of @a start and @a end usually indicates the
00751 * common case of log invocation -- the user wants to see all log
00752 * messages from youngest to oldest, where the oldest commit is
00753 * revision 1. That works fine, except when there are no commits in
00754 * the repository, hence this special case.
00755 *
00756 * If @a ctx->notify_func is non-null, then call @a ctx->notify_func/baton
00757 * with a 'skip' signal on any unversioned targets.
00758 *
00759 */
00760 svn_error_t *
00761 svn_client_log (const apr_array_header_t *targets,
00762 const svn_opt_revision_t *start,
00763 const svn_opt_revision_t *end,
00764 svn_boolean_t discover_changed_paths,
00765 svn_boolean_t strict_node_history,
00766 svn_log_message_receiver_t receiver,
00767 void *receiver_baton,
00768 svn_client_ctx_t *ctx,
00769 apr_pool_t *pool);
00770
00771 /** Invoke @a receiver with @a receiver_baton on each line-blame item
00772 * associated with revision @a end of @a path_or_url, using @a start
00773 * as the default source of all blame.
00774 *
00775 * If @a start->kind or @a end->kind is @c svn_opt_revision_unspecified,
00776 * return the error @c SVN_ERR_CLIENT_BAD_REVISION. If any of the
00777 * revisions of @a path_or_url have a binary mime-type, return the
00778 * error @c SVN_ERR_CLIENT_IS_BINARY_FILE.
00779 *
00780 * Use @a pool for any temporary allocation.
00781 */
00782 svn_error_t *
00783 svn_client_blame (const char *path_or_url,
00784 const svn_opt_revision_t *start,
00785 const svn_opt_revision_t *end,
00786 svn_client_blame_receiver_t receiver,
00787 void *receiver_baton,
00788 svn_client_ctx_t *ctx,
00789 apr_pool_t *pool);
00790
00791 /** Produce diff output which describes the delta between
00792 * @a path1/@a revision1 and @a path2/@a revision2. Print the output
00793 * of the diff to @a outfile, and any errors to @a errfile. @a path1
00794 * and @a path2 can be either working-copy paths or URLs.
00795 *
00796 * If either @a revision1 or @a revision2 has an `unspecified' or
00797 * unrecognized `kind', return @c SVN_ERR_CLIENT_BAD_REVISION.
00798 *
00799 * @a path1 and @a path2 must both represent the same node kind -- that
00800 * is, if @a path1 is a directory, @a path2 must also be, and if @a path1
00801 * is a file, @a path2 must also be. (Currently, @a path1 and @a path2
00802 * must be the exact same path)
00803 *
00804 * If @a recurse is true (and the @a paths are directories) this will be a
00805 * recursive operation.
00806 *
00807 * Use @a ignore_ancestry to control whether or not items being
00808 * diffed will be checked for relatedness first. Unrelated items
00809 * are typically transmitted to the editor as a deletion of one thing
00810 * and the addition of another, but if this flag is @c TRUE,
00811 * unrelated items will be diffed as if they were related.
00812 *
00813 * If @a no_diff_deleted is true, then no diff output will be
00814 * generated on deleted files.
00815 *
00816 * @a diff_options (an array of <tt>const char *</tt>) is used to pass
00817 * additional command line options to the diff processes invoked to compare
00818 * files.
00819 *
00820 * the authentication baton cached in @a ctx is used to communicate with
00821 * the repository.
00822 */
00823 svn_error_t *svn_client_diff (const apr_array_header_t *diff_options,
00824 const char *path1,
00825 const svn_opt_revision_t *revision1,
00826 const char *path2,
00827 const svn_opt_revision_t *revision2,
00828 svn_boolean_t recurse,
00829 svn_boolean_t ignore_ancestry,
00830 svn_boolean_t no_diff_deleted,
00831 apr_file_t *outfile,
00832 apr_file_t *errfile,
00833 svn_client_ctx_t *ctx,
00834 apr_pool_t *pool);
00835
00836
00837 /**
00838 * @since New in 1.1.
00839 *
00840 * Produce diff output which describes the delta between the
00841 * filesystem object @a path in peg revision @a peg_revision, as it
00842 * changed between @a revision1 and @a revision2. Print the output of
00843 * the diff to @a outfile, and any errors to @a errfile. @a path can
00844 * be either a working-copy path or URL.
00845 *
00846 * All other options are handled identically to svn_client_diff.
00847 */
00848 svn_error_t *svn_client_diff_peg (const apr_array_header_t *diff_options,
00849 const char *path,
00850 const svn_opt_revision_t *peg_revision,
00851 const svn_opt_revision_t *start_revision,
00852 const svn_opt_revision_t *end_revision,
00853 svn_boolean_t recurse,
00854 svn_boolean_t ignore_ancestry,
00855 svn_boolean_t no_diff_deleted,
00856 apr_file_t *outfile,
00857 apr_file_t *errfile,
00858 svn_client_ctx_t *ctx,
00859 apr_pool_t *pool);
00860
00861
00862 /** Merge changes from @a source1/@a revision1 to @a source2/@a revision2 into
00863 * the working-copy path @a target_wcpath.
00864 *
00865 * @a source1 and @a source2 are either URLs that refer to entries in the
00866 * repository, or paths to entries in the working copy.
00867 *
00868 * By "merging", we mean: apply file differences using
00869 * @c svn_wc_merge, and schedule additions & deletions when appropriate.
00870 *
00871 * @a source1 and @a source2 must both represent the same node kind -- that
00872 * is, if @a source1 is a directory, @a source2 must also be, and if @a source1
00873 * is a file, @a source2 must also be.
00874 *
00875 * If either @a revision1 or @a revision2 has an `unspecified' or
00876 * unrecognized `kind', return @c SVN_ERR_CLIENT_BAD_REVISION.
00877 *
00878 * If @a recurse is true (and the URLs are directories), apply changes
00879 * recursively; otherwise, only apply changes in the current
00880 * directory.
00881 *
00882 * Use @a ignore_ancestry to control whether or not items being
00883 * diffed will be checked for relatedness first. Unrelated items
00884 * are typically transmitted to the editor as a deletion of one thing
00885 * and the addition of another, but if this flag is @c TRUE,
00886 * unrelated items will be diffed as if they were related.
00887 *
00888 * If @a force is not set and the merge involves deleting locally modified or
00889 * unversioned items the operation will fail. If @a force is set such items
00890 * will be deleted.
00891 *
00892 * If @a ctx->notify_func is non-null, then call @a ctx->notify_func with @a
00893 * ctx->notify_baton once for each merged target, passing the target's local
00894 * path.
00895 *
00896 * If @a dry_run is @a true the merge is carried out, and full notification
00897 * feedback is provided, but the working copy is not modified.
00898 *
00899 * the authentication baton cached in @a ctx is used to communicate with the
00900 * repository.
00901 */
00902 svn_error_t *
00903 svn_client_merge (const char *source1,
00904 const svn_opt_revision_t *revision1,
00905 const char *source2,
00906 const svn_opt_revision_t *revision2,
00907 const char *target_wcpath,
00908 svn_boolean_t recurse,
00909 svn_boolean_t ignore_ancestry,
00910 svn_boolean_t force,
00911 svn_boolean_t dry_run,
00912 svn_client_ctx_t *ctx,
00913 apr_pool_t *pool);
00914
00915
00916 /**
00917 * @since New in 1.1.
00918 *
00919 * Merge the changes between the filesystem object @a source in peg
00920 * revision @a peg_revision, as it changed between @a revision1 and @a
00921 * revision2.
00922 *
00923 * All other options are handled identically to svn_client_merge.
00924 */
00925 svn_error_t *
00926 svn_client_merge_peg (const char *source,
00927 const svn_opt_revision_t *revision1,
00928 const svn_opt_revision_t *revision2,
00929 const svn_opt_revision_t *peg_revision,
00930 const char *target_wcpath,
00931 svn_boolean_t recurse,
00932 svn_boolean_t ignore_ancestry,
00933 svn_boolean_t force,
00934 svn_boolean_t dry_run,
00935 svn_client_ctx_t *ctx,
00936 apr_pool_t *pool);
00937
00938
00939 /** Recursively cleanup a working copy directory @a dir, finishing any
00940 * incomplete operations, removing lockfiles, etc.
00941 *
00942 * If @a ctx->cancel_func is non-null, invoke it with @a
00943 * ctx->cancel_baton at various points during the operation. If it
00944 * returns an error (typically SVN_ERR_CANCELLED), return that error
00945 * immediately.
00946 */
00947 svn_error_t *
00948 svn_client_cleanup (const char *dir,
00949 svn_client_ctx_t *ctx,
00950 apr_pool_t *pool);
00951
00952
00953 /**
00954 * Modify a working copy directory @a dir, changing any
00955 * repository URLs that begin with @a from to begin with @a to instead,
00956 * recursing into subdirectories if @a recurse is true.
00957 *
00958 * @param dir Working copy directory
00959 * @param from Original URL
00960 * @param to New URL
00961 * @param recurse Whether to recurse
00962 * @param pool The pool from which to perform memory allocations
00963 */
00964 svn_error_t *
00965 svn_client_relocate (const char *dir,
00966 const char *from,
00967 const char *to,
00968 svn_boolean_t recurse,
00969 svn_client_ctx_t *ctx,
00970 apr_pool_t *pool);
00971
00972
00973 /** Restore the pristine version of a working copy @a paths,
00974 * effectively undoing any local mods. For each path in @a paths, if
00975 * it is a directory, and @a recursive is @a true, this will be a
00976 * recursive operation.
00977 *
00978 * If @a ctx->notify_func is non-null, then for each item reverted,
00979 * call @a ctx->notify_func with @a ctx->notify_baton and the path of
00980 * the reverted item.
00981 */
00982 svn_error_t *
00983 svn_client_revert (const apr_array_header_t *paths,
00984 svn_boolean_t recursive,
00985 svn_client_ctx_t *ctx,
00986 apr_pool_t *pool);
00987
00988
00989 /** Remove the 'conflicted' state on a working copy @a path. This will
00990 * not semantically resolve conflicts; it just allows @a path to be
00991 * committed in the future. The implementation details are opaque.
00992 * If @a recursive is set, recurse below @a path, looking for conflicts
00993 * to resolve.
00994 *
00995 * If @a path is not in a state of conflict to begin with, do nothing.
00996 * If @a path's conflict state is removed and @a ctx->notify_func is non-null,
00997 * call @a ctx->notify_func with @a ctx->notify_baton and @a path.
00998 */
00999 svn_error_t *
01000 svn_client_resolved (const char *path,
01001 svn_boolean_t recursive,
01002 svn_client_ctx_t *ctx,
01003 apr_pool_t *pool);
01004
01005
01006 /** Copy @a src_path to @a dst_path.
01007 *
01008 * @a src_path must be a file or directory under version control, or the
01009 * URL of a versioned item in the repository. If @a src_path is a
01010 * URL, @a src_revision is used to choose the revision from which to copy
01011 * the @a src_path. @a dst_path must be a file or directory under version
01012 * control, or a repository URL, existent or not.
01013 *
01014 * If @a dst_path is a URL, use the authentication baton
01015 * in @a ctx and @a ctx->log_msg_func/@a ctx->log_msg_baton to immediately
01016 * attempt to commit the copy action in the repository. If the commit
01017 * succeeds, allocate (in @a pool) and populate @a *commit_info.
01018 *
01019 * If @a dst_path is not a URL, then this is just a
01020 * variant of @c svn_client_add, where the @a dst_path items are scheduled
01021 * for addition as copies. No changes will happen to the repository
01022 * until a commit occurs. This scheduling can be removed with
01023 * @c svn_client_revert.
01024 *
01025 * @a ctx->log_msg_func/@a ctx->log_msg_baton are a callback/baton combo that
01026 * this function can use to query for a commit log message when one is
01027 * needed.
01028 *
01029 * If @a ctx->notify_func is non-null, invoke it with @a ctx->notify_baton
01030 * for each item added at the new location, passing the new, relative path of
01031 * the added item.
01032 */
01033 svn_error_t *
01034 svn_client_copy (svn_client_commit_info_t **commit_info,
01035 const char *src_path,
01036 const svn_opt_revision_t *src_revision,
01037 const char *dst_path,
01038 svn_client_ctx_t *ctx,
01039 apr_pool_t *pool);
01040
01041
01042 /** Move @a src_path to @a dst_path.
01043 *
01044 * @a src_path must be a file or directory under version control, or the
01045 * URL of a versioned item in the repository.
01046 *
01047 * If @a src_path is a repository URL:
01048 *
01049 * - @a dst_path must also be a repository URL (existent or not).
01050 *
01051 * - @a src_revision is used to choose the revision from which to copy
01052 * the @a src_path.
01053 *
01054 * - the authentication baton in @a ctx and @a ctx->log_msg_func/@a
01055 * ctx->log_msg_baton are used to commit the move.
01056 *
01057 * - The move operation will be immediately committed. If the
01058 * commit succeeds, allocate (in @a pool) and populate @a *commit_info.
01059 *
01060 * If @a src_path is a working copy path
01061 *
01062 * - @a dst_path must also be a working copy path (existent or not).
01063 *
01064 * - @a src_revision, and @a ctx->log_msg_func/@a ctx->log_msg_baton are
01065 * ignored.
01066 *
01067 * - This is a scheduling operation. No changes will happen to the
01068 * repository until a commit occurs. This scheduling can be removed
01069 * with @c svn_client_revert. If @a src_path is a file it is removed
01070 * from the working copy immediately. If @a src_path is a directory it
01071 * will remain n the working copy but all the files, and unversioned
01072 * items, it contains will be removed.
01073 *
01074 * - If @a src_path contains locally modified and/or unversioned items
01075 * and @a force is not set, the copy will fail. If @a force is set such
01076 * items will be removed.
01077 *
01078 * @a ctx->log_msg_func/@a ctx->log_msg_baton are a callback/baton combo that
01079 * this function can use to query for a commit log message when one is needed.
01080 *
01081 * If @a ctx->notify_func is non-null, then for each item moved, call
01082 * @a ctx->notify_func with the @a ctx->notify_baton twice, once to indicate
01083 * the deletion of the moved thing, and once to indicate the addition of
01084 * the new location of the thing.
01085 *
01086 * ### Is this really true? What about @c svn_wc_notify_commit_replaced? ###
01087 */
01088 svn_error_t *
01089 svn_client_move (svn_client_commit_info_t **commit_info,
01090 const char *src_path,
01091 const svn_opt_revision_t *src_revision,
01092 const char *dst_path,
01093 svn_boolean_t force,
01094 svn_client_ctx_t *ctx,
01095 apr_pool_t *pool);
01096
01097
01098 /** Properties
01099 *
01100 * Note that certain svn-controlled properties must always have their
01101 * values set and stored in UTF8 with LF line endings. When
01102 * retrieving these properties, callers must convert the values back
01103 * to native locale and native line-endings before displaying them to
01104 * the user. For help with this task, see
01105 * @c svn_prop_needs_translation, @c svn_subst_translate_string, and @c
01106 * svn_subst_detranslate_string.
01107 *
01108 * @defgroup svn_client_prop_funcs property functions
01109 * @{
01110 */
01111
01112
01113 /** Set @a propname to @a propval on @a target. If @a recurse is true,
01114 * then @a propname will be set on recursively on @a target and all
01115 * children. If @a recurse is false, and @a target is a directory, @a
01116 * propname will be set on _only_ @a target.
01117 *
01118 * A @a propval of @c NULL will delete the property.
01119 *
01120 * If @a propname is an svn-controlled property (i.e. prefixed with
01121 * @c SVN_PROP_PREFIX), then the caller is responsible for ensuring that
01122 * the value is UTF8-encoded and uses LF line-endings.
01123 *
01124 * Use @a pool for all memory allocation.
01125 */
01126 svn_error_t *
01127 svn_client_propset (const char *propname,
01128 const svn_string_t *propval,
01129 const char *target,
01130 svn_boolean_t recurse,
01131 apr_pool_t *pool);
01132
01133 /** Set @a propname to @a propval on revision @a revision in the repository
01134 * represented by @a URL. Use the authentication baton in @a ctx for
01135 * authentication, and @a pool for all memory allocation. Return the actual
01136 * rev affected in @a *set_rev. A @a propval of @c NULL will delete the
01137 * property.
01138 *
01139 * If @a force is true, allow newlines in the author property.
01140 *
01141 * If @a propname is an svn-controlled property (i.e. prefixed with
01142 * @c SVN_PROP_PREFIX), then the caller is responsible for ensuring that
01143 * the value UTF8-encoded and uses LF line-endings.
01144 *
01145 * Note that unlike its cousin @c svn_client_propset, this routine
01146 * doesn't affect the working copy at all; it's a pure network
01147 * operation that changes an *unversioned* property attached to a
01148 * revision. This can be used to tweak log messages, dates, authors,
01149 * and the like. Be careful: it's a lossy operation.
01150 *
01151 * Also note that unless the administrator creates a
01152 * pre-revprop-change hook in the repository, this feature will fail.
01153 */
01154 svn_error_t *
01155 svn_client_revprop_set (const char *propname,
01156 const svn_string_t *propval,
01157 const char *URL,
01158 const svn_opt_revision_t *revision,
01159 svn_revnum_t *set_rev,
01160 svn_boolean_t force,
01161 svn_client_ctx_t *ctx,
01162 apr_pool_t *pool);
01163
01164 /** Set @a *props to a hash table whose keys are `<tt>char *</tt>' paths,
01165 * prefixed by @a target (a working copy path or a URL), of items on
01166 * which property @a propname is set, and whose values are `@c svn_string_t
01167 * *' representing the property value for @a propname at that path.
01168 *
01169 * Allocate @a *props, its keys, and its values in @a pool.
01170 *
01171 * Don't store any path, not even @a target, if it does not have a
01172 * property named @a propname.
01173 *
01174 * If @a revision->kind is @c svn_opt_revision_unspecified, then: get
01175 * properties from the working copy if @a target is a working copy path,
01176 * or from the repository head if @a target is a URL. Else get the
01177 * properties as of @a revision. Use the authentication baton in @a ctx
01178 * for authentication if contacting the repository.
01179 *
01180 * If @a target is a file or @a recurse is false, @a *props will have
01181 * at most one element.
01182 *
01183 * If error, don't touch @a *props, otherwise @a *props is a hash table
01184 * even if empty.
01185 */
01186 svn_error_t *
01187 svn_client_propget (apr_hash_t **props,
01188 const char *propname,
01189 const char *target,
01190 const svn_opt_revision_t *revision,
01191 svn_boolean_t recurse,
01192 svn_client_ctx_t *ctx,
01193 apr_pool_t *pool);
01194
01195 /** Set @a *propval to the value of @a propname on revision @a revision
01196 * in the repository represented by @a URL. Use the authentication baton
01197 * in @a ctx for authentication, and @a pool for all memory allocation.
01198 * Return the actual rev queried in @a *set_rev.
01199 *
01200 * Note that unlike its cousin @c svn_client_propget, this routine
01201 * doesn't affect the working copy at all; it's a pure network
01202 * operation that queries an *unversioned* property attached to a
01203 * revision. This can query log messages, dates, authors, and the
01204 * like.
01205 */
01206 svn_error_t *
01207 svn_client_revprop_get (const char *propname,
01208 svn_string_t **propval,
01209 const char *URL,
01210 const svn_opt_revision_t *revision,
01211 svn_revnum_t *set_rev,
01212 svn_client_ctx_t *ctx,
01213 apr_pool_t *pool);
01214
01215 /** Set @a *props to the regular properties of @a target, a URL or working
01216 * copy path.
01217 *
01218 * Each element of the returned array is (@c svn_client_proplist_item_t *).
01219 * For each item, item->node_name contains the name relative to the
01220 * same base as @a target, and @a item->prop_hash maps (<tt>const char *</tt>)
01221 * property names to (@c svn_string_t *) values.
01222 *
01223 * Allocate @a *props and its contents in @a pool.
01224 *
01225 * If @a revision->kind is @c svn_opt_revision_unspecified, then get
01226 * properties from the working copy, if @a target is a working copy path,
01227 * or from the repository head if @a target is a URL. Else get the
01228 * properties as of @a revision. Use the authentication baton cached in @a ctx
01229 * for authentication if contacting the repository.
01230 *
01231 * If @a recurse is false, or @a target is a file, @a *props will contain
01232 * only a single element. Otherwise, it will contain one element for each
01233 * versioned entry below (and including) @a target.
01234 *
01235 * If @a target is not found, return the error @c SVN_ERR_ENTRY_NOT_FOUND.
01236 */
01237 svn_error_t *
01238 svn_client_proplist (apr_array_header_t **props,
01239 const char *target,
01240 const svn_opt_revision_t *revision,
01241 svn_boolean_t recurse,
01242 svn_client_ctx_t *ctx,
01243 apr_pool_t *pool);
01244
01245 /** Set @a *props to a hash of the revision props attached to @a revision in
01246 * the repository represented by @a URL. Use the authentication baton cached
01247 * in @a ctx for authentication, and @a pool for all memory allocation.
01248 * Return the actual rev queried in @a *set_rev.
01249 *
01250 * The allocated hash maps (<tt>const char *</tt>) property names to
01251 * (@c svn_string_t *) property values.
01252 *
01253 * Note that unlike its cousin @c svn_client_proplist, this routine
01254 * doesn't read a working copy at all; it's a pure network operation
01255 * that reads *unversioned* properties attached to a revision.
01256 */
01257 svn_error_t *
01258 svn_client_revprop_list (apr_hash_t **props,
01259 const char *URL,
01260 const svn_opt_revision_t *revision,
01261 svn_revnum_t *set_rev,
01262 svn_client_ctx_t *ctx,
01263 apr_pool_t *pool);
01264 /** @} */
01265
01266
01267 /**
01268 * @since New in 1.1.
01269 *
01270 * Export the contents of either a subversion repository or a
01271 * subversion working copy into a 'clean' directory (meaning a
01272 * directory with no administrative directories). If @a result_rev
01273 * is not @c NULL and the path being exported is a repository URL, set
01274 * @a *result_rev to the value of the revision actually exported (set
01275 * it to @c SVN_INVALID_REVNUM for local exports).
01276 *
01277 * @a from is either the path the working copy on disk, or a URL to the
01278 * repository you wish to export.
01279 *
01280 * @a to is the path to the directory where you wish to create the exported
01281 * tree.
01282 *
01283 * @a revision is the revision that should be exported, which is only used
01284 * when exporting from a repository.
01285 *
01286 * @a ctx->notify_func and @a ctx->notify_baton are the notification functions
01287 * and baton which are passed to @c svn_client_checkout when exporting from a
01288 * repository.
01289 *
01290 * @a ctx is a context used for authentication in the repository case.
01291 *
01292 * @a force if true will cause the export to overwrite files or directories.
01293 *
01294 * @a native_eol allows you to override the standard eol marker on the platform
01295 * you are running on. Can be either "LF", "CR" or "CRLF" or NULL. If NULL
01296 * will use the standard eol marker. Any other value will cause the
01297 * SVN_ERR_IO_UNKNOWN_EOL error to be returned.
01298 *
01299 * All allocations are done in @a pool.
01300 */
01301 svn_error_t *
01302 svn_client_export2 (svn_revnum_t *result_rev,
01303 const char *from,
01304 const char *to,
01305 svn_opt_revision_t *revision,
01306 svn_boolean_t force,
01307 const char *native_eol,
01308 svn_client_ctx_t *ctx,
01309 apr_pool_t *pool);
01310
01311
01312 /**
01313 * @deprecated Provided for backward compatibility with the 1.0.0 API.
01314 *
01315 * Similar to svn_client_export2(), but with the @a native_eol parameter
01316 * always set to @c NULL.
01317 */
01318 svn_error_t *
01319 svn_client_export (svn_revnum_t *result_rev,
01320 const char *from,
01321 const char *to,
01322 svn_opt_revision_t *revision,
01323 svn_boolean_t force,
01324 svn_client_ctx_t *ctx,
01325 apr_pool_t *pool);
01326
01327
01328 /** Set @a *dirents to a newly allocated hash of entries for @a path_or_url
01329 * at @a revision.
01330 *
01331 * If @a path_or_url is a directory, return all dirents in the hash. If
01332 * @a path_or_url is a file, return only the dirent for the file. If @a
01333 * path_or_url is non-existent, return @c SVN_ERR_FS_NOT_FOUND.
01334 *
01335 * The hash maps entrynames (<tt>const char *</tt>) to @c svn_dirent_t *'s.
01336 * Do all allocation in @a pool.
01337 *
01338 * Use authentication baton cached in @a ctx to authenticate against the
01339 * repository.
01340 *
01341 * If @a recurse is true (and @a path_or_url is a directory) this will
01342 * be a recursive operation.
01343 */
01344 svn_error_t *
01345 svn_client_ls (apr_hash_t **dirents,
01346 const char *path_or_url,
01347 svn_opt_revision_t *revision,
01348 svn_boolean_t recurse,
01349 svn_client_ctx_t *ctx,
01350 apr_pool_t *pool);
01351
01352
01353 /** Output the content of file identified by @a path_or_url and @a
01354 * revision to the stream @a out.
01355 *
01356 * If @a path_or_url is not a local path, then if @a revision is of
01357 * kind @c svn_opt_revision_previous (or some other kind that requires
01358 * a local path), an error will be returned, because the desired
01359 * revision cannot be determined.
01360 *
01361 * Use the authentication baton cached in @a ctx to authenticate against the
01362 * repository.
01363 *
01364 * Perform all allocations from @a pool.
01365 *
01366 * ### TODO: Add an expansion/translation flag?
01367 */
01368 svn_error_t *
01369 svn_client_cat (svn_stream_t *out,
01370 const char *path_or_url,
01371 const svn_opt_revision_t *revision,
01372 svn_client_ctx_t *ctx,
01373 apr_pool_t *pool);
01374
01375
01376
01377 /* Converting paths to URLs. */
01378
01379 /** Set @a *url to the URL for @a path_or_url.
01380 *
01381 * If @a path_or_url is already a URL, set @a *url to @a path_or_url.
01382 *
01383 * If @a path_or_url is a versioned item, set @a *url to @a
01384 * path_or_url's entry URL. If @a path_or_url is unversioned (has
01385 * no entry), set @a *url to null.
01386 */
01387 svn_error_t *
01388 svn_client_url_from_path (const char **url,
01389 const char *path_or_url,
01390 apr_pool_t *pool);
01391
01392
01393
01394
01395 /* Fetching repository UUIDs. */
01396
01397 /** Get repository @a uuid for @a url.
01398 *
01399 * Use a @a pool to open a temporary RA session to @a url, discover the
01400 * repository uuid, and free the session. Return the uuid in @a uuid,
01401 * allocated in @a pool. @a ctx is required for possible repository
01402 * authentication.
01403 */
01404 svn_error_t *
01405 svn_client_uuid_from_url (const char **uuid,
01406 const char *url,
01407 svn_client_ctx_t *ctx,
01408 apr_pool_t *pool);
01409
01410
01411 /** Return the repository @a uuid for working-copy @a path, allocated
01412 * in @a pool. Use @a adm_access to retrieve the uuid from @a path's
01413 * entry; if not present in the entry, then call
01414 * svn_client_uuid_from_url() to retrieve, using the entry's URL. @a
01415 * ctx is required for possible repository authentication.
01416 *
01417 * NOTE: the only reason this function falls back on
01418 * @c svn_client_uuid_from_url is for compatibility purposes. Old
01419 * working copies may not have uuids in the entries file.
01420 */
01421 svn_error_t *
01422 svn_client_uuid_from_path (const char **uuid,
01423 const char *path,
01424 svn_wc_adm_access_t *adm_access,
01425 svn_client_ctx_t *ctx,
01426 apr_pool_t *pool);
01427
01428 #ifdef __cplusplus
01429 }
01430 #endif /* __cplusplus */
01431
01432 #endif /* SVN_CLIENT_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002