svn_fs.h File Reference

Interface to the Subversion filesystem. More...

#include <apr_pools.h>
#include <apr_hash.h>
#include <apr_tables.h>
#include "svn_types.h"
#include "svn_error.h"
#include "svn_delta.h"
#include "svn_io.h"

Go to the source code of this file.

Data Structures

struct  svn_fs_path_change_t
 Change descriptor. More...
struct  svn_fs_dirent_t
 The type of a Subversion directory entry. More...

Defines

#define SVN_FS_TXN_CHECK_OOD   0x00001
 Do on-the-fly out-of-dateness checks.
#define SVN_FS_TXN_CHECK_LOCKS   0x00002
 Do on-the-fly lock checks.
Filesystem configuration options
#define SVN_FS_CONFIG_BDB_TXN_NOSYNC   "bdb-txn-nosync"
#define SVN_FS_CONFIG_BDB_LOG_AUTOREMOVE   "bdb-log-autoremove"
#define SVN_FS_CONFIG_FS_TYPE   "fs-type"
 
Since:
New in 1.1.

#define SVN_FS_TYPE_BDB   "bdb"
 
Since:
New in 1.1.

#define SVN_FS_TYPE_FSFS   "fsfs"
 
Since:
New in 1.1.

#define SVN_FS_CONFIG_PRE_1_4_COMPATIBLE   "pre-1.4-compatible"
 Create repository format compatible with Subversion versions earlier than 1.4.

Typedefs

typedef svn_fs_t svn_fs_t
 An object representing a Subversion filesystem.
typedef void(*) svn_fs_warning_callback_t (void *baton, svn_error_t *err)
 The type of a warning callback function.
typedef svn_fs_access_t svn_fs_access_t
 An opaque object representing temporary user data.
typedef svn_fs_id_t svn_fs_id_t
 An object representing a node-id.
typedef svn_fs_txn_t svn_fs_txn_t
 The type of a Subversion transaction object.
typedef svn_fs_root_t svn_fs_root_t
 The Filesystem Root object.
typedef svn_fs_history_t svn_fs_history_t
 An opaque node history object.
typedef svn_error_t *(*) svn_fs_get_locks_callback_t (void *baton, svn_lock_t *lock, apr_pool_t *pool)
 The type of a lock discovery callback function.

Enumerations

enum  svn_fs_path_change_kind_t {
  svn_fs_path_change_modify = 0,
  svn_fs_path_change_add,
  svn_fs_path_change_delete,
  svn_fs_path_change_replace,
  svn_fs_path_change_reset
}
 The kind of change that occurred on the path. More...

Functions

const svn_version_tsvn_fs_version (void)
 Get libsvn_fs version information.
svn_error_tsvn_fs_initialize (apr_pool_t *pool)
 Callers should invoke this function to initialize global state in the FS library before creating FS objects.
void svn_fs_set_warning_func (svn_fs_t *fs, svn_fs_warning_callback_t warning, void *warning_baton)
 Provide a callback function, warning, that fs should use to report (non-fatal) errors.
svn_error_tsvn_fs_create (svn_fs_t **fs_p, const char *path, apr_hash_t *fs_config, apr_pool_t *pool)
 Create a new, empty Subversion filesystem, stored in the directory path, and return a pointer to it in *fs_p.
svn_error_tsvn_fs_open (svn_fs_t **fs_p, const char *path, apr_hash_t *config, apr_pool_t *pool)
 Open a Subversion filesystem located in the directory path, and return a pointer to it in *fs_p.
svn_error_tsvn_fs_type (const char **fs_type, const char *path, apr_pool_t *pool)
 Return, in *fs_type, a string identifying the back-end type of the Subversion filesystem located in path.
const char * svn_fs_path (svn_fs_t *fs, apr_pool_t *pool)
 Return the path to fs's repository, allocated in pool.
svn_error_tsvn_fs_delete_fs (const char *path, apr_pool_t *pool)
 Delete the filesystem at path.
svn_error_tsvn_fs_hotcopy (const char *src_path, const char *dest_path, svn_boolean_t clean, apr_pool_t *pool)
 Copy a possibly live Subversion filesystem from src_path to dest_path.
svn_error_tsvn_fs_set_berkeley_errcall (svn_fs_t *fs, void(*handler)(const char *errpfx, char *msg))
 Register an error handling function for Berkeley DB error messages.
svn_error_tsvn_fs_berkeley_recover (const char *path, apr_pool_t *pool)
 Perform any necessary non-catastrophic recovery on a Berkeley DB-based Subversion filesystem, stored in the environment path.
svn_error_tsvn_fs_berkeley_logfiles (apr_array_header_t **logfiles, const char *path, svn_boolean_t only_unused, apr_pool_t *pool)
 Set *logfiles to an array of const char * log file names of Berkeley DB-based Subversion filesystem.
svn_fs_tsvn_fs_new (apr_hash_t *fs_config, apr_pool_t *pool)
svn_error_tsvn_fs_create_berkeley (svn_fs_t *fs, const char *path)
svn_error_tsvn_fs_open_berkeley (svn_fs_t *fs, const char *path)
const char * svn_fs_berkeley_path (svn_fs_t *fs, apr_pool_t *pool)
svn_error_tsvn_fs_delete_berkeley (const char *path, apr_pool_t *pool)
svn_error_tsvn_fs_hotcopy_berkeley (const char *src_path, const char *dest_path, svn_boolean_t clean_logs, apr_pool_t *pool)
svn_error_tsvn_fs_create_access (svn_fs_access_t **access_ctx, const char *username, apr_pool_t *pool)
 Set *access_ctx to a new svn_fs_access_t object representing username, allocated in pool.
svn_error_tsvn_fs_set_access (svn_fs_t *fs, svn_fs_access_t *access_ctx)
 Associate access_ctx with an open fs.
svn_error_tsvn_fs_get_access (svn_fs_access_t **access_ctx, svn_fs_t *fs)
 Set *access_ctx to the current fs access context, or NULL if there is no current fs access context.
svn_error_tsvn_fs_access_get_username (const char **username, svn_fs_access_t *access_ctx)
 Set *username to the name represented by access_ctx.
svn_error_tsvn_fs_access_add_lock_token (svn_fs_access_t *access_ctx, const char *token)
 Push a lock-token token into the context access_ctx.
int svn_fs_compare_ids (const svn_fs_id_t *a, const svn_fs_id_t *b)
 Return -1, 0, or 1 if node revisions a and b are unrelated, equivalent, or otherwise related (respectively).
svn_boolean_t svn_fs_check_related (const svn_fs_id_t *id1, const svn_fs_id_t *id2)
 Return non-zero IFF the nodes associated with id1 and id2 are related, else return zero.
svn_fs_id_tsvn_fs_parse_id (const char *data, apr_size_t len, apr_pool_t *pool)
 
Note:
This function is not guaranteed to work with all filesystem types.

svn_string_tsvn_fs_unparse_id (const svn_fs_id_t *id, apr_pool_t *pool)
 Return a Subversion string containing the unparsed form of the node or node revision id id.
svn_error_tsvn_fs_begin_txn2 (svn_fs_txn_t **txn_p, svn_fs_t *fs, svn_revnum_t rev, apr_uint32_t flags, apr_pool_t *pool)
 Begin a new transaction on the filesystem fs, based on existing revision rev.
svn_error_tsvn_fs_begin_txn (svn_fs_txn_t **txn_p, svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool)
 Same as svn_fs_begin_txn2(), but with flags set to 0.
svn_error_tsvn_fs_commit_txn (const char **conflict_p, svn_revnum_t *new_rev, svn_fs_txn_t *txn, apr_pool_t *pool)
 Commit txn.
svn_error_tsvn_fs_abort_txn (svn_fs_txn_t *txn, apr_pool_t *pool)
 Abort the transaction txn.
svn_error_tsvn_fs_purge_txn (svn_fs_t *fs, const char *txn_id, apr_pool_t *pool)
 Cleanup the dead transaction in fs whose ID is txn_id.
svn_error_tsvn_fs_txn_name (const char **name_p, svn_fs_txn_t *txn, apr_pool_t *pool)
 Set *name_p to the name of the transaction txn, as a null-terminated string.
svn_revnum_t svn_fs_txn_base_revision (svn_fs_txn_t *txn)
 Return txn's base revision.
svn_error_tsvn_fs_open_txn (svn_fs_txn_t **txn, svn_fs_t *fs, const char *name, apr_pool_t *pool)
 Open the transaction named name in the filesystem fs.
svn_error_tsvn_fs_list_transactions (apr_array_header_t **names_p, svn_fs_t *fs, apr_pool_t *pool)
 Set *names_p to an array of const char * ids which are the names of all the currently active transactions in the filesystem fs.
svn_error_tsvn_fs_txn_prop (svn_string_t **value_p, svn_fs_txn_t *txn, const char *propname, apr_pool_t *pool)
 Set *value_p to the value of the property named propname on transaction txn.
svn_error_tsvn_fs_txn_proplist (apr_hash_t **table_p, svn_fs_txn_t *txn, apr_pool_t *pool)
 Set *table_p to the entire property list of transaction txn in filesystem fs, as an APR hash table allocated in pool.
svn_error_tsvn_fs_change_txn_prop (svn_fs_txn_t *txn, const char *name, const svn_string_t *value, apr_pool_t *pool)
 Change a transactions txn's property's value, or add/delete a property.
svn_error_tsvn_fs_revision_root (svn_fs_root_t **root_p, svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool)
 Set *root_p to the root directory of revision rev in filesystem fs.
svn_error_tsvn_fs_txn_root (svn_fs_root_t **root_p, svn_fs_txn_t *txn, apr_pool_t *pool)
 Set *root_p to the root directory of txn.
void svn_fs_close_root (svn_fs_root_t *root)
 Free the root directory root.
svn_fs_tsvn_fs_root_fs (svn_fs_root_t *root)
 Return the filesystem to which root belongs.
svn_boolean_t svn_fs_is_txn_root (svn_fs_root_t *root)
 Return TRUE iff root is a transaction root.
svn_boolean_t svn_fs_is_revision_root (svn_fs_root_t *root)
 Return TRUE iff root is a revision root.
const char * svn_fs_txn_root_name (svn_fs_root_t *root, apr_pool_t *pool)
 If root is the root of a transaction, return the name of the transaction, allocated in pool; otherwise, return null.
