You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/02/06 16:31:48 UTC
svn commit: r1067683 [2/6] - in /subversion/branches/performance: ./ build/
notes/ notes/commit-access-templates/ subversion/include/
subversion/include/private/ subversion/libsvn_client/
subversion/libsvn_delta/ subversion/libsvn_diff/ subversion/libs...
Modified: subversion/branches/performance/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/props.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/props.c Sun Feb 6 15:31:45 2011
@@ -1668,6 +1668,106 @@ svn_wc_prop_list2(apr_hash_t **props,
scratch_pool));
}
+/* Baton for read_dir_props. */
+struct read_dir_props_baton
+{
+ /* Working copy db handle. */
+ svn_wc__db_t *db;
+
+ /* The absolute path to the root of the tree being walked. */
+ const char *root_abspath;
+
+ /* The proplist receiver function and baton. */
+ svn_wc__proplist_receiver_t receiver_func;
+ void *receiver_baton;
+};
+
+/* An implementation of svn_wc__node_found_func_t. */
+static svn_error_t *
+read_dir_props(const char *local_abspath,
+ svn_node_kind_t kind,
+ void *baton,
+ apr_pool_t *scratch_pool)
+{
+ struct read_dir_props_baton *b = (struct read_dir_props_baton *)baton;
+
+ /* We only handle directories. */
+ if (kind != svn_node_dir)
+ return SVN_NO_ERROR;
+
+ /* Special case for root node of the tree. */
+ if (strcmp(local_abspath, b->root_abspath) == 0)
+ {
+ apr_hash_t *props;
+
+ SVN_ERR(svn_wc__db_read_props(&props, b->db, local_abspath,
+ scratch_pool, scratch_pool));
+ if (b->receiver_func && props && apr_hash_count(props) > 0)
+ SVN_ERR((*b->receiver_func)(b->receiver_baton, local_abspath,
+ props, scratch_pool));
+ }
+
+ /* All nodes within the tree are listed recursively as immediates. */
+ SVN_ERR(svn_wc__db_read_props_of_immediates(b->db, local_abspath,
+ b->receiver_func,
+ b->receiver_baton,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__prop_list_recursive(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ svn_depth_t depth,
+ svn_wc__proplist_receiver_t receiver_func,
+ void *receiver_baton,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool)
+{
+ struct read_dir_props_baton read_dir_baton;
+
+ if (depth <= svn_depth_immediates)
+ {
+ apr_hash_t *props;
+
+ SVN_ERR(svn_wc__db_read_props(&props, wc_ctx->db, local_abspath,
+ scratch_pool, scratch_pool));
+ if (receiver_func && props && apr_hash_count(props) > 0)
+ SVN_ERR((*receiver_func)(receiver_baton, local_abspath, props,
+ scratch_pool));
+ if (depth == svn_depth_empty)
+ return SVN_NO_ERROR;
+ }
+
+ if (depth == svn_depth_files)
+ {
+ SVN_ERR(svn_wc__db_read_props_of_files(wc_ctx->db, local_abspath,
+ receiver_func, receiver_baton,
+ scratch_pool));
+ return SVN_NO_ERROR;
+ }
+
+ if (depth == svn_depth_immediates)
+ {
+ SVN_ERR(svn_wc__db_read_props_of_immediates(wc_ctx->db, local_abspath,
+ receiver_func,
+ receiver_baton,
+ scratch_pool));
+ return SVN_NO_ERROR;
+ }
+
+ read_dir_baton.db = wc_ctx->db;
+ read_dir_baton.root_abspath = local_abspath;
+ read_dir_baton.receiver_func = receiver_func;
+ read_dir_baton.receiver_baton = receiver_baton;
+
+ SVN_ERR(svn_wc__internal_walk_children(wc_ctx->db, local_abspath, FALSE,
+ read_dir_props, &read_dir_baton,
+ depth, cancel_func, cancel_baton,
+ scratch_pool));
+ return SVN_NO_ERROR;
+}
svn_error_t *
svn_wc__get_pristine_props(apr_hash_t **props,
Modified: subversion/branches/performance/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/wc-queries.sql?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc-queries.sql Sun Feb 6 15:31:45 2011
@@ -158,10 +158,19 @@ SELECT properties, presence FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2
ORDER BY op_depth DESC;
+-- STMT_SELECT_NODE_PROPS_OF_CHILDREN
+SELECT properties, presence, local_relpath, kind FROM nodes
+WHERE wc_id = ?1 AND parent_relpath = ?2
+ORDER BY local_relpath, op_depth DESC;
+
-- STMT_SELECT_ACTUAL_PROPS
SELECT properties FROM actual_node
WHERE wc_id = ?1 AND local_relpath = ?2;
+-- STMT_SELECT_ACTUAL_PROPS_OF_CHILDREN
+SELECT properties, local_relpath FROM actual_node
+WHERE wc_id = ?1 AND parent_relpath = ?2;
+
-- STMT_UPDATE_NODE_BASE_PROPS
UPDATE nodes SET properties = ?3
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
Modified: subversion/branches/performance/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/wc_db.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc_db.c Sun Feb 6 15:31:45 2011
@@ -5056,6 +5056,216 @@ svn_wc__db_read_props(apr_hash_t **props
return SVN_NO_ERROR;
}
+/* Parse a node's PROP_DATA (which is PROP_DATA_LEN bytes long)
+ * into a hash table keyed by property names and containing property values.
+ *
+ * If parsing succeeds, and the set of properties is not empty,
+ * add the hash table to PROPS_PER_CHILD, keyed by the absolute path
+ * of the node CHILD_RELPATH within the working copy at WCROOT_ABSPATH.
+ *
+ * If the set of properties is empty, and PROPS_PER_CHILD already contains
+ * an entry for the node, clear the entry. This facilitates overriding
+ * properties retrieved from the NODES table with empty sets of properties
+ * stored in the ACTUAL_NODE table. */
+static svn_error_t *
+maybe_add_child_props(apr_hash_t *props_per_child,
+ const char *prop_data,
+ apr_size_t prop_data_len,
+ const char *child_relpath,
+ const char *wcroot_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const char *child_abspath;
+ apr_hash_t *props;
+ svn_skel_t *prop_skel;
+
+ prop_skel = svn_skel__parse(prop_data, prop_data_len, scratch_pool);
+ if (svn_skel__list_length(prop_skel) == 0)
+ return SVN_NO_ERROR;
+
+ child_abspath = svn_dirent_join(wcroot_abspath, child_relpath, result_pool);
+ SVN_ERR(svn_skel__parse_proplist(&props, prop_skel, result_pool));
+ if (apr_hash_count(props))
+ apr_hash_set(props_per_child, child_abspath, APR_HASH_KEY_STRING, props);
+ else
+ apr_hash_set(props_per_child, child_abspath, APR_HASH_KEY_STRING, NULL);
+
+ return SVN_NO_ERROR;
+}
+
+/* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and
+ * a hash table mapping <tt>char *</tt> names onto svn_string_t *
+ * values for any properties of immediate child nodes of LOCAL_ABSPATH.
+ * If FILES_ONLY is true, only report properties for file child nodes.
+ */
+static svn_error_t *
+read_props_of_children(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_boolean_t files_only,
+ svn_wc__proplist_receiver_t receiver_func,
+ void *receiver_baton,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *local_relpath;
+ const char *prev_child_relpath;
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t have_row;
+ apr_hash_t *props_per_child;
+ apr_hash_t *files;
+ apr_hash_t *not_present;
+ apr_hash_index_t *hi;
+ apr_pool_t *iterpool;
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+ SVN_ERR_ASSERT(receiver_func);
+
+ SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+ local_abspath,
+ svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ props_per_child = apr_hash_make(scratch_pool);
+ not_present = apr_hash_make(scratch_pool);
+ if (files_only)
+ files = apr_hash_make(scratch_pool);
+ else
+ files = NULL;
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_SELECT_NODE_PROPS_OF_CHILDREN));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ prev_child_relpath = NULL;
+ while (have_row)
+ {
+ svn_wc__db_status_t child_presence;
+ const char *child_relpath;
+ const char *prop_data;
+ apr_size_t len;
+
+ child_relpath = svn_sqlite__column_text(stmt, 2, scratch_pool);
+
+ if (prev_child_relpath && strcmp(child_relpath, prev_child_relpath) == 0)
+ {
+ /* Same child, but lower op_depth -- skip this row. */
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ continue;
+ }
+ prev_child_relpath = child_relpath;
+
+ child_presence = svn_sqlite__column_token(stmt, 1, presence_map);
+ if (child_presence != svn_wc__db_status_normal)
+ {
+ apr_hash_set(not_present, child_relpath, APR_HASH_KEY_STRING, "");
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ continue;
+ }
+
+ prop_data = svn_sqlite__column_blob(stmt, 0, &len, NULL);
+ if (prop_data)
+ {
+ if (files_only)
+ {
+ svn_wc__db_kind_t child_kind;
+
+ child_kind = svn_sqlite__column_token(stmt, 3, kind_map);
+ if (child_kind != svn_wc__db_kind_file &&
+ child_kind != svn_wc__db_kind_symlink)
+ {
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ continue;
+ }
+ apr_hash_set(files, child_relpath, APR_HASH_KEY_STRING, NULL);
+ }
+
+ SVN_ERR(maybe_add_child_props(props_per_child, prop_data, len,
+ child_relpath, pdh->wcroot->abspath,
+ scratch_pool, scratch_pool));
+ }
+
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ }
+
+ SVN_ERR(svn_sqlite__reset(stmt));
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_SELECT_ACTUAL_PROPS_OF_CHILDREN));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ while (have_row)
+ {
+ const char *child_relpath;
+ const char *prop_data;
+ apr_size_t len;
+
+ prop_data = svn_sqlite__column_blob(stmt, 0, &len, NULL);
+ if (prop_data)
+ {
+ child_relpath = svn_sqlite__column_text(stmt, 1, scratch_pool);
+
+ if (apr_hash_get(not_present, child_relpath, APR_HASH_KEY_STRING) ||
+ (files_only &&
+ apr_hash_get(files, child_relpath, APR_HASH_KEY_STRING) == NULL))
+ {
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ continue;
+ }
+ SVN_ERR(maybe_add_child_props(props_per_child, prop_data, len,
+ child_relpath, pdh->wcroot->abspath,
+ scratch_pool, scratch_pool));
+ }
+
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ }
+
+ SVN_ERR(svn_sqlite__reset(stmt));
+
+ iterpool = svn_pool_create(scratch_pool);
+ for (hi = apr_hash_first(scratch_pool, props_per_child);
+ hi;
+ hi = apr_hash_next(hi))
+ {
+ const char *child_abspath = svn__apr_hash_index_key(hi);
+ apr_hash_t *child_props = svn__apr_hash_index_val(hi);
+
+ svn_pool_clear(iterpool);
+
+ if (child_props)
+ SVN_ERR((*receiver_func)(receiver_baton, child_abspath, child_props,
+ iterpool));
+ }
+ svn_pool_destroy(iterpool);
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__db_read_props_of_files(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_wc__proplist_receiver_t receiver_func,
+ void *receiver_baton,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_return(read_props_of_children(db, local_abspath, TRUE,
+ receiver_func, receiver_baton,
+ scratch_pool));
+}
+
+svn_error_t *
+svn_wc__db_read_props_of_immediates(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_wc__proplist_receiver_t receiver_func,
+ void *receiver_baton,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_return(read_props_of_children(db, local_abspath, FALSE,
+ receiver_func, receiver_baton,
+ scratch_pool));
+}
+
static svn_error_t *
db_read_pristine_props(apr_hash_t **props,
Modified: subversion/branches/performance/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/wc_db.h?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc_db.h Sun Feb 6 15:31:45 2011
@@ -45,6 +45,7 @@
#include "private/svn_skel.h"
#include "private/svn_sqlite.h"
+#include "private/svn_wc_private.h"
#include "svn_private_config.h"
@@ -1572,6 +1573,29 @@ svn_wc__db_read_props(apr_hash_t **props
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+/* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and
+ * a hash table mapping <tt>char *</tt> names onto svn_string_t *
+ * values for any properties of file child nodes of LOCAL_ABSPATH.
+ */
+svn_error_t *
+svn_wc__db_read_props_of_files(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_wc__proplist_receiver_t
+ receiver_func,
+ void *receiver_baton,
+ apr_pool_t *scratch_pool);
+
+/* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and
+ * a hash table mapping <tt>char *</tt> names onto svn_string_t *
+ * values for any properties of immediate child nodes of LOCAL_ABSPATH.
+ */
+svn_error_t *
+svn_wc__db_read_props_of_immediates(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_wc__proplist_receiver_t
+ receiver_func,
+ void *receiver_baton,
+ apr_pool_t *scratch_pool);
/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the WORKING
tree (looking through to the BASE tree as required).
Modified: subversion/branches/performance/subversion/mod_dav_svn/activity.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/activity.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/activity.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/activity.c Sun Feb 6 15:31:45 2011
@@ -59,9 +59,9 @@ escape_activity(const char *activity_id,
static const char *
activity_pathname(const dav_svn_repos *repos, const char *activity_id)
{
- return svn_path_join(repos->activities_db,
- escape_activity(activity_id, repos->pool),
- repos->pool);
+ return svn_dirent_join(repos->activities_db,
+ escape_activity(activity_id, repos->pool),
+ repos->pool);
}
/* Return the transaction name of the activity stored in file
Modified: subversion/branches/performance/subversion/mod_dav_svn/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/merge.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/merge.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/merge.c Sun Feb 6 15:31:45 2011
@@ -36,6 +36,7 @@
#include "dav_svn.h"
+#include "private/svn_fspath.h"
/* #################################################################
@@ -184,7 +185,7 @@ do_resources(const dav_svn_repos *repos,
(and then remember that you sent it). Allocate parent in
pool, not subpool, because it stays in the sent hash
afterwards. */
- const char *parent = svn_path_dirname(path, pool);
+ const char *parent = svn_fspath__dirname(path, pool);
if (! apr_hash_get(sent, parent, APR_HASH_KEY_STRING))
{
SVN_ERR(send_response(repos, root, parent,
Modified: subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c Sun Feb 6 15:31:45 2011
@@ -369,8 +369,7 @@ SVNPath_cmd(cmd_parms *cmd, void *config
if (conf->fs_parent_path != NULL)
return "SVNPath cannot be defined at same time as SVNParentPath.";
- conf->fs_path = svn_path_internal_style(apr_pstrdup(cmd->pool, arg1),
- cmd->pool);
+ conf->fs_path = svn_dirent_internal_style(arg1, cmd->pool);
return NULL;
}
@@ -384,8 +383,7 @@ SVNParentPath_cmd(cmd_parms *cmd, void *
if (conf->fs_path != NULL)
return "SVNParentPath cannot be defined at same time as SVNPath.";
- conf->fs_parent_path = svn_path_internal_style(apr_pstrdup(cmd->pool, arg1),
- cmd->pool);
+ conf->fs_parent_path = svn_dirent_internal_style(arg1, cmd->pool);
return NULL;
}
@@ -422,7 +420,6 @@ SVNSpecialURI_cmd(cmd_parms *cmd, void *
return NULL;
}
-
static apr_uint64_t
parse_number(const char *arg)
{
@@ -529,7 +526,7 @@ dav_svn_get_repos_path(request_rec *r,
/* Construct the full path from the parent path base directory
and the repository name. */
- *repos_path = svn_path_join(fs_parent_path, repos_name, r->pool);
+ *repos_path = svn_urlpath__join(fs_parent_path, repos_name, r->pool);
return NULL;
}
Modified: subversion/branches/performance/subversion/mod_dav_svn/reports/deleted-rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/reports/deleted-rev.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/reports/deleted-rev.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/reports/deleted-rev.c Sun Feb 6 15:31:45 2011
@@ -32,6 +32,7 @@
#include "svn_dav.h"
#include "svn_pools.h"
+#include "private/svn_fspath.h"
#include "private/svn_dav_protocol.h"
#include "../dav_svn.h"
@@ -84,11 +85,18 @@ dav_svn__get_deleted_rev_report(const da
rel_path = dav_xml_get_cdata(child, resource->pool, 0);
if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
return derr;
+ /* Force REL_PATH to be a relative path, not an fspath. */
+ rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+ /* Append REL_PATH to the base FS path to get an absolute
+ repository path. */
+ abs_path = svn_fspath__join(resource->info->repos_path, rel_path,
+ resource->pool);
}
}
- /* Check that all parameters are present. */
- if (! (rel_path
+ /* Check that all parameters are present and valid. */
+ if (! (abs_path
&& SVN_IS_VALID_REVNUM(peg_rev)
&& SVN_IS_VALID_REVNUM(end_rev)))
{
@@ -98,11 +106,6 @@ dav_svn__get_deleted_rev_report(const da
SVN_DAV_ERROR_TAG);
}
- /* Append the relative path to the base FS path to get an absolute
- repository path. */
- abs_path = svn_path_join(resource->info->repos_path, rel_path,
- resource->pool);
-
/* Do what we actually came here for: Find the rev abs_path was deleted. */
err = svn_repos_deleted_rev(resource->info->repos->fs,
abs_path, peg_rev, end_rev,
Modified: subversion/branches/performance/subversion/mod_dav_svn/reports/file-revs.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/reports/file-revs.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/reports/file-revs.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/reports/file-revs.c Sun Feb 6 15:31:45 2011
@@ -31,7 +31,9 @@
#include "svn_base64.h"
#include "svn_props.h"
#include "svn_dav.h"
+
#include "private/svn_log.h"
+#include "private/svn_fspath.h"
#include "../dav_svn.h"
@@ -236,7 +238,7 @@ dav_svn__file_revs_report(const dav_reso
int ns;
struct file_rev_baton frb;
dav_svn__authz_read_baton arb;
- const char *path = NULL;
+ const char *abs_path = NULL;
/* These get determined from the request document. */
svn_revnum_t start = SVN_INVALID_REVNUM;
@@ -279,12 +281,25 @@ dav_svn__file_revs_report(const dav_reso
const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
return derr;
- path = svn_path_join(resource->info->repos_path, rel_path,
- resource->pool);
+
+ /* Force REL_PATH to be a relative path, not an fspath. */
+ rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+ /* Append the REL_PATH to the base FS path to get an
+ absolute repository path. */
+ abs_path = svn_fspath__join(resource->info->repos_path, rel_path,
+ resource->pool);
}
/* else unknown element; skip it */
}
+ /* Check that all parameters are present and valid. */
+ if (! abs_path)
+ return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
+ "Not all parameters passed.",
+ SVN_DAV_ERROR_NAMESPACE,
+ SVN_DAV_ERROR_TAG);
+
frb.bb = apr_brigade_create(resource->pool,
output->c->bucket_alloc);
frb.output = output;
@@ -295,7 +310,7 @@ dav_svn__file_revs_report(const dav_reso
/* Get the revisions and send them. */
serr = svn_repos_get_file_revs2(resource->info->repos->repos,
- path, start, end, include_merged_revisions,
+ abs_path, start, end, include_merged_revisions,
dav_svn__authz_read_func(&arb), &arb,
file_rev_handler, &frb, resource->pool);
@@ -332,7 +347,7 @@ dav_svn__file_revs_report(const dav_reso
/* We've detected a 'high level' svn action to log. */
dav_svn__operational_log(resource->info,
- svn_log__get_file_revs(path, start, end,
+ svn_log__get_file_revs(abs_path, start, end,
include_merged_revisions,
resource->pool));
Modified: subversion/branches/performance/subversion/mod_dav_svn/reports/get-location-segments.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/reports/get-location-segments.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/reports/get-location-segments.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/reports/get-location-segments.c Sun Feb 6 15:31:45 2011
@@ -40,6 +40,8 @@
#include "svn_dav.h"
#include "svn_base64.h"
+#include "private/svn_fspath.h"
+
#include "../dav_svn.h"
@@ -113,7 +115,7 @@ dav_svn__get_location_segments_report(co
apr_bucket_brigade *bb;
int ns;
apr_xml_elem *child;
- const char *path = NULL;
+ const char *abs_path;
svn_revnum_t peg_revision = SVN_INVALID_REVNUM;
svn_revnum_t start_rev = SVN_INVALID_REVNUM;
svn_revnum_t end_rev = SVN_INVALID_REVNUM;
@@ -156,16 +158,22 @@ dav_svn__get_location_segments_report(co
}
else if (strcmp(child->name, "path") == 0)
{
- path = dav_xml_get_cdata(child, resource->pool, 0);
- if ((derr = dav_svn__test_canonical(path, resource->pool)))
+ const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
+ if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
return derr;
- path = svn_path_join(resource->info->repos_path, path,
- resource->pool);
+
+ /* Force REL_PATH to be a relative path, not an fspath. */
+ rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+ /* Append the REL_PATH to the base FS path to get an
+ absolute repository path. */
+ abs_path = svn_fspath__join(resource->info->repos_path, rel_path,
+ resource->pool);
}
}
- /* Check our inputs. */
- if (! path)
+ /* Check that all parameters are present and valid. */
+ if (! abs_path)
return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
"Not all parameters passed.",
SVN_DAV_ERROR_NAMESPACE,
@@ -199,7 +207,7 @@ dav_svn__get_location_segments_report(co
location_segment_baton.output = output;
location_segment_baton.bb = bb;
if ((serr = svn_repos_node_location_segments(resource->info->repos->repos,
- path, peg_revision,
+ abs_path, peg_revision,
start_rev, end_rev,
location_segment_receiver,
&location_segment_baton,
Modified: subversion/branches/performance/subversion/mod_dav_svn/reports/get-locations.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/reports/get-locations.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/reports/get-locations.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/reports/get-locations.c Sun Feb 6 15:31:45 2011
@@ -39,6 +39,8 @@
#include "svn_dav.h"
#include "svn_base64.h"
+#include "private/svn_fspath.h"
+
#include "../dav_svn.h"
@@ -90,8 +92,7 @@ dav_svn__get_locations_report(const dav_
dav_svn__authz_read_baton arb;
/* The parameters to do the operation on. */
- const char *relative_path = NULL;
- const char *abs_path;
+ const char *abs_path = NULL;
svn_revnum_t peg_revision = SVN_INVALID_REVNUM;
apr_array_header_t *location_revisions;
@@ -134,26 +135,26 @@ dav_svn__get_locations_report(const dav_
}
else if (strcmp(child->name, "path") == 0)
{
- relative_path = dav_xml_get_cdata(child, resource->pool, 0);
- if ((derr = dav_svn__test_canonical(relative_path, resource->pool)))
+ const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
+ if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
return derr;
- }
- }
- /* Now we should have the parameters ready - let's
- check if they are all present. */
- if (! (relative_path && SVN_IS_VALID_REVNUM(peg_revision)))
- {
- return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
- "Not all parameters passed.",
- SVN_DAV_ERROR_NAMESPACE,
- SVN_DAV_ERROR_TAG);
+ /* Force REL_PATH to be a relative path, not an fspath. */
+ rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+ /* Append the REL_PATH to the base FS path to get an absolute
+ repository path. */
+ abs_path = svn_fspath__join(resource->info->repos_path, rel_path,
+ resource->pool);
+ }
}
- /* Append the relative path to the base FS path to get an absolute
- repository path. */
- abs_path = svn_path_join(resource->info->repos_path, relative_path,
- resource->pool);
+ /* Check that all parameters are present and valid. */
+ if (! (abs_path && SVN_IS_VALID_REVNUM(peg_revision)))
+ return dav_svn__new_error_tag(resource->pool, HTTP_BAD_REQUEST, 0,
+ "Not all parameters passed.",
+ SVN_DAV_ERROR_NAMESPACE,
+ SVN_DAV_ERROR_TAG);
/* Build an authz read baton */
arb.r = resource->info->r;
Modified: subversion/branches/performance/subversion/mod_dav_svn/reports/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/reports/log.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/reports/log.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/reports/log.c Sun Feb 6 15:31:45 2011
@@ -37,6 +37,7 @@
#include "svn_props.h"
#include "private/svn_log.h"
+#include "private/svn_fspath.h"
#include "../dav_svn.h"
@@ -359,8 +360,14 @@ dav_svn__log_report(const dav_resource *
const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
return derr;
- target = svn_path_join(resource->info->repos_path, rel_path,
- resource->pool);
+
+ /* Force REL_PATH to be a relative path, not an fspath. */
+ rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+ /* Append the REL_PATH to the base FS path to get an
+ absolute repository path. */
+ target = svn_fspath__join(resource->info->repos_path, rel_path,
+ resource->pool);
APR_ARRAY_PUSH(paths, const char *) = target;
}
/* else unknown element; skip it */
Modified: subversion/branches/performance/subversion/mod_dav_svn/reports/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/reports/mergeinfo.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/reports/mergeinfo.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/reports/mergeinfo.c Sun Feb 6 15:31:45 2011
@@ -34,6 +34,8 @@
#include "svn_xml.h"
#include "svn_path.h"
#include "svn_dav.h"
+
+#include "private/svn_fspath.h"
#include "private/svn_dav_protocol.h"
#include "private/svn_log.h"
#include "private/svn_mergeinfo_private.h"
@@ -96,8 +98,14 @@ dav_svn__get_mergeinfo_report(const dav_
const char *rel_path = dav_xml_get_cdata(child, resource->pool, 0);
if ((derr = dav_svn__test_canonical(rel_path, resource->pool)))
return derr;
- target = svn_path_join(resource->info->repos_path, rel_path,
- resource->pool);
+
+ /* Force REL_PATH to be a relative path, not an fspath. */
+ rel_path = svn_relpath_canonicalize(rel_path, resource->pool);
+
+ /* Append the REL_PATH to the base FS path to get an
+ absolute repository path. */
+ target = svn_fspath__join(resource->info->repos_path, rel_path,
+ resource->pool);
(*((const char **)(apr_array_push(paths)))) = target;
}
else if (strcmp(child->name, SVN_DAV__VALIDATE_INHERITED) == 0)
Modified: subversion/branches/performance/subversion/mod_dav_svn/reports/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/reports/update.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/reports/update.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/reports/update.c Sun Feb 6 15:31:45 2011
@@ -38,6 +38,7 @@
#include "svn_path.h"
#include "svn_dav.h"
#include "svn_props.h"
+
#include "private/svn_log.h"
#include "private/svn_fspath.h"
@@ -155,7 +156,7 @@ get_from_path_map(apr_hash_t *hash, cons
/* we found a mapping ... but of one of PATH's parents.
soooo, we get to re-append the chunks of PATH that we
broke off to the REPOS_PATH we found. */
- return svn_path_join(repos_path, path + my_path->len + 1, pool);
+ return svn_fspath__join(repos_path, path + my_path->len + 1, pool);
}
}
while (! svn_path_is_empty(my_path->data)
@@ -316,12 +317,16 @@ add_helper(svn_boolean_t is_dir,
DAV_SVN__BUILD_URI_BC,
revision, real_path,
0 /* add_href */, pool);
+ bc_url = svn_urlpath__canonicalize(bc_url, pool);
/* ugh, build_uri ignores the path and just builds the root
of the baseline collection. we have to tack the
real_path on manually, ignoring its leading slash. */
if (real_path && (! svn_path_is_empty(real_path)))
- bc_url = svn_path_url_add_component(bc_url, real_path+1, pool);
+ bc_url = svn_urlpath__join(bc_url,
+ svn_path_uri_encode(real_path + 1,
+ pool),
+ pool);
/* make sure that the BC_URL is xml attribute safe. */
bc_url = apr_xml_quote_string(pool, bc_url, 1);
@@ -1069,14 +1074,14 @@ dav_svn__update_report(const dav_resourc
{
/* if the src is split into anchor/target, so must the
telescoping dst_path be. */
- uc.dst_path = svn_path_dirname(dst_path, resource->pool);
+ uc.dst_path = svn_fspath__dirname(dst_path, resource->pool);
/* Also, the svn_repos_dir_delta2() is going to preserve our
target's name, so we need a pathmap entry for that. */
if (! uc.pathmap)
uc.pathmap = apr_hash_make(resource->pool);
add_to_path_map(uc.pathmap,
- svn_path_join(src_path, target, resource->pool),
+ svn_fspath__join(src_path, target, resource->pool),
dst_path);
}
else
@@ -1240,8 +1245,8 @@ dav_svn__update_report(const dav_resourc
const char *this_path;
if (! uc.pathmap)
uc.pathmap = apr_hash_make(resource->pool);
- this_path = svn_path_join_many(apr_hash_pool_get(uc.pathmap),
- src_path, target, path, NULL);
+ this_path = svn_fspath__join(src_path, target, resource->pool);
+ this_path = svn_fspath__join(this_path, path, resource->pool);
add_to_path_map(uc.pathmap, this_path, linkpath);
}
}
@@ -1268,7 +1273,7 @@ dav_svn__update_report(const dav_resourc
const char *action, *spath;
if (target)
- spath = svn_path_join(src_path, target, resource->pool);
+ spath = svn_fspath__join(src_path, target, resource->pool);
else
spath = src_path;
Modified: subversion/branches/performance/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/repos.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/repos.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/repos.c Sun Feb 6 15:31:45 2011
@@ -2289,9 +2289,13 @@ get_resource(request_rec *r,
}
-/* Helper func: return the parent of PATH, allocated in POOL. */
+/* Helper func: return the parent of PATH, allocated in POOL. If
+ IS_URLPATH is set, PATH is a urlpath; otherwise, it's either a
+ relpath or an fspath. */
static const char *
-get_parent_path(const char *path, apr_pool_t *pool)
+get_parent_path(const char *path,
+ svn_boolean_t is_urlpath,
+ apr_pool_t *pool)
{
apr_size_t len;
char *tmp = apr_pstrdup(pool, path);
@@ -2303,8 +2307,11 @@ get_parent_path(const char *path, apr_po
/* Remove any trailing slash; else svn_path_dirname() asserts. */
if (tmp[len-1] == '/')
tmp[len-1] = '\0';
-
- return svn_path_dirname(tmp, pool);
+
+ if (is_urlpath)
+ return svn_urlpath__dirname(tmp, pool);
+ else
+ return svn_fspath__dirname(tmp, pool);
}
return path;
@@ -2340,19 +2347,20 @@ get_parent_resource(const dav_resource *
parent->versioned = 1;
parent->hooks = resource->hooks;
parent->pool = resource->pool;
- parent->uri = get_parent_path(resource->uri, resource->pool);
+ parent->uri = get_parent_path(resource->uri, TRUE, resource->pool);
parent->info = parentinfo;
parentinfo->pool = resource->info->pool;
parentinfo->uri_path =
svn_stringbuf_create(get_parent_path(resource->info->uri_path->data,
- resource->pool), resource->pool);
+ TRUE, resource->pool),
+ resource->pool);
parentinfo->repos = resource->info->repos;
parentinfo->root = resource->info->root;
parentinfo->r = resource->info->r;
parentinfo->svn_client_options = resource->info->svn_client_options;
parentinfo->repos_path = get_parent_path(resource->info->repos_path,
- resource->pool);
+ FALSE, resource->pool);
*parent_resource = parent;
break;
@@ -3316,8 +3324,8 @@ deliver(const dav_resource *resource, ap
looking at a parent-path listing. */
if (SVN_IS_VALID_REVNUM(dir_rev))
{
- repos_relpath = svn_path_join(resource->info->repos_path,
- name, entry_pool);
+ repos_relpath = svn_fspath__join(resource->info->repos_path,
+ name, entry_pool);
if (! dav_svn__allow_read(resource->info->r,
resource->info->repos,
repos_relpath,
Modified: subversion/branches/performance/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/util.c?rev=1067683&r1=1067682&r2=1067683&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/util.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/util.c Sun Feb 6 15:31:45 2011
@@ -36,7 +36,7 @@
#include "svn_base64.h"
#include "dav_svn.h"
-
+#include "private/svn_fspath.h"
dav_error *
dav_svn__new_error(apr_pool_t *pool,
@@ -489,9 +489,15 @@ dav_svn__brigade_printf(apr_bucket_briga
dav_error *
dav_svn__test_canonical(const char *path, apr_pool_t *pool)
{
- if (svn_path_is_canonical(path, pool))
+ if (path[0] == '\0')
return NULL;
-
+ if (svn_path_is_url(path) && svn_uri_is_canonical(path, pool))
+ return NULL;
+ if ((path[0] == '/') && svn_fspath__is_canonical(path))
+ return NULL;
+ if (svn_relpath_is_canonical(path, pool))
+ return NULL;
+
/* Otherwise, generate a generic HTTP_BAD_REQUEST error. */
return dav_svn__new_error_tag
(pool, HTTP_BAD_REQUEST, 0,