📄 svn_wc.h
字号:
/**
* @copyright
* ====================================================================
* 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/.
* ====================================================================
* @endcopyright
*
* @file svn_wc.h
* @brief public interface for the Subversion Working Copy Library
*
* Requires:
* - A working copy
*
* Provides:
* - Ability to manipulate working copy's versioned data.
* - Ability to manipulate working copy's administrative files.
*
* Used By:
* - Clients.
*/
#ifndef SVN_WC_H
#define SVN_WC_H
#include <apr.h>
#include <apr_pools.h>
#include <apr_tables.h>
#include <apr_hash.h>
#include "svn_types.h"
#include "svn_string.h"
#include "svn_delta.h"
#include "svn_error.h"
#include "svn_opt.h"
#include "svn_ra.h" /* for svn_ra_reporter_t type */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Get libsvn_wc version information.
* @since New in 1.1.
*/
const svn_version_t *svn_wc_version (void);
/* Locking/Opening/Closing */
/** Baton for access to a working copy administrative area.
*
* One day all such access will require a baton, we're not there yet.
*
* Access batons can be grouped into sets, by passing an existing open
* baton when opening a new baton. Given one baton in a set, other batons
* may be retrieved. This allows an entire hierarchy to be locked, and
* then the set of batons can be passed around by passing a single baton.
*/
typedef struct svn_wc_adm_access_t svn_wc_adm_access_t;
/**
* @since New in 1.1.
*
* Return, in @a *adm_access, a pointer to a new access baton for the working
* copy administrative area associated with the directory @a path. If
* @a write_lock is true the baton will include a write lock, otherwise the
* baton can only be used for read access. If @a path refers to a directory
* that is already write locked then the error @c SVN_ERR_WC_LOCKED will be
* returned. The error @c SVN_ERR_WC_NOT_DIRECTORY will be returned if
* @a path is not a versioned directory.
*
* If @a associated is an open access baton then @a adm_access will be added
* to the set containing @a associated. @a associated can be @c NULL, in
* which case @a adm_access is the start of a new set.
*
* @a depth specifies how much to lock. Zero means just the specified
* directory. Any negative value means to lock the entire working copy
* directory hierarchy under @a path. A positive value indicates the number of
* levels of directories to lock -- 1 means just immediate subdirectories, 2
* means immediate subdirectories and their subdirectories, etc. All the
* access batons will become part of the set containing @a adm_access. This
* is an all-or-nothing option, if it is not possible to lock all the
* requested directories then an error will be returned and @a adm_access will
* be invalid, with the exception that subdirectories of @a path that are
* missing from the physical filesystem will not be locked and will not cause
* an error. The error @c SVN_ERR_WC_LOCKED will be returned if a
* subdirectory of @a path is already write locked.
*
* @a pool will be used to allocate memory for the baton and any subsequently
* cached items. If @a adm_access has not been closed when the pool is
* cleared, it will be closed automatically at that point, and removed from
* its set. A baton closed in this way will not remove physical locks from
* the working copy if cleanup is required.
*
* The first baton in a set, with @a associated passed as @c NULL, must have
* the longest lifetime of all the batons in the set. This implies it must be
* the root of the hierarchy.
*/
svn_error_t *svn_wc_adm_open2 (svn_wc_adm_access_t **adm_access,
svn_wc_adm_access_t *associated,
const char *path,
svn_boolean_t write_lock,
int depth,
apr_pool_t *pool);
/**
* @deprecated Provided for backward compatibility with the 1.0.0 API.
*
* Similar to svn_wc_adm_open2(). @a depth is set to -1 if @a tree_lock
* is @c TRUE, else 0.
*/
svn_error_t *svn_wc_adm_open (svn_wc_adm_access_t **adm_access,
svn_wc_adm_access_t *associated,
const char *path,
svn_boolean_t write_lock,
svn_boolean_t tree_lock,
apr_pool_t *pool);
/**
* @since New in 1.1.
*
* Checks the working copy to determine the node type of @a path. If
* @a path is a versioned directory then the behaviour is like that of
* @c svn_wc_adm_open2, otherwise, if @a path is a file or does not
* exist, then the behaviour is like that of @c svn_wc_adm_open2 with
* @a path replaced by the parent directory of @a path. If @a path is
* an unversioned directory, the behaviour is also like that of
* @c svn_wc_adm_open2 on the parent, except that if the open fails,
* then the returned SVN_ERR_WC_NOT_DIRECTORY error refers to @a path,
* not to @a path's parent.
*/
svn_error_t *svn_wc_adm_probe_open2 (svn_wc_adm_access_t **adm_access,
svn_wc_adm_access_t *associated,
const char *path,
svn_boolean_t write_lock,
int depth,
apr_pool_t *pool);
/**
* @deprecated Provided for backward compatibility with the 1.0.0 API.
*
* Similar to svn_wc_adm_probe_open2(). @a depth is set to -1 if
* @a tree_lock is @c TRUE, else 0.
*/
svn_error_t *svn_wc_adm_probe_open (svn_wc_adm_access_t **adm_access,
svn_wc_adm_access_t *associated,
const char *path,
svn_boolean_t write_lock,
svn_boolean_t tree_lock,
apr_pool_t *pool);
/** Return, in @a *adm_access, a pointer to an existing access baton associated
* with @a path. @a path must be a directory that is locked as part of the
* set containing the @a associated access baton.
*
* If the requested access baton is marked as missing in, or is simply
* absent from, @a associated, return SVN_ERR_WC_NOT_LOCKED.
*
* @a pool is used only for local processing, it is not used for the batons.
*/
svn_error_t *svn_wc_adm_retrieve (svn_wc_adm_access_t **adm_access,
svn_wc_adm_access_t *associated,
const char *path,
apr_pool_t *pool);
/** Checks the working copy to determine the node type of @a path. If
* @a path is a versioned directory then the behaviour is like that of
* @c svn_wc_adm_retrieve, otherwise, if @a path is a file, an unversioned
* directory, or does not exist, then the behaviour is like that of
* @c svn_wc_adm_retrieve with @a path replaced by the parent directory of
* @a path.
*/
svn_error_t *svn_wc_adm_probe_retrieve (svn_wc_adm_access_t **adm_access,
svn_wc_adm_access_t *associated,
const char *path,
apr_pool_t *pool);
/**
* @since New in 1.1.
*
* Try various ways to obtain an access baton for @a path.
*
* First, try to obtain @a *adm_access via @c svn_wc_adm_probe_retrieve(),
* but if this fails because @a associated can't give a baton for
* @a path or @a path's parent, then try @c svn_wc_adm_probe_open2(),
* this time passing @a write_lock and @a depth. If there is
* still no access because @a path is not a versioned directory, then
* just set @a *adm_access to null and return success. But if it is
* because @a path is locked, then return the error @c SVN_ERR_WC_LOCKED,
* and the effect on @a *adm_access is undefined. (Or if the attempt
* fails for any other reason, return the corresponding error, and the
* effect on @a *adm_access is also undefined.)
*
* If @c svn_wc_adm_probe_open() succeeds, then add @a *adm_access to
* @a associated.
*
* Use @a pool only for local processing, not to allocate @a *adm_access.
*/
svn_error_t *svn_wc_adm_probe_try2 (svn_wc_adm_access_t **adm_access,
svn_wc_adm_access_t *associated,
const char *path,
svn_boolean_t write_lock,
int depth,
apr_pool_t *pool);
/**
* @deprecated Provided for backward compatibility with the 1.0.0 API.
*
* Similar to svn_wc_adm_probe_try2(). @a depth is set to -1 if
* @a tree_lock is @c TRUE, else 0.
*/
svn_error_t *svn_wc_adm_probe_try (svn_wc_adm_access_t **adm_access,
svn_wc_adm_access_t *associated,
const char *path,
svn_boolean_t write_lock,
svn_boolean_t tree_lock,
apr_pool_t *pool);
/** Give up the access baton @a adm_access, and its lock if any. This will
* recursively close any batons in the same set that are direct
* subdirectories of @a adm_access. Any physical locks will be removed from
* the working copy. Lock removal is unconditional, there is no check to
* determine if cleanup is required.
*/
svn_error_t *svn_wc_adm_close (svn_wc_adm_access_t *adm_access);
/** Return the path used to open the access baton @a adm_access */
const char *svn_wc_adm_access_path (svn_wc_adm_access_t *adm_access);
/** Return the pool used by access baton @a adm_access */
apr_pool_t *svn_wc_adm_access_pool (svn_wc_adm_access_t *adm_access);
/** Return @c TRUE is the access baton @a adm_access has a write lock,
* @c FALSE otherwise. Compared to @c svn_wc_locked this is a cheap, fast
* function that doesn't access the filesystem.
*/
svn_boolean_t svn_wc_adm_locked(svn_wc_adm_access_t *adm_access);
/** Set @a *locked to non-zero if @a path is locked, else set it to zero. */
svn_error_t *svn_wc_locked (svn_boolean_t *locked,
const char *path,
apr_pool_t *pool);
/** Traversal information is information gathered by a working copy
* crawl or update. For example, the before and after values of the
* svn:externals property are important after an update, and since
* we're traversing the working tree anyway (a complete traversal
* during the initial crawl, and a traversal of changed paths during
* the checkout/update/switch), it makes sense to gather the
* property's values then instead of making a second pass.
*/
typedef struct svn_wc_traversal_info_t svn_wc_traversal_info_t;
/** Return a new, empty traversal info object, allocated in @a pool. */
svn_wc_traversal_info_t *svn_wc_init_traversal_info (apr_pool_t *pool);
/** Set @a *externals_old and @a *externals_new to hash tables representing
* changes to values of the svn:externals property on directories
* traversed by @a traversal_info.
*
* @a traversal_info is obtained from @c svn_wc_init_traversal_info, but is
* only useful after it has been passed through another function, such
* as @c svn_wc_crawl_revisions, @c svn_wc_get_update_editor,
* @c svn_wc_get_checkout_editor, @c svn_wc_get_switch_editor, etc.
*
* Each hash maps <tt>const char *</tt> directory names onto
* <tt>const char *</tt> values of the externals property for that directory.
* The dir names are full paths -- that is, anchor plus target, not target
* alone. The values are not parsed, they are simply copied raw, and are
* never null: directories that acquired or lost the property are
* simply omitted from the appropriate table. Directories whose value
* of the property did not change show the same value in each hash.
*
* The hashes, keys, and values have the same lifetime as @a traversal_info.
*/
void svn_wc_edited_externals (apr_hash_t **externals_old,
apr_hash_t **externals_new,
svn_wc_traversal_info_t *traversal_info);
/** One external item. This usually represents one line from an
* svn:externals description but with the path and URL
* canonicalized.
*/
typedef struct svn_wc_external_item_t
{
/** The name of the subdirectory into which this external should be
checked out. This is relative to the parent directory that
holds this external item. (Note that these structs are often
stored in hash tables with the target dirs as keys, so this
field will often be redundant.) */
const char *target_dir;
/** Where to check out from. */
const char *url;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -