📄 client.h
字号:
/*
* client.h : shared stuff internal to the client library.
*
* ====================================================================
* Copyright (c) 2000-2004 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://subversion.tigris.org/license-1.html.
* If newer versions of this license are posted there, you may use a
* newer version instead, at your option.
*
* This software consists of voluntary contributions made by many
* individuals. For exact contribution history, see the revision
* history and logs, available at http://subversion.tigris.org/.
* ====================================================================
*/
#ifndef SVN_LIBSVN_CLIENT_H
#define SVN_LIBSVN_CLIENT_H
#include <apr_pools.h>
#include "svn_types.h"
#include "svn_string.h"
#include "svn_error.h"
#include "svn_ra.h"
#include "svn_client.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Set *REVNUM to the revision number identified by REVISION.
*
* If REVISION->kind is svn_opt_revision_number, just use
* REVISION->value.number, ignoring PATH, RA_LIB, and SESSION.
*
* Else if REVISION->kind is svn_opt_revision_committed,
* svn_opt_revision_previous, or svn_opt_revision_base, or
* svn_opt_revision_working, then the revision can be identified
* purely based on the working copy's administrative information for
* PATH, so RA_LIB and SESSION are ignored. If PATH is not under
* revision control, return SVN_ERR_UNVERSIONED_RESOURCE, or if PATH
* is null, return SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED.
*
* Else if REVISION->kind is svn_opt_revision_date or
* svn_opt_revision_head, then RA_LIB and SESSION are used to
* retrieve the revision from the repository (using
* REVISION->value.date in the former case), and PATH is ignored. If
* RA_LIB or SESSION is null, return SVN_ERR_CLIENT_RA_ACCESS_REQUIRED.
*
* Else if REVISION->kind is svn_opt_revision_unspecified, set
* *REVNUM to SVN_INVALID_REVNUM.
*
* Else return SVN_ERR_CLIENT_BAD_REVISION.
*
* Use POOL for any temporary allocation.
*/
svn_error_t *
svn_client__get_revision_number (svn_revnum_t *revnum,
svn_ra_plugin_t *ra_lib,
void *session,
const svn_opt_revision_t *revision,
const char *path,
apr_pool_t *pool);
/* Return true if REVISION1 and REVISION2 would result in the same
revision number if interpreted in the context of the same working
copy and path and repository, or if both are of kind
svn_opt_revision_unspecified. Otherwise, return false. */
svn_boolean_t
svn_client__compare_revisions (svn_opt_revision_t *revision1,
svn_opt_revision_t *revision2);
/* Return true if the revision number for REVISION can be determined
from just the working copy, or false if it can be determined from
just the repository.
NOTE: No other kinds of revisions should be possible; but if one
day there are, this will return true for those kinds.
*/
svn_boolean_t
svn_client__revision_is_local (const svn_opt_revision_t *revision);
/* Given the CHANGED_PATHS and REVISION from an instance of a
svn_log_message_receiver_t function, determine at which location
PATH may be expected in the next log message, and set *PREV_PATH_P
to that value. KIND is the node kind of PATH. Set *ACTION_P to a
character describing the change that caused this revision (as
listed in svn_log_changed_path_t) and set *COPYFROM_REV_P to the
revision PATH was copied from, or SVN_INVALID_REVNUM if it was not
copied. ACTION_P and COPYFROM_REV_P may be NULL, in which case
they are not used. Perform all allocations in POOL.
This is useful for tracking the various changes in location a
particular resource has undergone when performing an RA->get_logs()
operation on that resource. */
svn_error_t *svn_client__prev_log_path (const char **prev_path_p,
char *action_p,
svn_revnum_t *copyfrom_rev_p,
apr_hash_t *changed_paths,
const char *path,
svn_node_kind_t kind,
svn_revnum_t revision,
apr_pool_t *pool);
/** Set @a *start_url and @a *start_revision (and maybe @a *end_url
* and @a *end_revision) to the revisions and repository URLs of one
* (or two) points of interest along a particular versioned resource's
* line of history. @a path as it exists in "peg revision" @a
* revision identifies that line of history, and @a start and @a end
* specify the point(s) of interest (typically the revisions referred
* to as the "operative range" for a given operation) along that history.
*
* @a end may be of kind svn_opt_revision_unspecified (in which case
* @a end_url and @a end_revision are not touched by the function);
* @a start and @a revision may not.
*
* A NOTE ABOUT FUTURE REPORTING:
*
* If either @a start or @end are greater than @a revision, then do a
* sanity check (since we cannot search future history yet): verify
* that @a path in the future revision(s) is the "same object" as the
* one pegged by @a revision. In other words, all three objects must
* be connected by a single line of history which exactly passes
* through @a path at @a revision. If this sanity check fails, return
* SVN_ERR_CLIENT_UNRELATED_RESOURCES.
*
* @a ctx is the client context baton.
*
* @a ra_lib is required; it represents an already-open RA library. A
* temporary RA session is created and destroyed for the purpose of
* this function.
*
* Use @a pool for all allocations.
*/
svn_error_t *
svn_client__repos_locations (const char **start_url,
svn_opt_revision_t **start_revision,
const char **end_url,
svn_opt_revision_t **end_revision,
const char *path,
const svn_opt_revision_t *revision,
const svn_opt_revision_t *start,
const svn_opt_revision_t *end,
svn_ra_plugin_t *ra_lib,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/* Given PATH_OR_URL, which contains either a working copy path or an
absolute url and a revision REVISION, create an RA connection to
that object as it exists in that revision, following copy history
if necessary.
The resulting ra_plugin is stored in *RA_LIB_P along with its
session baton in *SESSION_P. The actual revision number of the
object is stored in *REV_P and the final resulting url is stored in
*URL_P.
Use authentication baton cached in CTX to authenticate against the
repository.
Use POOL for all allocations. */
svn_error_t *
svn_client__ra_lib_from_path (svn_ra_plugin_t **ra_lib_p,
void **session_p,
svn_revnum_t *rev_p,
const char **url_p,
const char *path_or_url,
const svn_opt_revision_t *revision,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/* ---------------------------------------------------------------- */
/*** RA callbacks ***/
/* This is the baton that we pass to RA->open(), and is associated with
the callback table we provide to RA. */
typedef struct
{
/* Holds the directory that corresponds to the REPOS_URL at RA->open()
time. When callbacks specify a relative path, they are joined with
this base directory. */
const char *base_dir;
svn_wc_adm_access_t *base_access;
/* An array of svn_client_commit_item_t * structures, present only
during working copy commits. */
apr_array_header_t *commit_items;
/* A hash of svn_config_t's, keyed off file name (i.e. the contents of
~/.subversion/config end up keyed off of 'config'). */
apr_hash_t *config;
/* The pool to use for session-related items. */
apr_pool_t *pool;
} svn_client__callback_baton_t;
/* Open an RA session, returning the session baton in SESSION_BATON. The
RA library to use is specified by RA_LIB.
The root of the session is specified by BASE_URL and BASE_DIR.
BASE_ACCESS is an access baton for BASE_DIR administrative data.
Additional control parameters:
- COMMIT_ITEMS is an array of svn_client_commit_item_t *
structures, present only for working copy commits, NULL otherwise.
- USE_ADMIN indicates that the RA layer should create tempfiles
in the administrative area instead of in the working copy itself,
and read properties from the administrative area.
- READ_ONLY_WC indicates that the RA layer should not attempt to
modify the WC props directly.
BASE_DIR may be NULL if the RA operation does not correspond to a
working copy (in which case, USE_ADMIN should be FALSE, and
BASE_ACCESS should be null).
The calling application's authentication baton is provided in CTX,
and allocations related to this session are performed in POOL. */
svn_error_t * svn_client__open_ra_session (void **session_baton,
const svn_ra_plugin_t *ra_lib,
const char *base_url,
const char *base_dir,
svn_wc_adm_access_t *base_access,
apr_array_header_t *commit_items,
svn_boolean_t use_admin,
svn_boolean_t read_only_wc,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/* ---------------------------------------------------------------- */
/*** Commit ***/
/* Get the commit_baton to be used in couple with commit_callback. */
svn_error_t *svn_client__commit_get_baton (void **baton,
svn_client_commit_info_t **info,
apr_pool_t *pool);
/* The commit_callback function for storing svn_client_commit_info_t
pointed by commit_baton. If the commit_info supplied by get_baton
points to NULL after close_edit, it means the commit is a no-op.
*/
svn_error_t *svn_client__commit_callback (svn_revnum_t revision,
const char *date,
const char *author,
void *baton);
/* ---------------------------------------------------------------- */
/*** Status ***/
/* Verify that the path can be deleted without losing stuff,
i.e. ensure that there are no modified or unversioned resources
under PATH. This is similar to checking the output of the status
command. CTX is used for the client's config options. POOL is
used for all temporary allocations. */
svn_error_t * svn_client__can_delete (const char *path,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/* ---------------------------------------------------------------- */
/*** Add/delete ***/
/* Read automatic properties matching PATH from CTX->config.
Set *PROPERTIES to a hash containing propname/value pairs
(const char * keys mapping to svn_string_t * values), or if
auto-props are disabled, set *PROPERTIES to NULL.
Set *MIMETYPE to the mimetype, if any, or to NULL.
Allocate the hash table, keys, values, and mimetype in POOL. */
svn_error_t *svn_client__get_auto_props (apr_hash_t **properties,
const char **mimetype,
const char *path,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/* The main logic for client deletion from a working copy. Deletes PATH
from ADM_ACCESS. If PATH (or any item below a directory PATH) is
modified the delete will fail and return an error unless FORCE is TRUE.
If DRY_RUN is TRUE all the checks are made to ensure that the delete can
occur, but the working copy is not modifed. The NOTIFY_FUNC is called
with the NOTIFY_BATON for each file or directory deleted. */
svn_error_t * svn_client__wc_delete (const char *path,
svn_wc_adm_access_t *adm_access,
svn_boolean_t force,
svn_boolean_t dry_run,
svn_wc_notify_func_t notify_func,
void *notify_baton,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/* ---------------------------------------------------------------- */
/*** Checkout and update ***/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -