#include <apr_pools.h>
#include <apr_hash.h>
#include "svn_fs.h"
#include "svn_delta.h"
#include "svn_types.h"
#include "svn_error.h"
Go to the source code of this file.
Data Structures | |
struct | svn_repos_node_t |
A node in the repository. More... | |
struct | svn_repos_parse_fns_t |
A vtable that is driven by svn_repos_parse_dumpstream . More... | |
Typedefs | |
typedef svn_error_t *(* | svn_repos_authz_func_t )(svn_boolean_t *allowed, svn_fs_root_t *root, const char *path, void *baton, apr_pool_t *pool) |
Callback type for checking authorization on paths produced by (at least) svn_repos_dir_delta(). | |
typedef svn_repos_t | svn_repos_t |
The repository object. | |
typedef svn_error_t *(* | svn_repos_history_func_t )(void *baton, const char *path, svn_revnum_t revision, apr_pool_t *pool) |
Callback type for use with svn_repos_history(). | |
typedef svn_repos_node_t | svn_repos_node_t |
A node in the repository. | |
typedef svn_repos_parse_fns_t | svn_repos_parser_fns_t |
A vtable that is driven by svn_repos_parse_dumpstream . | |
Enumerations | |
enum | svn_node_action |
The different "actions" attached to nodes in the dumpfile. | |
enum | svn_repos_load_uuid |
The different policies for processing the UUID in the dumpfile. | |
Functions | |
const char * | svn_repos_find_root_path (const char *path, apr_pool_t *pool) |
Find the root path of the repository that contains path. | |
svn_error_t * | svn_repos_open (svn_repos_t **repos_p, const char *path, apr_pool_t *pool) |
Set *repos_p to a repository object for the repository at path. | |
svn_error_t * | svn_repos_create (svn_repos_t **repos_p, const char *path, const char *unused_1, const char *unused_2, apr_hash_t *config, apr_hash_t *fs_config, apr_pool_t *pool) |
Create a new Subversion repository at path, building the necessary directory structure, creating the Berkeley DB filesystem environment, and so on. | |
svn_error_t * | svn_repos_delete (const char *path, apr_pool_t *pool) |
Destroy the Subversion repository found at path, using pool for any necessary allocations. | |
svn_fs_t * | svn_repos_fs (svn_repos_t *repos) |
Return the filesystem associated with repository object repos. | |
svn_error_t * | svn_repos_hotcopy (const char *src_path, const char *dst_path, svn_boolean_t clean_logs, apr_pool_t *pool) |
Make a hot copy of the Subversion repository found at src_path to dst_path. | |
svn_error_t * | svn_repos_recover (const char *path, apr_pool_t *pool) |
Run database recovery procedures on the repository at path, returning the database to a consistent state. | |
svn_error_t * | svn_repos_db_logfiles (apr_array_header_t **logfiles, const char *path, svn_boolean_t only_unused, apr_pool_t *pool) |
This function is a wrapper around svn_fs_berkeley_logfiles(), returning log file paths relative to the root of the repository. | |
const char * | svn_repos_path (svn_repos_t *repos, apr_pool_t *pool) |
Return the top-level repository path allocated in pool. | |
const char * | svn_repos_db_env (svn_repos_t *repos, apr_pool_t *pool) |
Return the path to repos's Berkeley DB environment, allocated in pool. | |
const char * | svn_repos_conf_dir (svn_repos_t *repos, apr_pool_t *pool) |
Return path to repos's config directory, allocated in pool. | |
const char * | svn_repos_svnserve_conf (svn_repos_t *repos, apr_pool_t *pool) |
Return path to repos's svnserve.conf, allocated in pool. | |
const char * | svn_repos_lock_dir (svn_repos_t *repos, apr_pool_t *pool) |
Return path to repos's lock directory, allocated in pool. | |
const char * | svn_repos_db_lockfile (svn_repos_t *repos, apr_pool_t *pool) |
Return path to repos's db lockfile, allocated in pool. | |
const char * | svn_repos_db_logs_lockfile (svn_repos_t *repos, apr_pool_t *pool) |
Return path to repos's db logs lockfile, allocated in pool. | |
const char * | svn_repos_hook_dir (svn_repos_t *repos, apr_pool_t *pool) |
Return the path to repos's hook directory, allocated in pool. | |
const char * | svn_repos_start_commit_hook (svn_repos_t *repos, apr_pool_t *pool) |
Return the path to repos's start-commit hook, allocated in pool. | |
const char * | svn_repos_pre_commit_hook (svn_repos_t *repos, apr_pool_t *pool) |
Return the path to repos's pre-commit hook, allocated in pool. | |
const char * | svn_repos_post_commit_hook (svn_repos_t *repos, apr_pool_t *pool) |
Return the path to repos's post-commit hook, allocated in pool. | |
const char * | svn_repos_pre_revprop_change_hook (svn_repos_t *repos, apr_pool_t *pool) |
Return the path to repos's pre-revprop-change hook, allocated in pool. | |
const char * | svn_repos_post_revprop_change_hook (svn_repos_t *repos, apr_pool_t *pool) |
Return the path to repos's post-revprop-change hook, allocated in pool. | |
svn_error_t * | svn_repos_begin_report (void **report_baton, svn_revnum_t revnum, const char *username, svn_repos_t *repos, const char *fs_base, const char *target, const char *tgt_path, svn_boolean_t text_deltas, svn_boolean_t recurse, svn_boolean_t ignore_ancestry, const svn_delta_editor_t *editor, void *edit_baton, svn_repos_authz_func_t authz_read_func, void *authz_read_baton, apr_pool_t *pool) |
Construct and return a report_baton that will be paired with some svn_ra_reporter_t table. | |
svn_error_t * | svn_repos_set_path (void *report_baton, const char *path, svn_revnum_t revision, svn_boolean_t start_empty, apr_pool_t *pool) |
Given a report_baton constructed by svn_repos_begin_report() , this routine will build revision:@a path into the current transaction. | |
svn_error_t * | svn_repos_link_path (void *report_baton, const char *path, const char *link_path, svn_revnum_t revision, svn_boolean_t start_empty, apr_pool_t *pool) |
Given a report_baton constructed by svn_repos_begin_report() , this routine will build revision:@a link_path into the current transaction at path. | |
svn_error_t * | svn_repos_delete_path (void *report_baton, const char *path, apr_pool_t *pool) |
Given a report_baton constructed by svn_repos_begin_report() , this routine will remove path from the current fs transaction. | |
svn_error_t * | svn_repos_finish_report (void *report_baton, apr_pool_t *pool) |
Make the filesystem compare the transaction to a revision and have it drive an update editor (using svn_repos_delta_dirs()) , then abort the transaction. | |
svn_error_t * | svn_repos_abort_report (void *report_baton, apr_pool_t *pool) |
The report-driver is bailing, so abort the fs transaction. | |
svn_error_t * | svn_repos_dir_delta (svn_fs_root_t *src_root, const char *src_parent_dir, const char *src_entry, svn_fs_root_t *tgt_root, const char *tgt_path, const svn_delta_editor_t *editor, void *edit_baton, svn_repos_authz_func_t authz_read_func, void *authz_read_baton, svn_boolean_t text_deltas, svn_boolean_t recurse, svn_boolean_t entry_props, svn_boolean_t ignore_ancestry, apr_pool_t *pool) |
Use the provided editor and edit_baton to describe the changes necessary for making a given node (and its descendants, if it is a directory) under src_root look exactly like tgt_path under tgt_root. | |
svn_error_t * | svn_repos_replay (svn_fs_root_t *root, const svn_delta_editor_t *editor, void *edit_baton, apr_pool_t *pool) |
Use the provided editor and edit_baton to describe the skeletal changes made in a particular filesystem root (revision or transaction). | |
svn_error_t * | svn_repos_get_commit_editor (const svn_delta_editor_t **editor, void **edit_baton, svn_repos_t *repos, const char *repos_url, const char *base_path, const char *user, const char *log_msg, svn_commit_callback_t callback, void *callback_baton, apr_pool_t *pool) |
Return an editor and edit_baton to commit changes to session->fs, beginning at location 'rev:base_path', where "rev" is the argument given to open_root() . | |
svn_error_t * | svn_repos_dated_revision (svn_revnum_t *revision, svn_repos_t *repos, apr_time_t tm, apr_pool_t *pool) |
Set *revision to the revision number in repos's filesystem that was youngest at time tm. | |
svn_error_t * | svn_repos_get_committed_info (svn_revnum_t *committed_rev, const char **committed_date, const char **last_author, svn_fs_root_t *root, const char *path, apr_pool_t *pool) |
Given a root/@a path within some filesystem, return three pieces of information allocated in pool:. | |
svn_error_t * | svn_repos_history (svn_fs_t *fs, const char *path, svn_repos_history_func_t history_func, void *history_baton, svn_revnum_t start, svn_revnum_t end, svn_boolean_t cross_copies, apr_pool_t *pool) |
Call history_func (with history_baton) for each interesting history location in the lifetime of path in fs, from the youngest of end and @ start to the oldest. | |
svn_error_t * | svn_repos_get_logs (svn_repos_t *repos, const apr_array_header_t *paths, svn_revnum_t start, svn_revnum_t end, svn_boolean_t discover_changed_paths, svn_boolean_t strict_node_history, svn_log_message_receiver_t receiver, void *receiver_baton, apr_pool_t *pool) |
Invoke receiver with receiver_baton on each log message from start to end in repos's filesystem. | |
svn_error_t * | svn_repos_fs_commit_txn (const char **conflict_p, svn_repos_t *repos, svn_revnum_t *new_rev, svn_fs_txn_t *txn, apr_pool_t *pool) |
Like svn_fs_commit_txn() , but invoke the repos's pre- and post-commit hooks around the commit. | |
svn_error_t * | svn_repos_fs_begin_txn_for_commit (svn_fs_txn_t **txn_p, svn_repos_t *repos, svn_revnum_t rev, const char *author, const char *log_msg, apr_pool_t *pool) |
Like svn_fs_begin_txn() , but use author and log_msg to set the corresponding properties on transaction *txn_p. | |
svn_error_t * | svn_repos_fs_begin_txn_for_update (svn_fs_txn_t **txn_p, svn_repos_t *repos, svn_revnum_t rev, const char *author, apr_pool_t *pool) |
Like svn_fs_begin_txn() , but use author to set the corresponding property on transaction *txn_p. | |
svn_error_t * | svn_repos_fs_change_rev_prop (svn_repos_t *repos, svn_revnum_t rev, const char *author, const char *name, const svn_string_t *new_value, apr_pool_t *pool) |
Like svn_fs_change_rev_prop() , but invoke the repos's pre- and post-revprop-change hooks around the change. | |
svn_error_t * | svn_repos_fs_change_node_prop (svn_fs_root_t *root, const char *path, const char *name, const svn_string_t *value, apr_pool_t *pool) |
Validating wrapper for svn_fs_change_node_prop() (which see for argument descriptions). | |
svn_error_t * | svn_repos_fs_change_txn_prop (svn_fs_txn_t *txn, const char *name, const svn_string_t *value, apr_pool_t *pool) |
Validating wrapper for svn_fs_change_txn_prop() (which see for argument descriptions). | |
svn_error_t * | svn_repos_node_editor (const svn_delta_editor_t **editor, void **edit_baton, svn_repos_t *repos, svn_fs_root_t *base_root, svn_fs_root_t *root, apr_pool_t *node_pool, apr_pool_t *pool) |
Set *editor and *edit_baton to an editor that, when driven by svn_repos_dir_delta() , builds an svn_repos_node_t * tree representing the delta from base_root to root in repos's filesystem. | |
svn_repos_node_t * | svn_repos_node_from_baton (void *edit_baton) |
Return the root node of the linked-list tree generated by driving the editor created by svn_repos_node_editor() with svn_repos_dir_delta() , which is stored in edit_baton. | |
svn_error_t * | svn_repos_dump_fs (svn_repos_t *repos, svn_stream_t *dumpstream, svn_stream_t *feedback_stream, svn_revnum_t start_rev, svn_revnum_t end_rev, svn_boolean_t incremental, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Dump the contents of the filesystem within already-open repos into writable dumpstream. | |
svn_error_t * | svn_repos_load_fs (svn_repos_t *repos, svn_stream_t *dumpstream, svn_stream_t *feedback_stream, enum svn_repos_load_uuid uuid_action, const char *parent_dir, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Read and parse dumpfile-formatted dumpstream, reconstructing filesystem revisions in already-open repos, handling uuids in accordance with uuid_action. | |
svn_error_t * | svn_repos_parse_dumpstream (svn_stream_t *stream, const svn_repos_parser_fns_t *parse_fns, void *parse_baton, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Read and parse dumpfile-formatted stream, calling callbacks in parse_fns/@a parse_baton, and using pool for allocations. | |
svn_error_t * | svn_repos_get_fs_build_parser (const svn_repos_parser_fns_t **parser, void **parse_baton, svn_repos_t *repos, svn_boolean_t use_history, enum svn_repos_load_uuid uuid_action, svn_stream_t *outstream, const char *parent_dir, apr_pool_t *pool) |
Set *parser and *parse_baton to a vtable parser which commits new revisions to the fs in repos. |
Definition in file svn_repos.h.
|
Callback type for checking authorization on paths produced by (at least) svn_repos_dir_delta(). Set *allowed to TRUE to indicate that some operation is authorized for path in root, or set it to FALSE to indicate unauthorized (presumably according to state stored in baton). Do not assume pool has any lifetime beyond this call. The exact operation being authorized depends on the callback implementation. For read authorization, for example, the caller would implement an instance that does read checking, and pass it as a parameter named [perhaps] 'authz_read_func'. The receiver of that parameter might also take another parameter named 'authz_write_func', which although sharing this type, would be a different implementation. Note: If someday we want more sophisticated authorization states than just yes/no, allowed can become an enum type. Definition at line 61 of file svn_repos.h. |
|
Callback type for use with svn_repos_history(). path and revision represent interesting history locations in the lifetime of the path passed to svn_repos_history(). baton is the same baton given to svn_repos_history(). pool is provided for the convenience of the implementor, who should not expect it to live longer than a single callback call. Definition at line 519 of file svn_repos.h. |
|
The report-driver is bailing, so abort the fs transaction.
This function can be called anytime before |
|
Construct and return a report_baton that will be paired with some
The table and baton are used to build a transaction in the system; when the report is finished, Specifically, the report will create a transaction made by username, relative to fs_base in the filesystem. target is a single path component, used to limit the scope of the report to a single entry of fs_base, or "" if all of fs_base itself is the main subject of the report.
tgt_path and revnum is the fs path/revision pair that is the "target" of text_deltas instructs the driver of the editor to enable the generation of text deltas. recurse instructs the driver of the editor to send a recursive delta (or not.) ignore_ancestry instructs the driver to ignore node ancestry when determining how to transmit differences.
The authz_read_func and authz_read_baton are passed along to All allocation for the context and collected state will occur in pool. |
|
Create a new Subversion repository at path, building the necessary directory structure, creating the Berkeley DB filesystem environment, and so on. Return the (open) repository object in *repos_p, allocated in pool.
config is a client configuration hash of fs_config is passed to the filesystem, and may be NULL. unused_1 and unused_2 are not used and should be NULL. |
|
This function is a wrapper around svn_fs_berkeley_logfiles(), returning log file paths relative to the root of the repository.
If only_unused is used is This function wraps the Berkeley DB 'log_archive' function called by the db_archive binary. Repository administrators may want to run this function periodically and delete the unused log files, as a way of reclaiming disk space. |
|
Given a report_baton constructed by (This allows the reporter's driver to describe missing pieces of a working copy, so that 'svn up' can recreate them.) All temporary allocations are done in pool. |
|
Use the provided editor and edit_baton to describe the changes necessary for making a given node (and its descendants, if it is a directory) under src_root look exactly like tgt_path under tgt_root. src_entry is the node to update. If src_entry is empty, then compute the difference between the entire tree anchored at src_parent_dir under src_root and tgt_path under target_root. Else, describe the changes needed to update only that entry in src_parent_dir. Typically, callers of this function will use a tgt_path that is the concatenation of src_parent_dir and src_entry.
src_root and tgt_root can both be either revision or transaction roots. If tgt_root is a revision, editor's If authz_read_func is non-null, invoke it before any call to editor->open_root editor->add_directory editor->open_directory editor->add_file editor->open_file passing tgt_root, the same path that would be passed to the editor function in question, and authz_read_baton. If the *allowed parameter comes back TRUE, then proceed with the planned editor call; else if FALSE, then invoke editor->absent_file or editor->absent_directory as appropriate, except if the planned editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
If text_deltas is
If entry_props is ignore_ancestry instructs the function to ignore node ancestry when determining how to transmit differences.
Before completing successfully, this function calls editor's Do any allocation necessary for the delta computation in pool. This function's maximum memory consumption is at most roughly proportional to the greatest depth of the tree under tgt_root, not the total size of the delta. |
|
Find the root path of the repository that contains path.
If a repository was found, the path to the root of the repository is returned, else |
|
Make the filesystem compare the transaction to a revision and have it drive an update editor (using If an error occurs during the driving of the editor, we do NOT abort the edit; that responsibility belongs to the caller, if it happens at all. The fs transaction will be aborted even if the editor drive fails, so the caller does not need to clean up. |
|
Return an editor and edit_baton to commit changes to session->fs, beginning at location 'rev:base_path', where "rev" is the argument given to Store user as the author of the commit and log_msg as the commit message. repos is a previously opened repository. repos_url is the decoded URL to the base of the repository, and is used to check copyfrom paths.
Calling (*editor)->close_edit completes the commit. Before |
|
Given a root/@a path within some filesystem, return three pieces of information allocated in pool:.
|
|
Invoke receiver with receiver_baton on each log message from start to end in repos's filesystem. start may be greater or less than end; this just controls whether the log messages are processed in descending or ascending revision number order.
If start or end is
If paths is non-null and has one or more elements, then only show revisions in which at least one of paths was changed (i.e., if file, text or props changed; if dir, props changed or an entry was added or deleted). Each path is an ### todo: need to consider whether the above directory behavior is most useful, or if we should actually treat _any_ node change in a directory as a visible change for purposes of log... i.e., show bubble-up. The reason this might be useful is so that running log on a directory would give a msg for every change under that dir, no matter how far down. See the thread started on the dev list by Lars Kellogg-Stedman <lars@larsshack.org> with the subject "Single repository, multiple projects?" for more. We may simple need to offer a few different semantics for paths.
If discover_changed_paths, then each call to receiver passes a If strict_node_history is set, copy history (if any exists) will not be traversed while harvesting revision logs for each path. If any invocation of receiver returns error, return that error immediately and without wrapping it.
If start or end is a non-existent revision, return the error
See also the documentation for Use pool for temporary allocations. |
|
Call history_func (with history_baton) for each interesting history location in the lifetime of path in fs, from the youngest of end and @ start to the oldest.
Only cross filesystem copy history if cross_copies is |
|
Make a hot copy of the Subversion repository found at src_path to dst_path.
If clean_logs is used is |
|
Given a report_baton constructed by Note that while path is relative to the anchor/target used in the creation of the report_baton, link_path is an absolute filesystem path! If start_empty is set and path is a directory, then remove all children and props of the freshly-linked directory. This is for 'low confidence' client reporting. All temporary allocations are done in pool. |
|
Set *repos_p to a repository object for the repository at path. Allocate *repos_p in pool. Acquires a shared lock on the repository, and attaches a cleanup function to pool to remove the lock. If no lock can be acquired, returns error, with undefined effect on *repos_p. If an exclusive lock is present, this blocks until it's gone. |
|
Run database recovery procedures on the repository at path, returning the database to a consistent state. Use pool for all allocation. Acquires an exclusive lock on the repository, recovers the database, and releases the lock. If an exclusive lock can't be acquired, returns error. |
|
Use the provided editor and edit_baton to describe the skeletal changes made in a particular filesystem root (revision or transaction). The editor passed to this function should be aware of the fact that calls to its change_dir_prop(), change_file_prop(), and apply_textdelta() functions will not contain meaningful data, and merely serve as indications that properties or textual contents were changed. NOTE: this editor driver passes SVN_INVALID_REVNUM for all revision parameters in the editor interface except the copyfrom parameter of the add_file() and add_directory() editor functions. ### TODO: This ought to take an svn_repos_authz_func_t too. The only reason it doesn't yet is the difficulty of implementing that correctly, plus lack of strong present need -- it's currently only used in creating a DAV MERGE response, in 'svnadmin dump', and in svnlook. |
|
Given a report_baton constructed by This routine is called multiple times to create a transaction that is a "mirror" of a working copy. The first call of this in a given report usually passes an empty path; that allows the reporter to set up the correct root revision (useful when creating a txn, for example). If start_empty is set and path is a directory, then remove all children and props of the freshly-linked directory. This is for 'low confidence' client reporting. All temporary allocations are done in pool. |