svn_revnum_t svn_fs_revision_root_revision (svn_fs_root_t *root)
 If root is the root of a revision, return the revision number.
svn_error_tsvn_fs_paths_changed (apr_hash_t **changed_paths_p, svn_fs_root_t *root, apr_pool_t *pool)
 Determine what has changed under a root.
svn_error_tsvn_fs_check_path (svn_node_kind_t *kind_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *kind_p to the type of node present at path under root.
svn_error_tsvn_fs_node_history (svn_fs_history_t **history_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *history_p to an opaque node history object which represents path under root.
svn_error_tsvn_fs_history_prev (svn_fs_history_t **prev_history_p, svn_fs_history_t *history, svn_boolean_t cross_copies, apr_pool_t *pool)
 Set *prev_history_t to an opaque node history object which represents the previous (or "next oldest") interesting history location for the filesystem node represented by history, or NULL if no such previous history exists.
svn_error_tsvn_fs_history_location (const char **path, svn_revnum_t *revision, svn_fs_history_t *history, apr_pool_t *pool)
 Set *path and *revision to the path and revision, respectively, of the history object.
svn_error_tsvn_fs_is_dir (svn_boolean_t *is_dir, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *is_dir to TRUE iff path in root is a directory.
svn_error_tsvn_fs_is_file (svn_boolean_t *is_file, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *is_file to TRUE iff path in root is a file.
svn_error_tsvn_fs_node_id (const svn_fs_id_t **id_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Get the id of a node.
svn_error_tsvn_fs_node_created_rev (svn_revnum_t *revision, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *revision to the revision in which path under root was created.
svn_error_tsvn_fs_node_created_path (const char **created_path, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *created_path to the path at which path under root was created.
svn_error_tsvn_fs_node_prop (svn_string_t **value_p, svn_fs_root_t *root, const char *path, const char *propname, apr_pool_t *pool)
 Set *value_p to the value of the property named propname of path in root.
svn_error_tsvn_fs_node_proplist (apr_hash_t **table_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *table_p to the entire property list of path in root, as an APR hash table allocated in pool.
svn_error_tsvn_fs_change_node_prop (svn_fs_root_t *root, const char *path, const char *name, const svn_string_t *value, apr_pool_t *pool)
 Change a node's property's value, or add/delete a property.
svn_error_tsvn_fs_props_changed (svn_boolean_t *changed_p, svn_fs_root_t *root1, const char *path1, svn_fs_root_t *root2, const char *path2, apr_pool_t *pool)
 Determine if the properties of two path/root combinations are different.
svn_error_tsvn_fs_copied_from (svn_revnum_t *rev_p, const char **path_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Discover a node's copy ancestry, if any.
svn_error_tsvn_fs_closest_copy (svn_fs_root_t **root_p, const char **path_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *root_p and *path_p to the revision root and path of the destination of the most recent copy event that caused path to exist where it does in root, or to null if no such copy exists.
svn_error_tsvn_fs_merge (const char **conflict_p, svn_fs_root_t *source_root, const char *source_path, svn_fs_root_t *target_root, const char *target_path, svn_fs_root_t *ancestor_root, const char *ancestor_path, apr_pool_t *pool)
 Merge changes between two nodes into a third node.
svn_error_tsvn_fs_dir_entries (apr_hash_t **entries_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *entries_p to a newly allocated APR hash table containing the entries of the directory at path in root.
svn_error_tsvn_fs_make_dir (svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Create a new directory named path in root.
svn_error_tsvn_fs_delete (svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Delete the node named path in root.
svn_error_tsvn_fs_copy (svn_fs_root_t *from_root, const char *from_path, svn_fs_root_t *to_root, const char *to_path, apr_pool_t *pool)
 Create a copy of from_path in from_root named to_path in to_root.
svn_error_tsvn_fs_revision_link (svn_fs_root_t *from_root, svn_fs_root_t *to_root, const char *path, apr_pool_t *pool)
 Like svn_fs_copy(), but doesn't record copy history, and preserves the PATH.
svn_error_tsvn_fs_file_length (svn_filesize_t *length_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *length_p to the length of the file path in root, in bytes.
svn_error_tsvn_fs_file_md5_checksum (unsigned char digest[], svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Put the MD5 checksum of file path into digest, which points to APR_MD5_DIGESTSIZE bytes of storage.
svn_error_tsvn_fs_file_contents (svn_stream_t **contents, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Set *contents to a readable generic stream that will yield the contents of the file path in root.
svn_error_tsvn_fs_make_file (svn_fs_root_t *root, const char *path, apr_pool_t *pool)
 Create a new file named path in root.
svn_error_tsvn_fs_apply_textdelta (svn_txdelta_window_handler_t *contents_p, void **contents_baton_p, svn_fs_root_t *root, const char *path, const char *base_checksum, const char *result_checksum, apr_pool_t *pool)
 Apply a text delta to the file path in root.
svn_error_tsvn_fs_apply_text (svn_stream_t **contents_p, svn_fs_root_t *root, const char *path, const char *result_checksum, apr_pool_t *pool)
 Write data directly to the file path in root.
svn_error_tsvn_fs_contents_changed (svn_boolean_t *changed_p, svn_fs_root_t *root1, const char *path1, svn_fs_root_t *root2, const char *path2, apr_pool_t *pool)
 Check if the contents of two root/path combos have changed.
svn_error_tsvn_fs_youngest_rev (svn_revnum_t *youngest_p, svn_fs_t *fs, apr_pool_t *pool)
 Set *youngest_p to the number of the youngest revision in filesystem fs.
svn_error_tsvn_fs_deltify_revision (svn_fs_t *fs, svn_revnum_t revision, apr_pool_t *pool)
 Deltify predecessors of paths modified in revision in filesystem fs.
svn_error_tsvn_fs_revision_prop (svn_string_t **value_p, svn_fs_t *fs, svn_revnum_t rev, const char *propname, apr_pool_t *pool)
 Set *value_p to the value of the property named propname on revision rev in the filesystem fs.
svn_error_tsvn_fs_revision_proplist (apr_hash_t **table_p, svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool)
 Set *table_p to the entire property list of revision rev in filesystem fs, as an APR hash table allocated in pool.
svn_error_tsvn_fs_change_rev_prop (svn_fs_t *fs, svn_revnum_t rev, const char *name, const svn_string_t *value, apr_pool_t *pool)
 Change a revision's property's value, or add/delete a property.
svn_error_tsvn_fs_get_file_delta_stream (svn_txdelta_stream_t **stream_p, svn_fs_root_t *source_root, const char *source_path, svn_fs_root_t *target_root, const char *target_path, apr_pool_t *pool)
 Set *stream_p to a pointer to a delta stream that will turn the contents of the file source into the contents of the file target.
svn_error_tsvn_fs_get_uuid (svn_fs_t *fs, const char **uuid, apr_pool_t *pool)
 Populate *uuid with the UUID associated with fs.
svn_error_tsvn_fs_set_uuid (svn_fs_t *fs, const char *uuid, apr_pool_t *pool)
 Associate *uuid with fs.
svn_error_tsvn_fs_lock (svn_lock_t **lock, svn_fs_t *fs, const char *path, const char *token, const char *comment, svn_boolean_t is_dav_comment, apr_time_t expiration_date, svn_revnum_t current_rev, svn_boolean_t steal_lock, apr_pool_t *pool)
 Lock path in fs, and set *lock to a lock representing the new lock, allocated in pool.
svn_error_tsvn_fs_generate_lock_token (const char **token, svn_fs_t *fs, apr_pool_t *pool)
 Generate a unique lock-token using fs.
svn_error_tsvn_fs_unlock (svn_fs_t *fs, const char *path, const char *token, svn_boolean_t break_lock, apr_pool_t *pool)
 Remove the lock on path represented by token in fs.
svn_error_tsvn_fs_get_lock (svn_lock_t **lock, svn_fs_t *fs, const char *path, apr_pool_t *pool)
 If path is locked in fs, set *lock to an svn_lock_t which represents the lock, allocated in pool.
svn_error_tsvn_fs_get_locks (svn_fs_t *fs, const char *path, svn_fs_get_locks_callback_t get_locks_func, void *get_locks_baton, apr_pool_t *pool)
 Report locks on or below path in fs using the get_locks_func / get_locks_baton.
svn_error_tsvn_fs_print_modules (svn_stringbuf_t *output, apr_pool_t *pool)
 Append a textual list of all available FS modules to the stringbuf output.


Detailed Description

Interface to the Subversion filesystem.

Definition in file svn_fs.h.


Define Documentation

#define SVN_FS_CONFIG_PRE_1_4_COMPATIBLE   "pre-1.4-compatible"

Create repository format compatible with Subversion versions earlier than 1.4.

Since:
New in 1.4.

Definition at line 75 of file svn_fs.h.


Typedef Documentation

typedef void(*) svn_fs_warning_callback_t(void *baton, svn_error_t *err)

The type of a warning callback function.

baton is the value specified in the call to svn_fs_set_warning_func(); the filesystem passes it through to the callback. err contains the warning message.

The callback function should not clear the error that is passed to it; its caller should do that.

Definition at line 108 of file svn_fs.h.


Function Documentation

svn_error_t* svn_fs_apply_text ( svn_stream_t **  contents_p,
svn_fs_root_t root,
const char *  path,
const char *  result_checksum,
apr_pool_t *  pool 
)

Write data directly to the file path in root.

root must be the root of a transaction, not a revision.

Set *contents_p to a stream ready to receive full textual data. When the caller closes this stream, the data replaces the previous contents of the file. The caller must write all file data and close the stream before making further changes to the transaction.

If path does not exist in root, return an error. (You cannot use this routine to create new files; use svn_fs_make_file() to create an empty file first.)

result_checksum is the hex MD5 digest for the final fulltext written to the stream. It is ignored if null, but if not null, it must match the checksum of the result; if it does not, then the *contents_p call which detects the mismatch will return the error SVN_ERR_CHECKSUM_MISMATCH.

Do any necessary temporary allocation in pool.

### This is like svn_fs_apply_textdelta(), but takes the text straight. It is currently used only by the loader, see libsvn_repos/load.c. It should accept a checksum, of course, which would come from an (optional) header in the dump file. See http://subversion.tigris.org/issues/show_bug.cgi?id=1102 for more.

svn_error_t* svn_fs_apply_textdelta ( svn_txdelta_window_handler_t contents_p,
void **  contents_baton_p,
svn_fs_root_t root,
const char *  path,
const char *  base_checksum,
const char *  result_checksum,
apr_pool_t *  pool 
)

Apply a text delta to the file path in root.

root must be the root of a transaction, not a revision.

Set *contents_p to a function ready to receive text delta windows describing how to change the file's contents, relative to its current contents. Set *contents_baton_p to a baton to pass to *contents_p.

If path does not exist in root, return an error. (You cannot use this routine to create new files; use svn_fs_make_file() to create an empty file first.)

base_checksum is the hex MD5 digest for the base text against which the delta is to be applied; it is ignored if null, and may be ignored even if not null. If it is not ignored, it must match the checksum of the base text against which svndiff data is being applied; if not, svn_fs_apply_textdelta() or the *contents_p call which detects the mismatch will return the error SVN_ERR_CHECKSUM_MISMATCH (if there is no base text, there may still be an error if base_checksum is neither null nor the checksum of the empty string).

result_checksum is the hex MD5 digest for the fulltext that results from this delta application. It is ignored if null, but if not null, it must match the checksum of the result; if it does not, then the *contents_p call which detects the mismatch will return the error SVN_ERR_CHECKSUM_MISMATCH.

The caller must send all delta windows including the terminating NULL window to *contents_p before making further changes to the transaction.

Do temporary allocation in pool.

svn_error_t* svn_fs_change_node_prop ( svn_fs_root_t root,
const char *  path,
const char *  name,
const svn_string_t value,
apr_pool_t *  pool 
)

Change a node's property's value, or add/delete a property.

svn_error_t* svn_fs_change_rev_prop ( svn_fs_t fs,
svn_revnum_t  rev,
const char *  name,
const svn_string_t value,
apr_pool_t *  pool 
)

Change a revision's property's value, or add/delete a property.

Note that revision properties are non-historied --- you can change them after the revision has been committed. They are not protected via transactions.

Do any necessary temporary allocation in pool.

svn_error_t* svn_fs_check_path ( svn_node_kind_t kind_p,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *kind_p to the type of node present at path under root.

If path does not exist under root, set *kind to svn_node_none. Use pool for temporary allocation.

svn_error_t* svn_fs_closest_copy ( svn_fs_root_t **  root_p,
const char **  path_p,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *root_p and *path_p to the revision root and path of the destination of the most recent copy event that caused path to exist where it does in root, or to null if no such copy exists.

When non-null, allocate *root_p and *path_p in pool.

*path_p might be a parent of path, rather than path itself. However, it will always be the deepest relevant path. That is, if a copy occurs underneath another copy in the same txn, this function makes sure to set *path_p to the longest copy destination path that is still a parent of or equal to path.

Since:
New in 1.3.

svn_error_t* svn_fs_contents_changed ( svn_boolean_t changed_p,
svn_fs_root_t root1,
const char *  path1,
svn_fs_root_t root2,
const char *  path2,
apr_pool_t *  pool 
)

Check if the contents of two root/path combos have changed.

Set *changed_p to 1 if the contents at path1 under root1 differ from those at path2 under root2, or set it to 0 if they are the same. Both paths must exist under their respective roots, and both roots must be in the same filesystem.

svn_error_t* svn_fs_copied_from ( svn_revnum_t rev_p,
const char **  path_p,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Discover a node's copy ancestry, if any.

If the node at path in root was copied from some other node, set *rev_p and *path_p to the revision and path of the other node, allocating *path_p in pool.

Else if there is no copy ancestry for the node, set *rev_p to SVN_INVALID_REVNUM and *path_p to null.

If an error is returned, the values of *rev_p and *path_p are undefined, but otherwise, if one of them is set as described above, you may assume the other is set correspondingly.

root may be a revision root or a transaction root.

Notes:

svn_error_t* svn_fs_copy ( svn_fs_root_t from_root,
const char *  from_path,
svn_fs_root_t to_root,
const char *  to_path,
apr_pool_t *  pool 
)

Create a copy of from_path in from_root named to_path in to_root.

If from_path in from_root is a directory, copy the tree it refers to recursively.

The copy will remember its source; use svn_fs_copied_from() to access this information.

to_root must be the root of a transaction; from_path must be the root of a revision. (Requiring from_path to be the root of a revision makes the implementation trivial: there is no detectable difference (modulo node revision ID's) between copying from and simply adding a reference to it. So the operation takes place in constant time. However, there's no reason not to extend this to mutable nodes --- it's just more code.) Further, to_root and from_root must represent the same filesystem.

Note:
To do a copy without preserving copy history, use svn_fs_revision_link().
Do any necessary temporary allocation in pool.

svn_error_t* svn_fs_create ( svn_fs_t **  fs_p,
const char *  path,
apr_hash_t *  fs_config,
apr_pool_t *  pool 
)

Create a new, empty Subversion filesystem, stored in the directory path, and return a pointer to it in *fs_p.

path must not currently exist, but its parent must exist. If fs_config is not NULL, the options it contains modify the behavior of the filesystem. The interpretation of fs_config is specific to the filesystem back-end. The new filesystem may be closed by destroying pool.

Note:
The lifetime of fs_config must not be shorter than pool's. It's a good idea to allocate fs_config from pool or one of its ancestors.
If fs_config contains a value for SVN_FS_CONFIG_FS_TYPE, that value determines the filesystem type for the new filesystem. Currently defined values are:

SVN_FS_TYPE_BDB Berkeley-DB implementation SVN_FS_TYPE_FSFS Native-filesystem implementation

If fs_config is NULL or does not contain a value for SVN_FS_CONFIG_FS_TYPE then the default filesystem type will be used. This will typically be BDB for version 1.1 and FSFS for later versions, though the caller should not rely upon any particular default if they wish to ensure that a filesystem of a specific type is created.

Since:
New in 1.1.

svn_error_t* svn_fs_delete ( svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Delete the node named path in root.

If the node being deleted is a directory, its contents will be deleted recursively. root must be the root of a transaction, not of a revision. Use pool for temporary allocation.

This function may be more efficient than making the equivalent series of calls to svn_fs_delete(), because it takes advantage of the fact that, to delete an immutable subtree, shared with some committed revision, you need only remove the directory entry. The dumb algorithm would recurse into the subtree and end up cloning each non-empty directory it contains, only to delete it later.

If return SVN_ERR_FS_NO_SUCH_ENTRY, then the basename of path is missing from its parent, that is, the final target of the deletion is missing.

Attempting to remove the root dir also results in an error, SVN_ERR_FS_ROOT_DIR, even if the dir is empty.

svn_error_t* svn_fs_delete_fs ( const char *  path,
apr_pool_t *  pool 
)

Delete the filesystem at path.

Since:
New in 1.1.

svn_error_t* svn_fs_deltify_revision ( svn_fs_t fs,
svn_revnum_t  revision,
apr_pool_t *  pool 
)

Deltify predecessors of paths modified in revision in filesystem fs.

Use pool for all allocations.

Note:
This can be a time-consuming process, depending the breadth of the changes made in revision, and the depth of the history of those changed paths.

svn_error_t* svn_fs_dir_entries ( apr_hash_t **  entries_p,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *entries_p to a newly allocated APR hash table containing the entries of the directory at path in root.

The keys of the table are entry names, as byte strings, excluding the final null character; the table's values are pointers to svn_fs_dirent_t structures. Allocate the table and its contents in pool.

svn_error_t* svn_fs_file_contents ( svn_stream_t **  contents,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *contents to a readable generic stream that will yield the contents of the file path in root.

Allocate the stream in pool. You can only use *contents for as long as the underlying filesystem is open. If path is not a file, return SVN_ERR_FS_NOT_FILE.

If root is the root of a transaction, it is possible that the contents of the file path will change between calls to svn_fs_file_contents(). In that case, the result of reading from *contents is undefined.

### kff todo: I am worried about lifetime issues with this pool vs the trail created farther down the call stack. Trace this function to investigate...

svn_error_t* svn_fs_file_length ( svn_filesize_t length_p,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *length_p to the length of the file path in root, in bytes.

Do any necessary temporary allocation in pool.

svn_error_t* svn_fs_file_md5_checksum ( unsigned char  digest[],
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Put the MD5 checksum of file path into digest, which points to APR_MD5_DIGESTSIZE bytes of storage.

Use pool only for temporary allocations.

If the filesystem does not have a prerecorded checksum for path, do not calculate a checksum dynamically, just put all 0's into digest. (By convention, the all-zero checksum is considered to match any checksum.)

Notes:

You might wonder, why do we only provide this interface for file contents, and not for properties or directories?

The answer is that property lists and directory entry lists are essentially data structures, not text. We serialize them for transmission, but there is no guarantee that the consumer will parse them into the same form, or even the same order, as the producer. It's difficult to find a checksumming method that reaches the same result given such variation in input. (I suppose we could calculate an independent MD5 sum for each propname and value, and XOR them together; same with directory entry names. Maybe that's the solution?) Anyway, for now we punt. The most important data, and the only data that goes through svndiff processing, is file contents, so that's what we provide checksumming for.

Internally, of course, the filesystem checksums everything, because it has access to the lowest level storage forms: strings behind representations.

svn_error_t* svn_fs_get_file_delta_stream ( svn_txdelta_stream_t **  stream_p,
svn_fs_root_t source_root,
const char *  source_path,
svn_fs_root_t target_root,
const char *  target_path,
apr_pool_t *  pool 
)

Set *stream_p to a pointer to a delta stream that will turn the contents of the file source into the contents of the file target.

If source_root is zero, use a file with zero length as the source.

This function does not compare the two files' properties.

Allocate *stream_p, and do any necessary temporary allocation, in pool.

svn_error_t* svn_fs_get_uuid ( svn_fs_t fs,
const char **  uuid,
apr_pool_t *  pool 
)

Populate *uuid with the UUID associated with fs.

Allocate *uuid in pool.

svn_error_t* svn_fs_history_location ( const char **  path,
svn_revnum_t revision,
svn_fs_history_t history,
apr_pool_t *  pool 
)

Set *path and *revision to the path and revision, respectively, of the history object.

Use pool for all allocations.

svn_error_t* svn_fs_history_prev ( svn_fs_history_t **  prev_history_p,
svn_fs_history_t history,
svn_boolean_t  cross_copies,
apr_pool_t *  pool 
)

Set *prev_history_t to an opaque node history object which represents the previous (or "next oldest") interesting history location for the filesystem node represented by history, or NULL if no such previous history exists.

If cross_copies is FALSE, also return NULL if stepping backwards in history to prev_history_t would cross a filesystem copy operation.

Note:
If this is the first call to svn_fs_history_prev() for the history object, it could return a history object whose location is the same as the original. This will happen if the original location was an interesting one (where the node was modified, or took place in a copy event). This behavior allows looping callers to avoid the calling svn_fs_history_location() on the object returned by svn_fs_node_history(), and instead go ahead and begin calling svn_fs_history_prev().

This function uses node-id ancestry alone to determine modifiedness, and therefore does NOT claim that in any of the returned revisions file contents changed, properties changed, directory entries lists changed, etc.

The revisions returned for path will be older than or the same age as the revision of that path in root. That is, if root is a revision root based on revision X, and path was modified in some revision(s) younger than X, those revisions younger than X will not be included for path.

svn_error_t* svn_fs_hotcopy ( const char *  src_path,
const char *  dest_path,
svn_boolean_t  clean,
apr_pool_t *  pool 
)

Copy a possibly live Subversion filesystem from src_path to dest_path.

If clean is TRUE, perform cleanup on the source filesystem as part of the copy operation; currently, this means deleting copied, unused logfiles for a Berkeley DB source filesystem.

Since:
New in 1.1.

svn_error_t* svn_fs_initialize ( apr_pool_t *  pool  ) 

Callers should invoke this function to initialize global state in the FS library before creating FS objects.

If this function is invoked, no FS objects may be created in another thread at the same time as this invocation, and the provided pool must last longer than any FS object created subsequently.

If this function is not called, the FS library will make a best effort to bootstrap a mutex for protecting data common to FS objects; however, there is a small window of failure. Also, a small amount of data will be leaked if the Subversion FS library is dynamically unloaded.

If this function is called multiple times before the pool passed to the first call is destroyed or cleared, the later calls will have no effect.

Since:
New in 1.2.

svn_error_t* svn_fs_is_dir ( svn_boolean_t is_dir,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *is_dir to TRUE iff path in root is a directory.

Do any necessary temporary allocation in pool.

svn_error_t* svn_fs_is_file ( svn_boolean_t is_file,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *is_file to TRUE iff path in root is a file.

Do any necessary temporary allocation in pool.

svn_error_t* svn_fs_make_dir ( svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Create a new directory named path in root.

The new directory has no entries, and no properties. root must be the root of a transaction, not a revision.

Do any necessary temporary allocation in pool.

svn_error_t* svn_fs_make_file ( svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Create a new file named path in root.

The file's initial contents are the empty string, and it has no properties. root must be the root of a transaction, not a revision.

Do any necessary temporary allocation in pool.

svn_error_t* svn_fs_merge ( const char **  conflict_p,
svn_fs_root_t source_root,
const char *  source_path,
svn_fs_root_t target_root,
const char *  target_path,
svn_fs_root_t ancestor_root,
const char *  ancestor_path,
apr_pool_t *  pool 
)

Merge changes between two nodes into a third node.

Given nodes source and target, and a common ancestor ancestor, modify target to contain all the changes made between ancestor and source, as well as the changes made between ancestor and target. target_root must be the root of a transaction, not a revision.

source, target, and ancestor are generally directories; this function recursively merges the directories' contents. If they are files, this function simply returns an error whenever source, target, and ancestor are all distinct node revisions.

If there are differences between ancestor and source that conflict with changes between ancestor and target, this function returns an SVN_ERR_FS_CONFLICT error.

If the merge is successful, target is left in the merged state, and the base root of target's txn is set to the root node of source. If an error is returned (whether for conflict or otherwise), target is left unaffected.

If conflict_p is non-null, then: a conflict error sets *conflict_p to the name of the node in target which couldn't be merged, otherwise, success sets *conflict_p to null.

Do any necessary temporary allocation in pool.

svn_error_t* svn_fs_node_created_path ( const char **  created_path,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *created_path to the path at which path under root was created.

Use pool for all allocations. Callers may use this function in conjunction with svn_fs_node_created_rev() perform a reverse lookup of the mapping of (path, revision) -> node-id that svn_fs_node_id() performs.

svn_error_t* svn_fs_node_created_rev ( svn_revnum_t revision,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *revision to the revision in which path under root was created.

Use pool for any temporary allocations. *revision will be set to SVN_INVALID_REVNUM for uncommitted nodes (i.e. modified nodes under a transaction root).

svn_error_t* svn_fs_node_history ( svn_fs_history_t **  history_p,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *history_p to an opaque node history object which represents path under root.

root must be a revision root. Use pool for all allocations.

svn_error_t* svn_fs_node_id ( const svn_fs_id_t **  id_p,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Get the id of a node.

Set *id_p to the node revision ID of path in root, allocated in pool.

If root is the root of a transaction, keep in mind that other changes to the transaction can change which node path refers to, and even whether the path exists at all.

svn_error_t* svn_fs_node_prop ( svn_string_t **  value_p,
svn_fs_root_t root,
const char *  path,
const char *  propname,
apr_pool_t *  pool 
)

Set *value_p to the value of the property named propname of path in root.

If the node has no property by that name, set *value_p to zero. Allocate the result in pool.

svn_error_t* svn_fs_node_proplist ( apr_hash_t **  table_p,
svn_fs_root_t root,
const char *  path,
apr_pool_t *  pool 
)

Set *table_p to the entire property list of path in root, as an APR hash table allocated in pool.

The resulting table maps property names to pointers to svn_string_t objects containing the property value.

svn_error_t* svn_fs_open ( svn_fs_t **  fs_p,
const char *  path,
apr_hash_t *  config,
apr_pool_t *  pool 
)

Open a Subversion filesystem located in the directory path, and return a pointer to it in *fs_p.

If fs_config is not NULL, the options it contains modify the behavior of the filesystem. The interpretation of fs_config is specific to the filesystem back-end. The opened filesystem may be closed by destroying pool.

Note:
The lifetime of fs_config must not be shorter than pool's. It's a good idea to allocate fs_config from pool or one of its ancestors.
Only one thread may operate on any given filesystem object at once. Two threads may access the same filesystem simultaneously only if they open separate filesystem objects.

Note:
You probably don't want to use this directly. Take a look at svn_repos_open() instead.
Since:
New in 1.1.

const char* svn_fs_path ( svn_fs_t fs,
apr_pool_t *  pool 
)

Return the path to fs's repository, allocated in pool.

Note:
This is just what was passed to svn_fs_create() or svn_fs_open() -- might be absolute, might not.
Since:
New in 1.1.

svn_error_t* svn_fs_print_modules ( svn_stringbuf_t output,
apr_pool_t *  pool 
)

Append a textual list of all available FS modules to the stringbuf output.

Since:
New in 1.2.

svn_error_t* svn_fs_props_changed ( svn_boolean_t changed_p,
svn_fs_root_t root1,
const char *  path1,
svn_fs_root_t root2,
const char *  path2,
apr_pool_t *  pool 
)

Determine if the properties of two path/root combinations are different.

Set *changed_p to 1 if the properties at path1 under root1 differ from those at path2 under root2, or set it to 0 if they are the same. Both paths must exist under their respective roots, and both roots must be in the same filesystem.

svn_error_t* svn_fs_revision_link ( svn_fs_root_t from_root,
svn_fs_root_t to_root,
const char *  path,
apr_pool_t *  pool 
)

Like svn_fs_copy(), but doesn't record copy history, and preserves the PATH.

You cannot use svn_fs_copied_from() later to find out where this copy came from.

Use svn_fs_revision_link() in situations where you don't care about the copy history, and where to_path and from_path are the same, because it is cheaper than svn_fs_copy().

svn_error_t* svn_fs_revision_prop ( svn_string_t **  value_p,
svn_fs_t fs,
svn_revnum_t  rev,
const char *  propname,
apr_pool_t *  pool 
)

Set *value_p to the value of the property named propname on revision rev in the filesystem fs.

If rev has no property by that name, set *value_p to zero. Allocate the result in pool.

svn_error_t* svn_fs_revision_proplist ( apr_hash_t **  table_p,
svn_fs_t fs,
svn_revnum_t  rev,
apr_pool_t *  pool 
)

Set *table_p to the entire property list of revision rev in filesystem fs, as an APR hash table allocated in pool.

The table maps char * property names to svn_string_t * values; the names and values are allocated in pool.

svn_error_t* svn_fs_set_uuid ( svn_fs_t fs,
const char *  uuid,
apr_pool_t *  pool 
)

Associate *uuid with fs.

Use pool for any scratchwork.

void svn_fs_set_warning_func ( svn_fs_t fs,
svn_fs_warning_callback_t  warning,
void *  warning_baton 
)

Provide a callback function, warning, that fs should use to report (non-fatal) errors.

To print an error, the filesystem will call warning, passing it warning_baton and the error.

By default, this is set to a function that will crash the process. Dumping to stderr or /dev/tty is not acceptable default behavior for server processes, since those may both be equivalent to /dev/null.

svn_error_t* svn_fs_type ( const char **  fs_type,
const char *  path,
apr_pool_t *  pool 
)

Return, in *fs_type, a string identifying the back-end type of the Subversion filesystem located in path.

Allocate *fs_type in pool.

The string should be equal to one of the SVN_FS_TYPE_* defined constants, unless the filesystem is a new back-end type added in a later version of Subversion.

In general, the type should make no difference in the filesystem's semantics, but there are a few situations (such as backups) where it might matter.

Since:
New in 1.3.

const svn_version_t* svn_fs_version ( void   ) 

Get libsvn_fs version information.

Since:
New in 1.1.

svn_error_t* svn_fs_youngest_rev ( svn_revnum_t youngest_p,
svn_fs_t fs,
apr_pool_t *  pool 
)

Set *youngest_p to the number of the youngest revision in filesystem fs.

Use pool for all temporary allocation.

The oldest revision in any filesystem is numbered zero.


Generated on Wed Mar 28 23:32:01 2007 for Subversion by  doxygen 1.5.1