📄 svn_fs.h
字号:
const char *path, apr_pool_t *pool);/** Set @a *created_path to the path at which @a path under @a root was * created. Use @a 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_path(const char **created_path, svn_fs_root_t *root, const char *path, apr_pool_t *pool);/** Set @a *value_p to the value of the property named @a propname of * @a path in @a root. If the node has no property by that name, set * @a *value_p to zero. Allocate the result in @a pool. */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 @a *table_p to the entire property list of @a path in @a root, * as an APR hash table allocated in @a pool. The resulting table maps * property names to pointers to @c svn_string_t objects containing the * property value. */svn_error_t *svn_fs_node_proplist(apr_hash_t **table_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool);/** Change a node's property's value, or add/delete a property. * * - @a root and @a path indicate the node whose property should change. * @a root must be the root of a transaction, not the root of a revision. * - @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. * Do any necessary temporary allocation in @a 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);/** Determine if the properties of two path/root combinations are different. * * Set @a *changed_p to 1 if the properties 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_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);/** Discover a node's copy ancestry, if any. * * If the node at @a path in @a root was copied from some other node, set * @a *rev_p and @a *path_p to the revision and path of the other node, * allocating @a *path_p in @a pool. * * Else if there is no copy ancestry for the node, set @a *rev_p to * @c SVN_INVALID_REVNUM and @a *path_p to null. * * If an error is returned, the values of @a *rev_p and @a *path_p are * undefined, but otherwise, if one of them is set as described above, * you may assume the other is set correspondingly. * * @a root may be a revision root or a transaction root. * * Notes: * - Copy ancestry does not descend. After copying directory D to * E, E will have copy ancestry referring to D, but E's children * may not. See also svn_fs_copy(). * * - Copy ancestry *under* a copy is preserved. That is, if you * copy /A/D/G/pi to /A/D/G/pi2, and then copy /A/D/G to /G, then * /G/pi2 will still have copy ancestry pointing to /A/D/G/pi. * We don't know if this is a feature or a bug yet; if it turns * out to be a bug, then the fix is to make svn_fs_copied_from() * observe the following logic, which currently callers may * choose to follow themselves: if node X has copy history, but * its ancestor A also has copy history, then you may ignore X's * history if X's revision-of-origin is earlier than A's -- * because that would mean that X's copy history was preserved in * a copy-under-a-copy scenario. If X's revision-of-origin is * the same as A's, then it was copied under A during the same * transaction that created A. (X's revision-of-origin cannot be * greater than A's, if X has copy history.) ### todo: See how * people like this, it can always be hidden behind the curtain * if necessary. * * - Copy ancestry is not stored as a regular subversion property * because it is not inherited. Copying foo to bar results in a * revision of bar with copy ancestry; but committing a text * change to bar right after that results in a new revision of * bar without copy ancestry. */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);/** Set @a *root_p and @a *path_p to the revision root and path of the * destination of the most recent copy event that caused @a path to * exist where it does in @a root, or to null if no such copy exists. * When non-null, allocate @a *root_p and @a *path_p in @a pool. * * @a *path_p might be a parent of @a path, rather than @a 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 @a *path_p to the longest copy * destination path that is still a parent of or equal to @a path. * * @since New in 1.3. */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);/** Merge changes between two nodes into a third node. * * Given nodes @a source and @a target, and a common ancestor @a ancestor, * modify @a target to contain all the changes made between @a ancestor and * @a source, as well as the changes made between @a ancestor and @a target. * @a target_root must be the root of a transaction, not a revision. * * @a source, @a target, and @a ancestor are generally directories; this * function recursively merges the directories' contents. If they are * files, this function simply returns an error whenever @a source, * @a target, and @a ancestor are all distinct node revisions. * * If there are differences between @a ancestor and @a source that conflict * with changes between @a ancestor and @a target, this function returns an * @c SVN_ERR_FS_CONFLICT error. * * If the merge is successful, @a target is left in the merged state, and * the base root of @a target's txn is set to the root node of @a source. * If an error is returned (whether for conflict or otherwise), @a target * is left unaffected. * * If @a conflict_p is non-null, then: a conflict error sets @a *conflict_p * to the name of the node in @a target which couldn't be merged, * otherwise, success sets @a *conflict_p to null. * * Do any necessary temporary allocation in @a 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);/* Directories. *//** The type of a Subversion directory entry. */typedef struct svn_fs_dirent_t{ /** The name of this directory entry. */ const char *name; /** The node revision ID it names. */ const svn_fs_id_t *id; /** The node kind. */ svn_node_kind_t kind;} svn_fs_dirent_t;/** Set @a *entries_p to a newly allocated APR hash table containing the * entries of the directory at @a path in @a root. The keys of the table * are entry names, as byte strings, excluding the final null * character; the table's values are pointers to @c svn_fs_dirent_t * structures. Allocate the table and its contents in @a pool. */svn_error_t *svn_fs_dir_entries(apr_hash_t **entries_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool);/** Create a new directory named @a path in @a root. The new directory has * no entries, and 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_dir(svn_fs_root_t *root, const char *path, apr_pool_t *pool); /** Delete the node named @a path in @a root. If the node being deleted is * a directory, its contents will be deleted recursively. @a root must be * the root of a transaction, not of a revision. Use @a 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 @c SVN_ERR_FS_NO_SUCH_ENTRY, then the basename of @a 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, * @c SVN_ERR_FS_ROOT_DIR, even if the dir is empty. */svn_error_t *svn_fs_delete(svn_fs_root_t *root, const char *path, apr_pool_t *pool);/** Create a copy of @a from_path in @a from_root named @a to_path in * @a to_root. If @a from_path in @a 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. * * @a to_root must be the root of a transaction; @a from_path must be the * root of a revision. (Requiring @a 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 @a 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, @a to_root and @a * 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 @a pool. */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);/** 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 @a to_path and @a from_path are * the same, because it is cheaper than svn_fs_copy(). */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);/* Files. *//** Set @a *length_p to the length of the file @a path in @a root, in bytes. * Do any necessary temporary allocation in @a pool. */svn_error_t *svn_fs_file_length(svn_filesize_t *length_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool);/** Put the MD5 checksum of file @a path into @a digest, which points * to @c APR_MD5_DIGESTSIZE bytes of storage. Use @a pool only for temporary * allocations. * * If the filesystem does not have a prerecorded checksum for @a path, * do not calculate a checksum dynamically, just put all 0's into @a * 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_file_md5_checksum(unsigned char digest[], svn_fs_root_t *root, const char *path, apr_pool_t *pool);/** Set @a *contents to a readable generic stream that will yield the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -