📄 svn_fs.h
字号:
* contents of the file @a path in @a root. Allocate the stream in * @a pool. You can only use @a *contents for as long as the underlying * filesystem is open. If @a path is not a file, return * @c SVN_ERR_FS_NOT_FILE. * * If @a root is the root of a transaction, it is possible that the * contents of the file @a path will change between calls to * svn_fs_file_contents(). In that case, the result of reading from * @a *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_contents(svn_stream_t **contents, svn_fs_root_t *root, const char *path, apr_pool_t *pool);/** Create a new file named @a path in @a root. The file's initial contents * are the empty string, and it has no properties. @a root must be the * root of a transaction, not a revision. * * Do any necessary temporary allocation in @a pool. */svn_error_t *svn_fs_make_file(svn_fs_root_t *root, const char *path, apr_pool_t *pool);/** Apply a text delta to the file @a path in @a root. @a root must be the * root of a transaction, not a revision. * * Set @a *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 @a *contents_baton_p to a baton to pass to * @a *contents_p. * * If @a path does not exist in @a root, return an error. (You cannot use * this routine to create new files; use svn_fs_make_file() to create * an empty file first.) * * @a 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 @a *contents_p call * which detects the mismatch will return the error * @c SVN_ERR_CHECKSUM_MISMATCH (if there is no base text, there may * still be an error if @a base_checksum is neither null nor the * checksum of the empty string). * * @a 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 @a *contents_p call which detects the mismatch will return * the error @c SVN_ERR_CHECKSUM_MISMATCH. * * The caller must send all delta windows including the terminating * NULL window to @a *contents_p before making further changes to the * transaction. * * Do temporary allocation in @a pool. */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);/** Write data directly to the file @a path in @a root. @a root must be the * root of a transaction, not a revision. * * Set @a *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 @a path does not exist in @a root, return an error. (You cannot use * this routine to create new files; use svn_fs_make_file() to create * an empty file first.) * * @a 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 @a * *contents_p call which detects the mismatch will return the error * @c SVN_ERR_CHECKSUM_MISMATCH. * * Do any necessary temporary allocation in @a 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_text(svn_stream_t **contents_p, svn_fs_root_t *root, const char *path, const char *result_checksum, apr_pool_t *pool);/** Check if the contents of two root/path combos have changed. * * Set @a *changed_p to 1 if the contents at @a path1 under @a root1 differ * from those at @a path2 under @a 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_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);/* Filesystem revisions. *//** Set @a *youngest_p to the number of the youngest revision in filesystem * @a fs. Use @a pool for all temporary allocation. * * The oldest revision in any filesystem is numbered zero. */svn_error_t *svn_fs_youngest_rev(svn_revnum_t *youngest_p, svn_fs_t *fs, apr_pool_t *pool);/** Deltify predecessors of paths modified in @a revision in * filesystem @a fs. Use @a pool for all allocations. * * @note This can be a time-consuming process, depending the breadth * of the changes made in @a revision, and the depth of the history of * those changed paths. */svn_error_t *svn_fs_deltify_revision(svn_fs_t *fs, svn_revnum_t revision, apr_pool_t *pool);/** Set @a *value_p to the value of the property named @a propname on * revision @a rev in the filesystem @a fs. If @a rev has no property by * that name, set @a *value_p to zero. Allocate the result in @a pool. */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 @a *table_p to the entire property list of revision @a rev in * filesystem @a fs, as an APR hash table allocated in @a pool. The table * maps <tt>char *</tt> property names to @c svn_string_t * values; the names * and values are allocated in @a 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);/** Change a revision's property's value, or add/delete a property. * * - @a fs is a filesystem, and @a rev is the revision in that filesystem * whose property should change. * - @a name is the name of the property to change. * - @a value is the new value of the property, or zero if the property should * be removed altogether. * * 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 @a pool. */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);/* Computing deltas. *//** Set @a *stream_p to a pointer to a delta stream that will turn the * contents of the file @a source into the contents of the file @a target. * If @a source_root is zero, use a file with zero length as the source. * * This function does not compare the two files' properties. * * Allocate @a *stream_p, and do any necessary temporary allocation, in * @a pool. */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);/* UUID manipulation. *//** Populate @a *uuid with the UUID associated with @a fs. Allocate @a *uuid in @a pool. */svn_error_t *svn_fs_get_uuid(svn_fs_t *fs, const char **uuid, apr_pool_t *pool);/** Associate @a *uuid with @a fs. Use @a pool for any scratchwork. */svn_error_t *svn_fs_set_uuid(svn_fs_t *fs, const char *uuid, apr_pool_t *pool);/* Non-historical properties. *//* [[Yes, do tell.]] *//** @defgroup svn_fs_locks filesystem locks * @{ * @since New in 1.2. *//** A lock represents one user's exclusive right to modify a path in a * filesystem. In order to create or destroy a lock, a username must * be associated with the filesystem's access context (see @c * svn_fs_access_t). * * When a lock is created, a 'lock-token' is returned. The lock-token * is a unique URI that represents the lock (treated as an opaque * string by the client), and is required to make further use of the * lock (including removal of the lock.) A lock-token can also be * queried to return a svn_lock_t structure that describes the details * of the lock. * * Locks are not secret; anyone can view existing locks in a * filesystem. Locks are not omnipotent: they can broken and stolen * by people who don't "own" the lock. (Though admins can tailor a * custom break/steal policy via libsvn_repos pre-lock hook script.) * * Locks can be created with an optional expiration date. If a lock * has an expiration date, then the act of fetching/reading it might * cause it to automatically expire, returning either nothing or an * expiration error (depending on the API). *//** Lock @a path in @a fs, and set @a *lock to a lock * representing the new lock, allocated in @a pool. * * @warning You may prefer to use svn_repos_fs_lock() instead, * which see. * * @a fs must have a username associated with it (see @c * svn_fs_access_t), else return @c SVN_ERR_FS_NO_USER. Set the * 'owner' field in the new lock to the fs username. * * @a comment is optional: it's either an xml-escapable UTF8 string * which describes the lock, or it is @c NULL. * * @a is_dav_comment describes whether the comment was created by a * generic DAV client; only mod_dav_svn's autoversioning feature needs * to use it. If in doubt, pass 0. * * If path is already locked, then return @c SVN_ERR_FS_PATH_ALREADY_LOCKED, * unless @a steal_lock is true, in which case "steal" the existing * lock, even if the FS access-context's username does not match the * current lock's owner: delete the existing lock on @a path, and * create a new one. * * @a token is a lock token such as can be generated using * svn_fs_generate_lock_token() (indicating that the caller wants to * dictate the lock token used), or it is @c NULL (indicating that the * caller wishes to have a new token generated by this function). If * @a token is not @c NULL, and represents an existing lock, then @a * path must match the path associated with that existing lock. * * If @a expiration_date is zero, then create a non-expiring lock. * Else, the lock will expire at @a expiration_date. * * If @a current_rev is a valid revnum, then do an out-of-dateness * check. If the revnum is less than the last-changed-revision of @a * path (or if @a path doesn't exist in HEAD), return @c * SVN_ERR_FS_OUT_OF_DATE. * * @note At this time, only files can be locked. */svn_error_t *svn_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);/** Generate a unique lock-token using @a fs. Return in @a *token, * allocated in @a pool. * * This can be used in to populate lock->token before calling * svn_fs_attach_lock(). */svn_error_t *svn_fs_generate_lock_token(const char **token, svn_fs_t *fs, apr_pool_t *pool);/** Remove the lock on @a path represented by @a token in @a fs. * * If @a token doesn't point to a lock, return @c SVN_ERR_FS_BAD_LOCK_TOKEN. * If @a token points to an expired lock, return @c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -