You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2011/01/24 21:59:25 UTC
svn commit: r1062974 - in /subversion/trunk/subversion: include/
include/private/ libsvn_client/ libsvn_delta/ libsvn_fs_base/ libsvn_fs_fs/
libsvn_ra_local/ libsvn_repos/ libsvn_subr/ libsvn_wc/ svnlook/
tests/libsvn_subr/
Author: cmpilato
Date: Mon Jan 24 20:59:24 2011
New Revision: 1062974
URL: http://svn.apache.org/viewvc?rev=1062974&view=rev
Log:
* subversion/include/svn_dirent_uri.h
Move all svn_fspath__* function prototypes out of here, and...
* subversion/include/private/svn_fspath.h
...into here, a new private header file for those functions.
* subversion/libsvn_client/list.c,
* subversion/libsvn_client/merge.c,
* subversion/libsvn_client/mergeinfo.c,
* subversion/libsvn_delta/path_driver.c,
* subversion/libsvn_fs_base/dag.c,
* subversion/libsvn_fs_base/tree.c,
* subversion/libsvn_fs_fs/dag.c,
* subversion/libsvn_fs_fs/lock.c,
* subversion/libsvn_fs_fs/tree.c,
* subversion/libsvn_ra_local/ra_plugin.c,
* subversion/libsvn_repos/reporter.c,
* subversion/libsvn_subr/dirent_uri.c,
* subversion/libsvn_subr/mergeinfo.c,
* subversion/libsvn_wc/status.c,
* subversion/svnlook/main.c,
* subversion/tests/libsvn_subr/dirent_uri-test.c
Now include "private/svn_fspath.h"
Added:
subversion/trunk/subversion/include/private/svn_fspath.h
- copied, changed from r1062965, subversion/trunk/subversion/include/svn_dirent_uri.h
Modified:
subversion/trunk/subversion/include/svn_dirent_uri.h
subversion/trunk/subversion/libsvn_client/list.c
subversion/trunk/subversion/libsvn_client/merge.c
subversion/trunk/subversion/libsvn_client/mergeinfo.c
subversion/trunk/subversion/libsvn_delta/path_driver.c
subversion/trunk/subversion/libsvn_fs_base/dag.c
subversion/trunk/subversion/libsvn_fs_base/tree.c
subversion/trunk/subversion/libsvn_fs_fs/dag.c
subversion/trunk/subversion/libsvn_fs_fs/lock.c
subversion/trunk/subversion/libsvn_fs_fs/tree.c
subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
subversion/trunk/subversion/libsvn_repos/reporter.c
subversion/trunk/subversion/libsvn_subr/dirent_uri.c
subversion/trunk/subversion/libsvn_subr/mergeinfo.c
subversion/trunk/subversion/libsvn_wc/status.c
subversion/trunk/subversion/svnlook/main.c
subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c
Copied: subversion/trunk/subversion/include/private/svn_fspath.h (from r1062965, subversion/trunk/subversion/include/svn_dirent_uri.h)
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_fspath.h?p2=subversion/trunk/subversion/include/private/svn_fspath.h&p1=subversion/trunk/subversion/include/svn_dirent_uri.h&r1=1062965&r2=1062974&rev=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_dirent_uri.h (original)
+++ subversion/trunk/subversion/include/private/svn_fspath.h Mon Jan 24 20:59:24 2011
@@ -20,90 +20,17 @@
* ====================================================================
* @endcopyright
*
- * @file svn_dirent_uri.h
- * @brief A library to manipulate URIs, relative paths and directory entries.
- *
- * This library makes a clear distinction between several path formats:
- *
- * - a dirent is a path on (local) disc or a UNC path (Windows) in
- * either relative or absolute format.
- * Examples:
- * "/foo/bar", "X:/temp", "//server/share", "A:/" (Windows only)
- * But not:
- * "http://server"
- *
- * - a uri, for our purposes, is a percent-encoded, absolute path
- * (URI) that starts with a schema definition. In practice, these
- * tend to look like URLs, but never carry query strings.
- * Examples:
- * "http://server", "file:///path/to/repos",
- * "svn+ssh://user@host:123/My%20Stuff/file.doc"
- * But not:
- * "file", "dir/file", "A:/dir", "/My%20Stuff/file.doc"
- * ### Currently the uri implementation still allows relative URIs
- * ### (carrying both relative and absolute path data) as valid
- * ### uris, but this will change soon.
- *
- * - a relative path (relpath) is an unrooted path that can be joined
- * to any other relative path, uri or dirent. A relative path is
- * never rooted/prefixed by a '/'.
- * Examples:
- * "file", "dir/file", "dir/subdir/../file"
- * But not:
- * "/file", "http://server/file"
- *
- * - a Subversion filesystem path (fspath) -- otherwise known as a
- * path within a repository -- is a path relative to the root of
- * the repository filesystem, that starts with a slash ("/"). The
- * rules for a fspath are the same as for a relpath except for the
- * leading '/'. A fspath never ends with '/' except when the whole
- * path is just '/'. ### NOTE: The fspath API is private.
- *
- * This distinction is needed because on Windows we have to handle some
- * dirents and URIs differently. Since it's not possible to determine from
- * the path string if it's a dirent or a URI, it's up to the API user to
- * make this choice. See also issue #2028.
- *
- * All of these functions expect paths passed into them to be in canonical
- * form, except:
- *
- * - @c svn_dirent_canonicalize()
- * - @c svn_dirent_is_canonical()
- * - @c svn_dirent_internal_style()
- * - @c svn_dirent_local_style()
- * - @c svn_relpath_canonicalize()
- * - @c svn_relpath_is_canonical()
- * - @c svn_relpath_internal_style()
- * - @c svn_relpath_local_style()
- * - @c svn_uri_canonicalize()
- * - @c svn_uri_is_canonical()
- * - @c svn_fspath__is_canonical()
- *
- * Code that works with a path-in-repository should use, in order of
- * preference: a relpath (preferred), or a fspath (widely used by legacy
- * code), or a relative URI (not recommended except in the context of
- * splitting or joining to a full URL).
- *
- * All code that works with local files, MUST USE the dirent apis.
- *
- * When translating between local paths (dirents) and uris code should
- * always go via the relative path format.
- * E.g.
- * - by truncating a parent portion from a path with svn_*_skip_ancestor(),
- * - or by converting portions to basenames and then joining to existing paths.
- *
- * SECURITY WARNING: If a path that is received from an untrusted source -like
- * from the network- is converted to a dirent it should be tested with
- * svn_dirent_is_under_root() before you can assume the path to be a safe local
- * path.
+ * @file svn_fspath.h
+ * @brief Implementation of path manipulation functions similar to
+ * those in svn_dirent_uri.h (which see for details) but for
+ * the private fspath class of paths.
*/
-#ifndef SVN_DIRENT_URI_H
-#define SVN_DIRENT_URI_H
+#ifndef SVN_FSPATH_H
+#define SVN_FSPATH_H
#include <apr.h>
#include <apr_pools.h>
-#include <apr_tables.h>
#include "svn_types.h"
@@ -111,724 +38,6 @@
extern "C" {
#endif /* __cplusplus */
-
-/** Convert @a dirent from the local style to the canonical internal style.
- *
- * @since New in 1.6.
- */
-const char *
-svn_dirent_internal_style(const char *dirent,
- apr_pool_t *pool);
-
-/** Convert @a dirent from the canonical internal style to the local style.
- *
- * @since New in 1.6.
- */
-const char *
-svn_dirent_local_style(const char *dirent,
- apr_pool_t *pool);
-
-/** Convert @a relpath from the local style to the canonical internal style.
- *
- * @since New in 1.7.
- */
-const char *
-svn_relpath_internal_style(const char *relpath,
- apr_pool_t *pool);
-
-/** Convert @a relpath from the canonical internal style to the local style.
- *
- * @since New in 1.7.
- */
-const char *
-svn_relpath_local_style(const char *relpath,
- apr_pool_t *pool);
-
-
-/** Join a base dirent (@a base) with a component (@a component), allocated in
- * @a pool.
- *
- * If either @a base or @a component is the empty string, then the other
- * argument will be copied and returned. If both are the empty string then
- * empty string is returned.
- *
- * If the @a component is an absolute dirent, then it is copied and returned.
- * The platform specific rules for joining paths are used to join the components.
- *
- * This function is NOT appropriate for native (local) file
- * dirents. Only for "internal" canonicalized dirents, since it uses '/'
- * for the separator.
- *
- * @since New in 1.6.
- */
-char *
-svn_dirent_join(const char *base,
- const char *component,
- apr_pool_t *pool);
-
-/** Join multiple components onto a @a base dirent, allocated in @a pool. The
- * components are terminated by a @c NULL.
- *
- * If any component is the empty string, it will be ignored.
- *
- * If any component is an absolute dirent, then it resets the base and
- * further components will be appended to it.
- *
- * See svn_dirent_join() for further notes about joining dirents.
- *
- * @since New in 1.6.
- */
-char *
-svn_dirent_join_many(apr_pool_t *pool,
- const char *base,
- ...);
-
-/** Join a base relpath (@a base) with a component (@a component), allocating
- * the result in @a pool. @a component need not be a single component.
- *
- * If either @a base or @a component is the empty path, then the other
- * argument will be copied and returned. If both are the empty path the
- * empty path is returned.
- *
- * @since New in 1.7.
- */
-char *
-svn_relpath_join(const char *base,
- const char *component,
- apr_pool_t *pool);
-
-/** Join a valid base uri (@a base) with a relative path or uri
- * (@a component), allocating the result in @a pool. @a component need
- * not be a single component: it can be a relative path or a '/'
- * prefixed relative path to join component to the root path of @a base.
- *
- * If @a component is the empty path, then @a base will be copied and
- * returned.
- *
- * If the @a component is an absolute uri, then it is copied and returned.
- *
- * If @a component starts with a '/' and @a base contains a scheme, the
- * scheme defined joining rules are applied.
- *
- * @since New in 1.7.
- */
-char *
-svn_uri_join(const char *base,
- const char *component,
- apr_pool_t *pool);
-
-
-/** Gets the name of the specified canonicalized @a dirent as it is known
- * within its parent directory. If the @a dirent is root, return "". The
- * returned value will not have slashes in it.
- *
- * Example: svn_dirent_basename("/foo/bar") -> "bar"
- *
- * The returned basename will be allocated in @a pool. If @a pool is NULL
- * a pointer to the basename in @a dirent is returned.
- *
- * @note If an empty string is passed, then an empty string will be returned.
- *
- * @since New in 1.7.
- */
-const char *
-svn_dirent_basename(const char *dirent,
- apr_pool_t *pool);
-
-/** Get the dirname of the specified canonicalized @a dirent, defined as
- * the dirent with its basename removed.
- *
- * If @a dirent is root ("/", "X:/", "//server/share/") or "", it is returned
- * unchanged.
- *
- * The returned dirname will be allocated in @a pool.
- *
- * @since New in 1.6.
- */
-char *
-svn_dirent_dirname(const char *dirent,
- apr_pool_t *pool);
-
-/** Divide the canonicalized @a dirent into @a *dirpath and @a
- * *base_name, allocated in @a pool.
- *
- * If @a dirpath or @a base_name is NULL, then don't set that one.
- *
- * Either @a dirpath or @a base_name may be @a dirent's own address, but they
- * may not both be the same address, or the results are undefined.
- *
- * If @a dirent has two or more components, the separator between @a dirpath
- * and @a base_name is not included in either of the new names.
- *
- * Examples:
- * - <pre>"/foo/bar/baz" ==> "/foo/bar" and "baz"</pre>
- * - <pre>"/bar" ==> "/" and "bar"</pre>
- * - <pre>"/" ==> "/" and ""</pre>
- * - <pre>"bar" ==> "" and "bar"</pre>
- * - <pre>"" ==> "" and ""</pre>
- * Windows: - <pre>"X:/" ==> "X:/" and ""</pre>
- * - <pre>"X:/foo" ==> "X:/" and "foo"</pre>
- * - <pre>"X:foo" ==> "X:" and "foo"</pre>
- * Posix: - <pre>"X:foo" ==> "" and "X:foo"</pre>
- *
- * @since New in 1.7.
- */
-void
-svn_dirent_split(const char **dirpath,
- const char **base_name,
- const char *dirent,
- apr_pool_t *pool);
-
-/** Divide the canonicalized @a relpath into @a *dirpath and @a
- * *base_name, allocated in @a pool.
- *
- * If @a dirpath or @a base_name is NULL, then don't set that one.
- *
- * Either @a dirpath or @a base_name may be @a relpaths's own address, but
- * they may not both be the same address, or the results are undefined.
- *
- * If @a relpath has two or more components, the separator between @a dirpath
- * and @a base_name is not included in either of the new names.
- *
- * examples:
- * - <pre>"foo/bar/baz" ==> "foo/bar" and "baz"</pre>
- * - <pre>"bar" ==> "" and "bar"</pre>
- * - <pre>"" ==> "" and ""</pre>
- *
- * @since New in 1.7.
- */
-void
-svn_relpath_split(const char **dirpath,
- const char **base_name,
- const char *relpath,
- apr_pool_t *pool);
-
-/** Get the basename of the specified canonicalized @a relpath. The
- * basename is defined as the last component of the relpath. If the @a
- * relpath has only one component then that is returned. The returned
- * value will have no slashes in it.
- *
- * Example: svn_relpath_basename("/trunk/foo/bar") -> "bar"
- *
- * The returned basename will be allocated in @a pool. If @a
- * pool is NULL a pointer to the basename in @a relpath is returned.
- *
- * @note If an empty string is passed, then an empty string will be returned.
- *
- * @since New in 1.7.
- */
-const char *
-svn_relpath_basename(const char *relpath,
- apr_pool_t *pool);
-
-/** Get the dirname of the specified canonicalized @a relpath, defined as
- * the relpath with its basename removed.
- *
- * If @a relpath is empty, "" is returned.
- *
- * The returned relpath will be allocated in @a pool.
- *
- * @since New in 1.7.
- */
-char *
-svn_relpath_dirname(const char *relpath,
- apr_pool_t *pool);
-
-
-/** Divide the canonicalized @a uri into @a *dirpath and @a
- * *base_name, allocated in @a pool.
- *
- * If @a dirpath or @a base_name is NULL, then don't set that one.
- *
- * Either @a dirpath or @a base_name may be @a uri's own address, but they
- * may not both be the same address, or the results are undefined.
- *
- * If @a uri has two or more components, the separator between @a dirpath
- * and @a base_name is not included in either of the new names.
- *
- * examples:
- * - <pre>"/foo/bar/baz" ==> "/foo/bar" and "baz"</pre>
- * - <pre>"/bar" ==> "/" and "bar"</pre>
- * - <pre>"/" ==> "/" and "/"</pre>
- * - <pre>"bar" ==> "" and "bar"</pre>
- * - <pre>"" ==> "" and ""</pre>
- *
- * @since New in 1.7.
- */
-void
-svn_uri_split(const char **dirpath,
- const char **base_name,
- const char *uri,
- apr_pool_t *pool);
-
-/** Get the basename of the specified canonicalized @a uri. The
- * basename is defined as the last component of the uri. If the @a uri
- * is root then that is returned. Otherwise, the returned value will have no
- * slashes in it.
- *
- * Example: svn_uri_basename("http://server/foo/bar") -> "bar"
- *
- * The returned basename will be allocated in @a pool. If @a pool is NULL
- * a pointer to the basename in @a uri is returned.
- *
- * @note If an empty string is passed, then an empty string will be returned.
- *
- * @since New in 1.7.
- */
-const char *
-svn_uri_basename(const char *uri,
- apr_pool_t *pool);
-
-/** Get the dirname of the specified canonicalized @a uri, defined as
- * the uri with its basename removed.
- *
- * If @a uri is root (e.g. "http://server"), it is returned
- * unchanged.
- *
- * The returned dirname will be allocated in @a pool.
- *
- * @since New in 1.7.
- */
-char *
-svn_uri_dirname(const char *uri,
- apr_pool_t *pool);
-
-
-/** Return TRUE if @a dirent is considered absolute on the platform at
- * hand. E.g. '/foo' on Posix platforms or 'X:/foo', '//server/share/foo'
- * on Windows.
- *
- * @since New in 1.6.
- */
-svn_boolean_t
-svn_dirent_is_absolute(const char *dirent);
-
-/** Return TRUE if @a uri is considered absolute or is a URL.
- *
- * @since New in 1.7.
- */
-svn_boolean_t
-svn_uri_is_absolute(const char *uri);
-
-/** Return TRUE if @a dirent is considered a root directory on the platform
- * at hand.
- * E.g.:
- * On Posix: '/'
- * On Windows: '/', 'X:/', '//server/share', 'X:'
- *
- * Note that on Windows '/' and 'X:' are roots, but paths starting with this
- * root are not absolute.
- *
- * @since New in 1.5.
- */
-svn_boolean_t
-svn_dirent_is_root(const char *dirent,
- apr_size_t len);
-
-/** Return TRUE if @a uri is a root path, so starts with '/'.
- *
- * Do not use this function with URLs.
- *
- * @since New in 1.7
- */
-svn_boolean_t
-svn_uri_is_root(const char *uri,
- apr_size_t len);
-
-/** Return a new dirent like @a dirent, but transformed such that some types
- * of dirent specification redundancies are removed.
- *
- * This involves collapsing redundant "/./" elements, removing
- * multiple adjacent separator characters, removing trailing
- * separator characters, and possibly other semantically inoperative
- * transformations.
- *
- * Convert the server name of UNC paths lowercase and drive letters to
- * upper case on Windows.
- *
- * The returned dirent may be statically allocated or allocated from @a pool.
- *
- * @since New in 1.6.
- */
-const char *
-svn_dirent_canonicalize(const char *dirent,
- apr_pool_t *pool);
-
-
-/** Return a new relpath like @a relpath, but transformed such that some types
- * of relpath specification redundancies are removed.
- *
- * This involves collapsing redundant "/./" elements, removing
- * multiple adjacent separator characters, removing trailing
- * separator characters, and possibly other semantically inoperative
- * transformations.
- *
- * This functions supports relpaths.
- *
- * The returned relpath may be statically allocated or allocated from @a
- * pool.
- *
- * @since New in 1.7.
- */
-const char *
-svn_relpath_canonicalize(const char *relpath,
- apr_pool_t *pool);
-
-
-/** Return a new uri like @a uri, but transformed such that some types
- * of uri specification redundancies are removed.
- *
- * This involves collapsing redundant "/./" elements, removing
- * multiple adjacent separator characters, removing trailing
- * separator characters, and possibly other semantically inoperative
- * transformations.
- *
- * If @a uri starts with a schema, this function also normalizes the
- * escaping of the path component by unescaping characters that don't
- * need escaping and escaping characters that do need escaping but
- * weren't.
- *
- * This functions supports URLs.
- *
- * The returned uri may be statically allocated or allocated from @a pool.
- *
- * @since New in 1.7.
- */
-const char *
-svn_uri_canonicalize(const char *uri,
- apr_pool_t *pool);
-
-/** Return @c TRUE iff @a dirent is canonical. Use @a pool for temporary
- * allocations.
- *
- * @note The test for canonicalization is currently defined as
- * "looks exactly the same as @c svn_dirent_canonicalize() would make
- * it look".
- *
- * @since New in 1.6.
- */
-svn_boolean_t
-svn_dirent_is_canonical(const char *dirent,
- apr_pool_t *pool);
-
-/** Return @c TRUE iff @a relpath is canonical. Use @a scratch_pool for
- * temporary allocations.
- *
- * @since New in 1.7.
- */
-svn_boolean_t
-svn_relpath_is_canonical(const char *relpath,
- apr_pool_t *scratch_pool);
-
-/** Return @c TRUE iff @a uri is canonical. Use @a pool for temporary
- * allocations.
- *
- * @since New in 1.7.
- */
-svn_boolean_t
-svn_uri_is_canonical(const char *uri,
- apr_pool_t *pool);
-
-/** Return the longest common dirent shared by two canonicalized dirents,
- * @a dirent1 and @a dirent2. If there's no common ancestor, return the
- * empty path.
- *
- * @since New in 1.6.
- */
-char *
-svn_dirent_get_longest_ancestor(const char *dirent1,
- const char *dirent2,
- apr_pool_t *pool);
-
-/** Return the longest common path shared by two relative paths,
- * @a relpath1 and @a relpath2. If there's no common ancestor, return the
- * empty path.
- *
- * @since New in 1.7.
- */
-char *
-svn_relpath_get_longest_ancestor(const char *relpath1,
- const char *relpath2,
- apr_pool_t *pool);
-
-/** Return the longest common path shared by two canonicalized uris,
- * @a uri1 and @a uri2. If there's no common ancestor, return the
- * empty path.
- *
- * @a uri1 and @a uri2 may be URLs. In order for two URLs to have
- * a common ancestor, they must (a) have the same protocol (since two URLs
- * with the same path but different protocols may point at completely
- * different resources), and (b) share a common ancestor in their path
- * component, i.e. 'protocol://' is not a sufficient ancestor.
- *
- * @since New in 1.7.
- */
-char *
-svn_uri_get_longest_ancestor(const char *uri1,
- const char *uri2,
- apr_pool_t *pool);
-
-/** Convert @a relative canonicalized dirent to an absolute dirent and
- * return the results in @a *pabsolute, allocated in @a pool.
- * Raise SVN_ERR_BAD_FILENAME if the absolute dirent cannot be determined.
- *
- * @since New in 1.6.
- */
-svn_error_t *
-svn_dirent_get_absolute(const char **pabsolute,
- const char *relative,
- apr_pool_t *pool);
-
-/** Test if @a child_uri is a child of @a parent_uri.
- * If not, return @c NULL.
- * If so, return a copy of the remainder uri, allocated in @a pool.
- * (The remainder is the component which, added to @a parent_uri, yields
- * @a child_uri. The remainder does not begin with a dir separator.)
- *
- * Both uris must be in canonical form, and must either be absolute,
- * or contain no ".." components.
- *
- * If @a child_uri is the same as @a parent_uri, it is not considered a child,
- * so the result is @c NULL; an empty string is never returned.
- *
- * If @a pool is @c NULL , a pointer into @a child_uri will be returned to
- * identify the remainder uri.
- *
- * ### @todo the ".." restriction is unfortunate, and would ideally
- * be lifted by making the implementation smarter. But this is not
- * trivial: if the uri is "../foo", how do you know whether or not
- * the current directory is named "foo" in its parent?
- *
- * @since New in 1.7.
- */
-const char *
-svn_uri_is_child(const char *parent_uri,
- const char *child_uri,
- apr_pool_t *pool);
-
-/**
- * This function is similar to svn_uri_is_child(), except that it supports
- * Windows dirents and UNC paths on Windows.
- *
- * ### @todo Makes no attempt to handle one absolute and one relative
- * dirent, and will simply return NULL.
- *
- * @since New in 1.6.
- */
-const char *
-svn_dirent_is_child(const char *parent_dirent,
- const char *child_dirent,
- apr_pool_t *pool);
-
-/**
- * This function is similar to svn_uri_is_child(), except that it supports
- * only relative paths.
- *
- * @since New in 1.7.
- */
-const char *
-svn_relpath_is_child(const char *parent_relpath,
- const char *child_relpath,
- apr_pool_t *pool);
-
-/** Return TRUE if @a parent_dirent is an ancestor of @a child_dirent or
- * the dirents are equal, and FALSE otherwise.
- *
- * @since New in 1.6.
- */
-svn_boolean_t
-svn_dirent_is_ancestor(const char *parent_dirent,
- const char *child_dirent);
-
-/** Return TRUE if @a parent_relpath is an ancestor of @a child_relpath or
- * the relpaths are equal, and FALSE otherwise.
- *
- * This function supports only relative paths.
- *
- * @since New in 1.7.
- */
-svn_boolean_t
-svn_relpath_is_ancestor(const char *parent_relpath,
- const char *child_relpath);
-
-/** Return TRUE if @a parent_uri is an ancestor of @a child_uri or
- * the uris are equal, and FALSE otherwise.
- *
- * This function supports URLs.
- *
- * @since New in 1.7.
- */
-svn_boolean_t
-svn_uri_is_ancestor(const char *parent_uri,
- const char *child_uri);
-
-
-/** Return the relative path part of @a child_dirent that is below
- * @a parent_dirent, or just "" if @a parent_dirent is equal to
- * @a child_dirent. If @a child_dirent is not below @a parent_dirent,
- * return @a child_dirent completely.
- *
- * This function assumes @a parent_dirent and @a child_dirent are both
- * absolute or relative in the same way.
- *
- * ### Returning the child in the no-match case is a bad idea when the
- * paths are relative; can be useful when they are absolute.
- *
- * @since New in 1.7.
- */
-const char *
-svn_dirent_skip_ancestor(const char *parent_dirent,
- const char *child_dirent);
-
-/** Return the relative path part of @a child_relpath that is below
- * @a parent_relpath, or just "" if @a parent_relpath is equal to
- * @a child_relpath. If @a child_relpath is not below @a parent_relpath,
- * return @a child_relpath.
- *
- * ### Returning the child in the no-match case is a bad idea.
- *
- * @since New in 1.7.
- */
-const char *
-svn_relpath_skip_ancestor(const char *parent_relpath,
- const char *child_relpath);
-
-/** Return the relative path part of @a child_uri that is below
- * @a parent_uri, or just "" if @a parent_uri is equal to @a child_uri. If
- * @a child_uri is not below @a parent_uri, return @a child_uri.
- *
- * This function assumes @a parent_uri and @a child_uri are both absolute or
- * relative in the same way.
- *
- * ### Returning the child in the no-match case is a bad idea when the
- * paths are relative; can be useful when they are absolute.
- *
- * @since New in 1.7.
- */
-const char *
-svn_uri_skip_ancestor(const char *parent_uri,
- const char *child_uri);
-
-/** Find the common prefix of the canonicalized dirents in @a targets
- * (an array of <tt>const char *</tt>'s), and remove redundant dirents if @a
- * remove_redundancies is TRUE.
- *
- * - Set @a *pcommon to the absolute dirent of the dirent common to
- * all of the targets. If the targets have no common prefix (e.g.
- * "C:/file" and "D:/file" on Windows), set @a *pcommon to the empty
- * string.
- *
- * - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
- * to an array of targets relative to @a *pcommon, and if
- * @a remove_redundancies is TRUE, omit any dirents that are
- * descendants of another dirent in @a targets. If *pcommon
- * is empty, @a *pcondensed_targets will contain absolute dirents;
- * redundancies can still be removed. If @a pcondensed_targets is NULL,
- * leave it alone.
- *
- * Else if there is exactly one target, then
- *
- * - Set @a *pcommon to that target, and
- *
- * - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
- * to an array containing zero elements. Else if
- * @a pcondensed_targets is NULL, leave it alone.
- *
- * If there are no items in @a targets, set @a *pcommon and (if
- * applicable) @a *pcondensed_targets to @c NULL.
- *
- * Allocates @a *pcommon and @a *targets in @a result_pool. All
- * intermediate allocations will be performed in @a scratch_pool.
- *
- * @since New in 1.7.
- */
-svn_error_t *
-svn_dirent_condense_targets(const char **pcommon,
- apr_array_header_t **pcondensed_targets,
- const apr_array_header_t *targets,
- svn_boolean_t remove_redundancies,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-/** Find the common prefix of the canonicalized uris in @a targets
- * (an array of <tt>const char *</tt>'s), and remove redundant uris if @a
- * remove_redundancies is TRUE.
- *
- * - Set @a *pcommon to the common base uri of all of the targets.
- * If the targets have no common prefix (e.g. "http://srv1/file"
- * and "http://srv2/file"), set @a *pcommon to the empty
- * string.
- *
- * - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
- * to an array of targets relative to @a *pcommon, and if @a
- * remove_redundancies is TRUE, omit any uris that are descendants of
- * another uri in @a targets. If *pcommon is empty, @a
- * *pcondensed_targets will contain absolute uris; redundancies
- * can still be removed. If @a pcondensed_targets is NULL, leave it
- * alone.
- *
- * Else if there is exactly one target, then
- *
- * - Set @a *pcommon to that target, and
- *
- * - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
- * to an array containing zero elements. Else if
- * @a pcondensed_targets is NULL, leave it alone.
- *
- * If there are no items in @a targets, set @a *pcommon and (if
- * applicable) @a *pcondensed_targets to @c NULL.
- *
- * Allocates @a *pcommon and @a *targets in @a result_pool. Temporary
- * allocations will be performed in @a scratch_pool.
- *
- * @since New in 1.7.
- */
-svn_error_t *
-svn_uri_condense_targets(const char **pcommon,
- apr_array_header_t **pcondensed_targets,
- const apr_array_header_t *targets,
- svn_boolean_t remove_redundancies,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
-/** Check that when @a path is joined to @a base_path, the resulting path
- * is still under BASE_PATH in the local filesystem. If not, set @a under_root
- * to @c FALSE. If @a under_root is @c TRUE is returned, and @a result_path is
- * not @c NULL, then @a *result_path will be set to the absolute path of @a
- * path, allocated in @a result_pool.
- *
- * Note: Use of this function is strongly encouraged. Do not roll your own.
- * (http://cve.mitre.org/cgi-bin/cvename.cgi?name=2007-3846)
- *
- * @since New in 1.7.
- */
-svn_error_t *
-svn_dirent_is_under_root(svn_boolean_t *under_root,
- const char **result_path,
- const char *base_path,
- const char *path,
- apr_pool_t *result_pool);
-
-/** Set @a *dirent to the path corresponding to the file:// URL @a url, using
- * the platform-specific file:// rules.
- *
- * @since New in 1.7.
- */
-svn_error_t *
-svn_uri_get_dirent_from_file_url(const char **dirent,
- const char *url,
- apr_pool_t *pool);
-
-/** Set @a *url to a file:// URL, corresponding to @a dirent using the
- * platform specific dirent and file:// rules.
- *
- * @since New in 1.7.
- */
-svn_error_t *
-svn_uri_get_file_url_from_dirent(const char **url,
- const char *dirent,
- apr_pool_t *pool);
-
/** Return TRUE iff @a fspath is canonical.
* @a fspath need not be canonical, of course.
@@ -946,4 +155,4 @@ svn_fspath__get_longest_ancestor(const c
}
#endif /* __cplusplus */
-#endif /* SVN_DIRENT_URI_H */
+#endif /* SVN_FSPATH_H */
Modified: subversion/trunk/subversion/include/svn_dirent_uri.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_dirent_uri.h?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_dirent_uri.h (original)
+++ subversion/trunk/subversion/include/svn_dirent_uri.h Mon Jan 24 20:59:24 2011
@@ -52,13 +52,6 @@
* But not:
* "/file", "http://server/file"
*
- * - a Subversion filesystem path (fspath) -- otherwise known as a
- * path within a repository -- is a path relative to the root of
- * the repository filesystem, that starts with a slash ("/"). The
- * rules for a fspath are the same as for a relpath except for the
- * leading '/'. A fspath never ends with '/' except when the whole
- * path is just '/'. ### NOTE: The fspath API is private.
- *
* This distinction is needed because on Windows we have to handle some
* dirents and URIs differently. Since it's not possible to determine from
* the path string if it's a dirent or a URI, it's up to the API user to
@@ -77,7 +70,14 @@
* - @c svn_relpath_local_style()
* - @c svn_uri_canonicalize()
* - @c svn_uri_is_canonical()
- * - @c svn_fspath__is_canonical()
+ *
+ * The Subversion codebase also recognizes another class of path. A
+ * Subversion filesystem path (fspath) -- otherwise known as a path
+ * within a repository -- is a path relative to the root of the
+ * repository filesystem, that starts with a slash ("/"). The rules
+ * for a fspath are the same as for a relpath except for the leading
+ * '/'. A fspath never ends with '/' except when the whole path is
+ * just '/'. The fspath API is private (see private/svn_fspath.h).
*
* Code that works with a path-in-repository should use, in order of
* preference: a relpath (preferred), or a fspath (widely used by legacy
@@ -829,119 +829,6 @@ svn_uri_get_file_url_from_dirent(const c
const char *dirent,
apr_pool_t *pool);
-
-/** Return TRUE iff @a fspath is canonical.
- * @a fspath need not be canonical, of course.
- *
- * @since New in 1.7.
- */
-svn_boolean_t
-svn_fspath__is_canonical(const char *fspath);
-
-
-/** Return the dirname of @a fspath, defined as the path with its basename
- * removed. If @a fspath is "/", return "/".
- *
- * Allocate the result in @a pool.
- *
- * @since New in 1.7.
- */
-const char *
-svn_fspath__dirname(const char *fspath,
- apr_pool_t *pool);
-
-/** Return the last component of @a fspath. The returned value will have no
- * slashes in it. If @a fspath is "/", return "".
- *
- * If @a pool is NULL, return a pointer to within @a fspath, else allocate
- * the result in @a pool.
- *
- * @since New in 1.7.
- */
-const char *
-svn_fspath__basename(const char *fspath,
- apr_pool_t *pool);
-
-/** Divide the canonical @a fspath into @a *dirpath and @a
- * *base_name, allocated in @a pool.
- *
- * If @a dirpath or @a base_name is NULL, then don't set that one.
- *
- * Either @a dirpath or @a base_name may be @a fspath's own address, but they
- * may not both be the same address, or the results are undefined.
- *
- * If @a fspath has two or more components, the separator between @a dirpath
- * and @a base_name is not included in either of the new names.
- *
- * @since New in 1.7.
- */
-void
-svn_fspath__split(const char **dirpath,
- const char **base_name,
- const char *fspath,
- apr_pool_t *result_pool);
-
-/** Return the fspath composed of @a fspath with @a relpath appended.
- * Allocate the result in @a result_pool.
- *
- * @since New in 1.7.
- */
-char *
-svn_fspath__join(const char *fspath,
- const char *relpath,
- apr_pool_t *result_pool);
-
-
-/** Test if @a child_fspath is a child of @a parent_fspath. If not, return
- * NULL. If so, return the relpath which, if joined to @a parent_fspath,
- * would yield @a child_fspath.
- *
- * If @a child_fspath is the same as @a parent_fspath, it is not considered
- * a child, so the result is NULL; an empty string is never returned.
- *
- * If @a pool is NULL, a pointer into @a child_fspath will be returned to
- * identify the remainder fspath.
- *
- * @since New in 1.7.
- */
-const char *
-svn_fspath__is_child(const char *parent_fspath,
- const char *child_fspath,
- apr_pool_t *pool);
-
-/** Return the relative path part of @a child_fspath that is below
- * @a parent_fspath, or just "" if @a parent_fspath is equal to
- * @a child_fspath. If @a child_fspath is not below @a parent_fspath,
- * return @a child_fspath.
- *
- * ### Returning the child in the no-match case is a bad idea.
- *
- * @since New in 1.7.
- */
-const char *
-svn_fspath__skip_ancestor(const char *parent_fspath,
- const char *child_fspath);
-
-/** Return TRUE if @a parent_fspath is an ancestor of @a child_fspath or
- * the fspaths are equal, and FALSE otherwise.
- *
- * @since New in 1.7.
- */
-svn_boolean_t
-svn_fspath__is_ancestor(const char *parent_fspath,
- const char *child_fspath);
-
-/** Return the longest common path shared by two fspaths, @a fspath1 and
- * @a fspath2. If there's no common ancestor, return "/".
- *
- * @since New in 1.7.
- */
-char *
-svn_fspath__get_longest_ancestor(const char *fspath1,
- const char *fspath2,
- apr_pool_t *result_pool);
-
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/trunk/subversion/libsvn_client/list.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/list.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/list.c (original)
+++ subversion/trunk/subversion/libsvn_client/list.c Mon Jan 24 20:59:24 2011
@@ -31,6 +31,7 @@
#include "client.h"
+#include "private/svn_fspath.h"
#include "svn_private_config.h"
/* Get the directory entries of DIR at REV (relative to the root of
Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Mon Jan 24 20:59:24 2011
@@ -54,6 +54,7 @@
#include "private/svn_wc_private.h"
#include "private/svn_mergeinfo_private.h"
+#include "private/svn_fspath.h"
#include "svn_private_config.h"
Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Mon Jan 24 20:59:24 2011
@@ -41,6 +41,7 @@
#include "private/svn_mergeinfo_private.h"
#include "private/svn_wc_private.h"
#include "private/svn_ra_private.h"
+#include "private/svn_fspath.h"
#include "client.h"
#include "mergeinfo.h"
#include "svn_private_config.h"
Modified: subversion/trunk/subversion/libsvn_delta/path_driver.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/path_driver.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/path_driver.c (original)
+++ subversion/trunk/subversion/libsvn_delta/path_driver.c Mon Jan 24 20:59:24 2011
@@ -31,6 +31,7 @@
#include "svn_dirent_uri.h"
#include "svn_path.h"
#include "svn_sorts.h"
+#include "private/svn_fspath.h"
/*** Helper functions. ***/
Modified: subversion/trunk/subversion/libsvn_fs_base/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/dag.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/dag.c Mon Jan 24 20:59:24 2011
@@ -54,6 +54,7 @@
#include "private/svn_skel.h"
#include "private/svn_fs_util.h"
+#include "private/svn_fspath.h"
#include "../libsvn_fs/fs-loader.h"
#include "svn_private_config.h"
Modified: subversion/trunk/subversion/libsvn_fs_base/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/tree.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/tree.c Mon Jan 24 20:59:24 2011
@@ -64,6 +64,7 @@
#include "bdb/node-origins-table.h"
#include "bdb/miscellaneous-table.h"
#include "../libsvn_fs/fs-loader.h"
+#include "private/svn_fspath.h"
#include "private/svn_fs_util.h"
#include "private/svn_mergeinfo_private.h"
Modified: subversion/trunk/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/dag.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/dag.c Mon Jan 24 20:59:24 2011
@@ -36,6 +36,7 @@
#include "../libsvn_fs/fs-loader.h"
+#include "private/svn_fspath.h"
#include "svn_private_config.h"
Modified: subversion/trunk/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/lock.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/lock.c Mon Jan 24 20:59:24 2011
@@ -40,6 +40,7 @@
#include "../libsvn_fs/fs-loader.h"
#include "private/svn_fs_util.h"
+#include "private/svn_fspath.h"
#include "svn_private_config.h"
/* Names of hash keys used to store a lock for writing to disk. */
Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Mon Jan 24 20:59:24 2011
@@ -60,6 +60,7 @@
#include "private/svn_mergeinfo_private.h"
#include "private/svn_fs_util.h"
+#include "private/svn_fspath.h"
#include "../libsvn_fs/fs-loader.h"
Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Mon Jan 24 20:59:24 2011
@@ -36,6 +36,7 @@
#include "../libsvn_ra/ra_loader.h"
#include "private/svn_mergeinfo_private.h"
#include "private/svn_repos_private.h"
+#include "private/svn_fspath.h"
#define APR_WANT_STRFUNC
#include <apr_want.h>
Modified: subversion/trunk/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/reporter.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/reporter.c (original)
+++ subversion/trunk/subversion/libsvn_repos/reporter.c Mon Jan 24 20:59:24 2011
@@ -33,6 +33,7 @@
#include "repos.h"
#include "svn_private_config.h"
#include "private/svn_dep_compat.h"
+#include "private/svn_fspath.h"
#define NUM_CACHED_SOURCE_ROOTS 4
Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Mon Jan 24 20:59:24 2011
@@ -37,6 +37,7 @@
#include "svn_ctype.h"
#include "dirent_uri.h"
+#include "private/svn_fspath.h"
/* The canonical empty path. Can this be changed? Well, change the empty
test below and the path library will work, not so sure about the fs/wc
Modified: subversion/trunk/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/mergeinfo.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_subr/mergeinfo.c Mon Jan 24 20:59:24 2011
@@ -32,6 +32,7 @@
#include "svn_error_codes.h"
#include "svn_string.h"
#include "svn_mergeinfo.h"
+#include "private/svn_fspath.h"
#include "private/svn_mergeinfo_private.h"
#include "svn_private_config.h"
#include "svn_hash.h"
Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Mon Jan 24 20:59:24 2011
@@ -51,6 +51,7 @@
#include "tree_conflicts.h"
#include "private/svn_wc_private.h"
+#include "private/svn_fspath.h"
Modified: subversion/trunk/subversion/svnlook/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/main.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/svnlook/main.c (original)
+++ subversion/trunk/subversion/svnlook/main.c Mon Jan 24 20:59:24 2011
@@ -52,6 +52,7 @@
#include "svn_xml.h"
#include "private/svn_cmdline_private.h"
+#include "private/svn_fspath.h"
#include "svn_private_config.h"
Modified: subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1062974&r1=1062973&r2=1062974&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c Mon Jan 24 20:59:24 2011
@@ -36,6 +36,7 @@
#include "svn_pools.h"
#include "svn_dirent_uri.h"
+#include "private/svn_fspath.h"
#include "../svn_test.h"