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/02 14:04:59 UTC
svn commit: r1066452 [6/11] - in /subversion/branches/performance: ./ build/
build/ac-macros/ build/generator/ contrib/hook-scripts/ notes/
notes/api-errata/1.7/
subversion/bindings/javahl/tests/org/apache/subversion/javahl/
subversion/include/ subvers...
Modified: subversion/branches/performance/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/path.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/path.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/path.c Wed Feb 2 13:04:51 2011
@@ -428,12 +428,88 @@ svn_path_compare_paths(const char *path1
return (unsigned char)(path1[i]) < (unsigned char)(path2[i]) ? -1 : 1;
}
+/* Return the string length of the longest common ancestor of PATH1 and PATH2.
+ *
+ * This function handles everything except the URL-handling logic
+ * of svn_path_get_longest_ancestor, and assumes that PATH1 and
+ * PATH2 are *not* URLs.
+ *
+ * If the two paths do not share a common ancestor, return 0.
+ *
+ * New strings are allocated in POOL.
+ */
+static apr_size_t
+get_path_ancestor_length(const char *path1,
+ const char *path2,
+ apr_pool_t *pool)
+{
+ apr_size_t path1_len, path2_len;
+ apr_size_t i = 0;
+ apr_size_t last_dirsep = 0;
+
+ path1_len = strlen(path1);
+ path2_len = strlen(path2);
+
+ if (SVN_PATH_IS_EMPTY(path1) || SVN_PATH_IS_EMPTY(path2))
+ return 0;
+
+ while (path1[i] == path2[i])
+ {
+ /* Keep track of the last directory separator we hit. */
+ if (path1[i] == '/')
+ last_dirsep = i;
+
+ i++;
+
+ /* If we get to the end of either path, break out. */
+ if ((i == path1_len) || (i == path2_len))
+ break;
+ }
+
+ /* two special cases:
+ 1. '/' is the longest common ancestor of '/' and '/foo'
+ 2. '/' is the longest common ancestor of '/rif' and '/raf' */
+ if (i == 1 && path1[0] == '/' && path2[0] == '/')
+ return 1;
+
+ /* last_dirsep is now the offset of the last directory separator we
+ crossed before reaching a non-matching byte. i is the offset of
+ that non-matching byte. */
+ if (((i == path1_len) && (path2[i] == '/'))
+ || ((i == path2_len) && (path1[i] == '/'))
+ || ((i == path1_len) && (i == path2_len)))
+ return i;
+ else
+ if (last_dirsep == 0 && path1[0] == '/' && path2[0] == '/')
+ return 1;
+ return last_dirsep;
+}
+
+
char *
svn_path_get_longest_ancestor(const char *path1,
const char *path2,
apr_pool_t *pool)
{
- return svn_uri_get_longest_ancestor(path1, path2, pool);
+ svn_boolean_t path1_is_url = svn_path_is_url(path1);
+ svn_boolean_t path2_is_url = svn_path_is_url(path2);
+
+ /* Are we messing with URLs? If we have a mix of URLs and non-URLs,
+ there's nothing common between them. */
+ if (path1_is_url && path2_is_url)
+ {
+ return svn_uri_get_longest_ancestor(path1, path2, pool);
+ }
+ else if ((! path1_is_url) && (! path2_is_url))
+ {
+ return apr_pstrndup(pool, path1,
+ get_path_ancestor_length(path1, path2, pool));
+ }
+ else
+ {
+ /* A URL and a non-URL => no common prefix */
+ return apr_pmemdup(pool, SVN_EMPTY_PATH, sizeof(SVN_EMPTY_PATH));
+ }
}
const char *
@@ -441,14 +517,70 @@ svn_path_is_child(const char *path1,
const char *path2,
apr_pool_t *pool)
{
- return svn_uri_is_child(path1, path2, pool);
+ apr_size_t i;
+
+ /* assert (is_canonical (path1, strlen (path1))); ### Expensive strlen */
+ /* assert (is_canonical (path2, strlen (path2))); ### Expensive strlen */
+
+ /* Allow "" and "foo" to be parent/child */
+ if (SVN_PATH_IS_EMPTY(path1)) /* "" is the parent */
+ {
+ if (SVN_PATH_IS_EMPTY(path2) /* "" not a child */
+ || path2[0] == '/') /* "/foo" not a child */
+ return NULL;
+ else
+ /* everything else is child */
+ return pool ? apr_pstrdup(pool, path2) : path2;
+ }
+
+ /* Reach the end of at least one of the paths. How should we handle
+ things like path1:"foo///bar" and path2:"foo/bar/baz"? It doesn't
+ appear to arise in the current Subversion code, it's not clear to me
+ if they should be parent/child or not. */
+ for (i = 0; path1[i] && path2[i]; i++)
+ if (path1[i] != path2[i])
+ return NULL;
+
+ /* There are two cases that are parent/child
+ ... path1[i] == '\0'
+ .../foo path2[i] == '/'
+ or
+ / path1[i] == '\0'
+ /foo path2[i] != '/'
+ */
+ if (path1[i] == '\0' && path2[i])
+ {
+ if (path2[i] == '/')
+ return pool ? apr_pstrdup(pool, path2 + i + 1) : path2 + i + 1;
+ else if (i == 1 && path1[0] == '/')
+ return pool ? apr_pstrdup(pool, path2 + 1) : path2 + 1;
+ }
+
+ /* Otherwise, path2 isn't a child. */
+ return NULL;
}
svn_boolean_t
svn_path_is_ancestor(const char *path1, const char *path2)
{
- return svn_uri_is_ancestor(path1, path2);
+ apr_size_t path1_len = strlen(path1);
+
+ /* If path1 is empty and path2 is not absoulte, then path1 is an ancestor. */
+ if (SVN_PATH_IS_EMPTY(path1))
+ return *path2 != '/';
+
+ /* If path1 is a prefix of path2, then:
+ - If path1 ends in a path separator,
+ - If the paths are of the same length
+ OR
+ - path2 starts a new path component after the common prefix,
+ then path1 is an ancestor. */
+ if (strncmp(path1, path2, path1_len) == 0)
+ return path1[path1_len - 1] == '/'
+ || (path2[path1_len] == '/' || path2[path1_len] == '\0');
+
+ return FALSE;
}
Modified: subversion/branches/performance/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/sqlite.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/sqlite.c Wed Feb 2 13:04:51 2011
@@ -694,7 +694,7 @@ check_format(svn_sqlite__db_t *db,
current_schema);
}
-static volatile svn_atomic_t sqlite_init_state;
+static volatile svn_atomic_t sqlite_init_state = 0;
/* If possible, verify that SQLite was compiled in a thread-safe
manner. */
@@ -932,7 +932,11 @@ svn_sqlite__open(svn_sqlite__db_t **db,
### Maybe switch to NORMAL(1) when we use larger transaction
scopes */
- "PRAGMA synchronous=OFF;"));
+ "PRAGMA synchronous=OFF;"
+ /* Enable recursive triggers so that a user trigger will fire
+ * in the deletion phase of an INSERT OR REPLACE statement.
+ * Requires SQLite >= 3.6.18 */
+ "PRAGMA recursive_triggers=ON;"));
#if SQLITE_VERSION_AT_LEAST(3,6,19) && defined(SVN_DEBUG)
/* When running in debug mode, enable the checking of foreign key
Modified: subversion/branches/performance/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/stream.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/stream.c Wed Feb 2 13:04:51 2011
@@ -803,11 +803,6 @@ struct baton_apr {
/* If not NULL, file is actually wrapped into this cached file handle
* and should be returned to the file handle cache asap. */
svn_file_handle_cache__handle_t *cached_handle;
-
- /* Offsets when reading from a range of the file.
- * When either of these is negative, no range has been specified. */
- apr_off_t start;
- apr_off_t end;
};
/* svn_stream_mark_t for streams backed by APR files. */
@@ -918,12 +913,7 @@ seek_handler_apr(void *baton, svn_stream
}
else
{
- apr_off_t offset;
-
- /* If we're reading from a range, reset to the start of the range.
- * Otherwise, reset to the start of the file. */
- offset = btn->start >= 0 ? btn->start : 0;
-
+ apr_off_t offset = 0;
SVN_ERR(svn_io_file_seek(btn->file, APR_SET, &offset, btn->pool));
}
@@ -1042,8 +1032,6 @@ svn_stream_from_aprfile2(apr_file_t *fil
baton = apr_palloc(pool, sizeof(*baton));
baton->file = file;
baton->pool = pool;
- baton->start = -1;
- baton->end = -1;
stream = svn_stream_create(baton, pool);
svn_stream_set_read(stream, read_handler_apr);
svn_stream_set_write(stream, write_handler_apr);
@@ -1082,47 +1070,6 @@ svn_stream__from_cached_file_handle(svn_
return stream;
}
-/* A read handler (#svn_read_fn_t) that forwards to read_handler_apr()
- but only allows reading between BATON->start and BATON->end. */
-static svn_error_t *
-read_range_handler_apr(void *baton, char *buffer, apr_size_t *len)
-{
- struct baton_apr *btn = baton;
-
- /* ### BH: I think this can be simplified/optimized by just keeping
- track of the current position. */
-
- /* Check for range restriction. */
- if (btn->start >= 0 && btn->end > 0)
- {
- /* Get the current file position and make sure it is in range. */
- apr_off_t pos;
-
- pos = 0;
- SVN_ERR(svn_io_file_seek(btn->file, APR_CUR, &pos, btn->pool));
- if (pos < btn->start)
- {
- /* We're before the range, so forward the file cursor to
- * the start of the range. */
- pos = btn->start;
- SVN_ERR(svn_io_file_seek(btn->file, APR_SET, &pos, btn->pool));
- }
- else if (pos >= btn->end)
- {
- /* We're past the range, indicate that no bytes can be read. */
- *len = 0;
- return SVN_NO_ERROR;
- }
-
- /* We're in range, but don't read over the end of the range. */
- if (pos + *len > btn->end)
- *len = (apr_size_t)(btn->end - pos);
- }
-
- return read_handler_apr(baton, buffer, len);
-}
-
-
/* A skip data handler (#svn_skip_fn_t) that forwards to skip_handler_apr()
but only allows reading between BATON->start and BATON->end. */
static svn_error_t *
@@ -1163,45 +1110,6 @@ skip_range_handler_apr(void *baton, apr_
return skip_handler_apr(baton, count);
}
-
-svn_stream_t *
-svn_stream_from_aprfile_range_readonly(apr_file_t *file,
- svn_boolean_t disown,
- apr_off_t start,
- apr_off_t end,
- apr_pool_t *pool)
-{
- struct baton_apr *baton;
- svn_stream_t *stream;
- apr_off_t pos;
-
- /* ### HACK: These shortcuts don't handle disown FALSE properly */
- if (file == NULL || start < 0 || end <= 0 || start >= end)
- return svn_stream_empty(pool);
-
- /* Set the file pointer to the start of the range. */
- pos = start;
- if (apr_file_seek(file, APR_SET, &pos) != APR_SUCCESS)
- return svn_stream_empty(pool);
-
- baton = apr_palloc(pool, sizeof(*baton));
- baton->file = file;
- baton->pool = pool;
- baton->start = start;
- baton->end = end;
- stream = svn_stream_create(baton, pool);
- svn_stream_set_read(stream, read_range_handler_apr);
- svn_stream_set_skip(stream, skip_range_handler_apr);
- svn_stream_set_mark(stream, mark_handler_apr);
- svn_stream_set_seek(stream, seek_handler_apr);
- svn_stream_set_buffered(stream, buffered_handler_apr);
-
- if (! disown)
- svn_stream_set_close(stream, close_handler_apr);
-
- return stream;
-}
-
/* Compressed stream support */
Modified: subversion/branches/performance/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/subst.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/subst.c Wed Feb 2 13:04:51 2011
@@ -171,10 +171,9 @@ keyword_printf(const char *fmt,
svn_stringbuf_appendcstr(value, author);
break;
case 'b': /* basename of this file */
- if (url)
+ if (url && *url)
{
- const char *base_name
- = svn_path_uri_decode(svn_uri_basename(url, pool), pool);
+ const char *base_name = svn_uri_basename(url, pool);
svn_stringbuf_appendcstr(value, base_name);
}
break;
@@ -1894,6 +1893,7 @@ svn_subst_translate_string2(svn_string_t
svn_boolean_t *translated_line_endings,
const svn_string_t *value,
const char *encoding,
+ svn_boolean_t repair,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1923,7 +1923,7 @@ svn_subst_translate_string2(svn_string_t
translated_line_endings,
val_utf8,
"\n", /* translate to LF */
- FALSE, /* no repair */
+ repair,
NULL, /* no keywords */
FALSE, /* no expansion */
scratch_pool));
Modified: subversion/branches/performance/subversion/libsvn_subr/target.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/target.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/target.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/target.c Wed Feb 2 13:04:51 2011
@@ -47,6 +47,8 @@ svn_path_condense_targets(const char **p
svn_boolean_t *removed;
apr_array_header_t *abs_targets;
int basedir_len;
+ const char *first_target;
+ svn_boolean_t first_target_is_url;
/* Early exit when there's no data to work on. */
if (targets->nelts <= 0)
@@ -58,9 +60,15 @@ svn_path_condense_targets(const char **p
}
/* Get the absolute path of the first target. */
- SVN_ERR(svn_path_get_absolute(pcommon,
- APR_ARRAY_IDX(targets, 0, const char *),
- pool));
+ first_target = APR_ARRAY_IDX(targets, 0, const char *);
+ first_target_is_url = svn_path_is_url(first_target);
+ if (first_target_is_url)
+ {
+ first_target = apr_pstrdup(pool, first_target);
+ *pcommon = first_target;
+ }
+ else
+ SVN_ERR(svn_dirent_get_absolute(pcommon, first_target, pool));
/* Early exit when there's only one path to work on. */
if (targets->nelts == 1)
@@ -88,9 +96,31 @@ svn_path_condense_targets(const char **p
{
const char *rel = APR_ARRAY_IDX(targets, i, const char *);
const char *absolute;
- SVN_ERR(svn_path_get_absolute(&absolute, rel, pool));
+ svn_boolean_t is_url = svn_path_is_url(rel);
+
+ if (is_url)
+ absolute = apr_pstrdup(pool, rel); /* ### TODO: avoid pool dup? */
+ else
+ SVN_ERR(svn_dirent_get_absolute(&absolute, rel, pool));
+
APR_ARRAY_PUSH(abs_targets, const char *) = absolute;
- *pcommon = svn_path_get_longest_ancestor(*pcommon, absolute, pool);
+
+ /* If we've not already determined that there's no common
+ parent, then continue trying to do so. */
+ if (*pcommon && **pcommon)
+ {
+ /* If the is-url-ness of this target doesn't match that of
+ the first target, our search for a common ancestor can
+ end right here. Otherwise, use the appropriate
+ get-longest-ancestor function per the path type. */
+ if (is_url != first_target_is_url)
+ *pcommon = "";
+ else if (first_target_is_url)
+ *pcommon = svn_uri_get_longest_ancestor(*pcommon, absolute, pool);
+ else
+ *pcommon = svn_dirent_get_longest_ancestor(*pcommon, absolute,
+ pool);
+ }
}
if (pcondensed_targets != NULL)
@@ -113,6 +143,7 @@ svn_path_condense_targets(const char **p
{
const char *abs_targets_i;
const char *abs_targets_j;
+ svn_boolean_t i_is_url, j_is_url;
const char *ancestor;
if (removed[j])
@@ -120,9 +151,20 @@ svn_path_condense_targets(const char **p
abs_targets_i = APR_ARRAY_IDX(abs_targets, i, const char *);
abs_targets_j = APR_ARRAY_IDX(abs_targets, j, const char *);
+ i_is_url = svn_path_is_url(abs_targets_i);
+ j_is_url = svn_path_is_url(abs_targets_j);
- ancestor = svn_path_get_longest_ancestor
- (abs_targets_i, abs_targets_j, pool);
+ if (i_is_url != j_is_url)
+ continue;
+
+ if (i_is_url)
+ ancestor = svn_uri_get_longest_ancestor(abs_targets_i,
+ abs_targets_j,
+ pool);
+ else
+ ancestor = svn_dirent_get_longest_ancestor(abs_targets_i,
+ abs_targets_j,
+ pool);
if (*ancestor == '\0')
continue;
@@ -237,10 +279,14 @@ svn_path_remove_redundancies(apr_array_h
const char *rel_path = APR_ARRAY_IDX(targets, i, const char *);
const char *abs_path;
int j;
- svn_boolean_t keep_me;
+ svn_boolean_t is_url, keep_me;
/* Get the absolute path for this target. */
- SVN_ERR(svn_path_get_absolute(&abs_path, rel_path, temp_pool));
+ is_url = svn_path_is_url(rel_path);
+ if (is_url)
+ abs_path = rel_path;
+ else
+ SVN_ERR(svn_dirent_get_absolute(&abs_path, rel_path, temp_pool));
/* For each keeper in ABS_TARGETS, see if this target is the
same as or a child of that keeper. */
@@ -248,6 +294,14 @@ svn_path_remove_redundancies(apr_array_h
for (j = 0; j < abs_targets->nelts; j++)
{
const char *keeper = APR_ARRAY_IDX(abs_targets, j, const char *);
+ svn_boolean_t keeper_is_url = svn_path_is_url(keeper);
+ const char *child_relpath;
+
+ /* If KEEPER hasn't the same is-url-ness as ABS_PATH, we
+ know they aren't equal and that one isn't the child of
+ the other. */
+ if (is_url != keeper_is_url)
+ continue;
/* Quit here if we find this path already in the keepers. */
if (strcmp(keeper, abs_path) == 0)
@@ -257,7 +311,11 @@ svn_path_remove_redundancies(apr_array_h
}
/* Quit here if this path is a child of one of the keepers. */
- if (svn_path_is_child(keeper, abs_path, temp_pool))
+ if (is_url)
+ child_relpath = svn_uri_is_child(keeper, abs_path, temp_pool);
+ else
+ child_relpath = svn_dirent_is_child(keeper, abs_path, temp_pool);
+ if (child_relpath)
{
keep_me = FALSE;
break;
Modified: subversion/branches/performance/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/adm_files.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/adm_files.c Wed Feb 2 13:04:51 2011
@@ -607,8 +607,6 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
repos_relpath = svn_uri_is_child(repos_root_url, url, scratch_pool);
if (repos_relpath == NULL)
repos_relpath = "";
- else
- repos_relpath = svn_path_uri_decode(repos_relpath, scratch_pool);
/* Early out: we know we're not dealing with an existing wc, so
just create one. */
@@ -685,8 +683,9 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
_("URL '%s' doesn't match existing "
"URL '%s' in '%s'"),
url,
- svn_uri_join(db_repos_root_url,
- db_repos_relpath, scratch_pool),
+ svn_path_url_add_component2(db_repos_root_url,
+ db_repos_relpath,
+ scratch_pool),
local_abspath);
}
}
Modified: subversion/branches/performance/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/adm_ops.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/adm_ops.c Wed Feb 2 13:04:51 2011
@@ -129,7 +129,6 @@ process_committed_leaf(svn_wc__db_t *db,
svn_wc__db_kind_t kind;
const svn_checksum_t *copied_checksum;
const char *adm_abspath;
- const char *tmp_text_base_abspath;
svn_revnum_t new_changed_rev = new_revnum;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -211,12 +210,8 @@ process_committed_leaf(svn_wc__db_t *db,
### value, like how we handle files. */
}
- /* Set TMP_TEXT_BASE_ABSPATH to NULL. The new text base will be found in
- the pristine store by its checksum. */
- /* ### TODO: Remove this parameter. */
- tmp_text_base_abspath = NULL;
-
- SVN_ERR(svn_wc__wq_add_postcommit(db, local_abspath, tmp_text_base_abspath,
+ /* The new text base will be found in the pristine store by its checksum. */
+ SVN_ERR(svn_wc__wq_add_postcommit(db, local_abspath,
new_revnum,
new_changed_rev, new_changed_date,
new_changed_author, checksum,
@@ -1042,8 +1037,7 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
/* If we're performing a repos-to-WC copy, check that the copyfrom
repository is the same as the parent dir's repository. */
- if (copyfrom_url
- && !svn_uri_is_ancestor(repos_root_url, copyfrom_url))
+ if (copyfrom_url && !svn_uri_is_ancestor(repos_root_url, copyfrom_url))
return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
_("The URL '%s' has a different repository "
"root than its parent"), copyfrom_url);
@@ -1120,19 +1114,23 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
scratch_pool));
}
else
- SVN_ERR(svn_wc__db_op_copy_dir(db, local_abspath,
- apr_hash_make(scratch_pool),
- copyfrom_rev, 0, NULL,
- svn_path_uri_decode(
- svn_uri_skip_ancestor(repos_root_url,
- copyfrom_url),
- scratch_pool),
- repos_root_url, repos_uuid,
- copyfrom_rev,
- NULL /* children */, depth,
- NULL /* conflicts */,
- NULL /* work items */,
- scratch_pool));
+ {
+ const char *repos_relpath =
+ svn_path_uri_decode(svn_uri_skip_ancestor(repos_root_url,
+ copyfrom_url),
+ scratch_pool);
+
+ SVN_ERR(svn_wc__db_op_copy_dir(db, local_abspath,
+ apr_hash_make(scratch_pool),
+ copyfrom_rev, 0, NULL,
+ repos_relpath,
+ repos_root_url, repos_uuid,
+ copyfrom_rev,
+ NULL /* children */, depth,
+ NULL /* conflicts */,
+ NULL /* work items */,
+ scratch_pool));
+ }
}
else /* Case 1: Integrating a separate WC into this one, in place */
{
@@ -2146,7 +2144,8 @@ svn_wc__set_file_external_location(svn_w
if (url)
{
- external_repos_relpath = svn_uri_is_child(repos_root_url, url, NULL);
+ external_repos_relpath = svn_uri_is_child(repos_root_url, url,
+ scratch_pool);
if (external_repos_relpath == NULL)
return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
@@ -2154,9 +2153,6 @@ svn_wc__set_file_external_location(svn_w
" is not a file in repository '%s'."),
url, repos_root_url);
- external_repos_relpath = svn_path_uri_decode(external_repos_relpath,
- scratch_pool);
-
SVN_ERR_ASSERT(peg_rev != NULL);
SVN_ERR_ASSERT(rev != NULL);
}
Modified: subversion/branches/performance/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/entries.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/entries.c Wed Feb 2 13:04:51 2011
@@ -1735,19 +1735,16 @@ write_entry(struct write_baton **entry_n
{
if (entry->copyfrom_url)
{
- const char *relative_url;
+ const char *relpath;
working_node->copyfrom_repos_id = repos_id;
- relative_url = svn_uri_is_child(this_dir->repos, entry->copyfrom_url,
- NULL);
- if (relative_url == NULL)
+ relpath = svn_uri_is_child(this_dir->repos,
+ entry->copyfrom_url,
+ result_pool);
+ if (relpath == NULL)
working_node->copyfrom_repos_path = "";
else
- {
- /* copyfrom_repos_path is NOT a URI. decode into repos path. */
- working_node->copyfrom_repos_path =
- svn_path_uri_decode(relative_url, result_pool);
- }
+ working_node->copyfrom_repos_path = relpath;
working_node->copyfrom_revnum = entry->copyfrom_rev;
working_node->op_depth
= svn_wc__db_op_depth_for_upgrade(local_relpath);
@@ -1894,31 +1891,23 @@ write_entry(struct write_baton **entry_n
{
base_node->repos_id = repos_id;
- /* repos_relpath is NOT a URI. decode as appropriate. */
if (entry->url != NULL)
{
- const char *relative_url = svn_uri_is_child(this_dir->repos,
- entry->url,
- scratch_pool);
-
- if (relative_url == NULL)
- base_node->repos_relpath = "";
- else
- base_node->repos_relpath = svn_path_uri_decode(relative_url,
- result_pool);
+ const char *relpath = svn_uri_is_child(this_dir->repos,
+ entry->url,
+ result_pool);
+ base_node->repos_relpath = relpath ? relpath : "";
}
else
{
- const char *base_path = svn_uri_is_child(this_dir->repos,
- this_dir->url,
- scratch_pool);
- if (base_path == NULL)
+ const char *relpath = svn_uri_is_child(this_dir->repos,
+ this_dir->url,
+ scratch_pool);
+ if (relpath == NULL)
base_node->repos_relpath = entry->name;
else
base_node->repos_relpath =
- svn_dirent_join(svn_path_uri_decode(base_path, scratch_pool),
- entry->name,
- result_pool);
+ svn_dirent_join(relpath, entry->name, result_pool);
}
}
Modified: subversion/branches/performance/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/props.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/props.c Wed Feb 2 13:04:51 2011
@@ -2647,7 +2647,16 @@ svn_wc_parse_externals_description3(apr_
item->target_dir);
if (canonicalize_url)
- item->url = svn_uri_canonicalize(item->url, pool);
+ {
+ /* Uh... this is stupid. But it's consistent with what our
+ code did before we split up the relpath/dirent/uri APIs.
+ Still, given this, it's no wonder that our own libraries
+ don't ask this function to canonicalize the results. */
+ if (svn_path_is_url(item->url))
+ item->url = svn_uri_canonicalize(item->url, pool);
+ else
+ item->url = svn_dirent_canonicalize(item->url, pool);
+ }
if (externals_p)
APR_ARRAY_PUSH(*externals_p, svn_wc_external_item2_t *) = item;
Modified: subversion/branches/performance/subversion/libsvn_wc/relocate.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/relocate.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/relocate.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/relocate.c Wed Feb 2 13:04:51 2011
@@ -35,31 +35,36 @@
#include "svn_private_config.h"
-/* */
+/* If the components of RELPATH exactly match (after being
+ URI-encoded) the final components of URL, return a copy of URL
+ minus those components allocated in RESULT_POOL; otherwise, return
+ NULL. */
static const char *
-uri_remove_components(const char *uri,
- const char *component,
- apr_pool_t *result_pool)
+url_remove_final_relpath(const char *url,
+ const char *relpath,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool)
{
- char *result = apr_pstrdup(result_pool, uri);
+ char *result = apr_pstrdup(result_pool, url);
char *result_end;
- const char *component_end;
+ const char *relpath_end;
- SVN_ERR_ASSERT_NO_RETURN(svn_uri_is_absolute(uri));
- SVN_ERR_ASSERT_NO_RETURN(!svn_uri_is_absolute(component));
+ SVN_ERR_ASSERT_NO_RETURN(svn_path_is_url(url));
+ SVN_ERR_ASSERT_NO_RETURN(svn_relpath_is_canonical(relpath, scratch_pool));
- if (component[0] == 0)
+ if (relpath[0] == 0)
return result;
+ relpath = svn_path_uri_encode(relpath, scratch_pool);
result_end = result + strlen(result) - 1;
- component_end = component + strlen(component) - 1;
+ relpath_end = relpath + strlen(relpath) - 1;
- while (component_end >= component)
+ while (relpath_end >= relpath)
{
- if (*result_end != *component_end)
+ if (*result_end != *relpath_end)
return NULL;
- component_end--;
+ relpath_end--;
result_end--;
}
@@ -128,7 +133,8 @@ svn_wc_relocate4(svn_wc_context_t *wc_ct
return svn_error_create(SVN_ERR_CLIENT_INVALID_RELOCATION, NULL,
_("Cannot relocate a single file"));
- old_url = svn_uri_join(old_repos_root, repos_relpath, scratch_pool);
+ old_url = svn_path_url_add_component2(old_repos_root, repos_relpath,
+ scratch_pool);
old_url_len = strlen(old_url);
from_len = strlen(from);
if ((from_len > old_url_len) || (strncmp(old_url, from, strlen(from)) != 0))
@@ -143,14 +149,18 @@ svn_wc_relocate4(svn_wc_context_t *wc_ct
new_url = apr_pstrcat(scratch_pool, to, old_url + from_len, NULL);
if (! svn_path_is_url(new_url))
return svn_error_createf(SVN_ERR_WC_INVALID_RELOCATION, NULL,
- _("Invalid destination URL: '%s'"), new_url);
+ _("Invalid relocation destination: '%s' "
+ "(not a URL)"), new_url);
- new_repos_root = uri_remove_components(new_url, repos_relpath, scratch_pool);
+ new_repos_root = url_remove_final_relpath(new_url, repos_relpath,
+ scratch_pool, scratch_pool);
if (!new_repos_root)
return svn_error_createf(SVN_ERR_WC_INVALID_RELOCATION, NULL,
- _("Invalid destination URL: '%s'"), new_url);
+ _("Invalid relocation destination: '%s' "
+ "(does not point to target)" ), new_url);
- SVN_ERR(validator(validator_baton, uuid, new_url, new_repos_root, scratch_pool));
+ SVN_ERR(validator(validator_baton, uuid, new_url, new_repos_root,
+ scratch_pool));
return svn_error_return(svn_wc__db_global_relocate(wc_ctx->db, local_abspath,
new_repos_root,
Modified: subversion/branches/performance/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/status.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/status.c Wed Feb 2 13:04:51 2011
@@ -51,6 +51,7 @@
#include "tree_conflicts.h"
#include "private/svn_wc_private.h"
+#include "private/svn_fspath.h"
Modified: subversion/branches/performance/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/update_editor.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/update_editor.c Wed Feb 2 13:04:51 2011
@@ -1314,11 +1314,12 @@ modcheck_found_node(const char *local_ab
if (status != svn_wc__db_status_normal)
modified = TRUE;
- /* No need to check if we already have at least one non-delete
- modification */
- else if (!baton->found_mod || baton->all_edits_are_deletes)
+ /* No need to check if we already have at least one modification */
+ else if (!baton->found_mod)
SVN_ERR(entry_has_local_mods(&modified, baton->db, local_abspath,
db_kind, scratch_pool));
+ else
+ modified = FALSE;
if (modified)
{
@@ -2240,15 +2241,14 @@ add_directory(const char *path,
svn_boolean_t local_is_dir;
svn_boolean_t local_is_non_dir;
- const char *local_is_copy = NULL;
+ svn_wc__db_status_t add_status = svn_wc__db_status_normal;
/* Is the local add a copy? */
if (status == svn_wc__db_status_added)
- SVN_ERR(svn_wc__node_get_copyfrom_info(&local_is_copy,
- NULL, NULL, NULL, NULL,
- eb->wc_ctx,
- db->local_abspath,
- pool, pool));
+ SVN_ERR(svn_wc__db_scan_addition(&add_status, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ eb->db, db->local_abspath,
+ pool, pool));
/* Is there something that is a file? */
@@ -2337,7 +2337,8 @@ add_directory(const char *path,
if (! pb->in_deleted_and_tree_conflicted_subtree
&& (eb->switch_relpath != NULL
|| local_is_non_dir
- || local_is_copy
+ || add_status == svn_wc__db_status_copied
+ || add_status == svn_wc__db_status_moved_here
)
)
{
@@ -4879,11 +4880,9 @@ make_editor(svn_revnum_t *target_revisio
/* Disallow a switch operation to change the repository root of the target,
if that is known. */
if (switch_url && !svn_uri_is_ancestor(repos_root, switch_url))
- return svn_error_createf(
- SVN_ERR_WC_INVALID_SWITCH, NULL,
- _("'%s'\n"
- "is not the same repository as\n"
- "'%s'"), switch_url, repos_root);
+ return svn_error_createf(SVN_ERR_WC_INVALID_SWITCH, NULL,
+ _("'%s'\nis not the same repository as\n'%s'"),
+ switch_url, repos_root);
/* Construct an edit baton. */
eb = apr_pcalloc(edit_pool, sizeof(*eb));
@@ -4898,12 +4897,11 @@ make_editor(svn_revnum_t *target_revisio
eb->anchor_abspath = anchor_abspath;
if (switch_url)
- eb->switch_relpath = svn_path_uri_decode(
- svn_uri_skip_ancestor(repos_root,
- switch_url),
- scratch_pool);
+ eb->switch_relpath =
+ svn_path_uri_decode(svn_uri_skip_ancestor(repos_root, switch_url),
+ scratch_pool);
else
- eb->switch_relpath = NULL;
+ eb->switch_relpath = NULL;
if (svn_path_is_empty(target_basename))
eb->target_abspath = eb->anchor_abspath;
@@ -5472,8 +5470,6 @@ svn_wc_add_repos_file4(svn_wc_context_t
copyfrom URL to be in the same repository. */
if (copyfrom_url != NULL)
{
- const char *relative_url;
-
/* Find the repository_root via the parent directory, which
is always versioned before this function is called */
SVN_ERR(svn_wc__node_get_repos_info(&original_root_url,
@@ -5490,8 +5486,9 @@ svn_wc_add_repos_file4(svn_wc_context_t
" root than '%s'"),
copyfrom_url, original_root_url);
- relative_url = svn_uri_skip_ancestor(original_root_url, copyfrom_url);
- original_repos_relpath = svn_path_uri_decode(relative_url, pool);
+ original_repos_relpath =
+ svn_path_uri_decode(svn_uri_skip_ancestor(original_root_url,
+ copyfrom_url), pool);
}
else
{
Modified: subversion/branches/performance/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/upgrade.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/upgrade.c Wed Feb 2 13:04:51 2011
@@ -581,8 +581,8 @@ ensure_repos_info(svn_wc_entry_t *entry,
for (hi = apr_hash_first(scratch_pool, repos_cache);
hi; hi = apr_hash_next(hi))
{
- if (svn_uri_is_child(svn__apr_hash_index_key(hi),
- entry->url, NULL))
+ if (svn_uri_is_child(svn__apr_hash_index_key(hi), entry->url,
+ scratch_pool))
{
if (!entry->repos)
entry->repos = svn__apr_hash_index_key(hi);
@@ -942,8 +942,8 @@ migrate_props(const char *dir_abspath,
static char *
remove_suffix(const char *str, const char *suffix, apr_pool_t *result_pool)
{
- int str_len = strlen(str);
- int suffix_len = strlen(suffix);
+ size_t str_len = strlen(str);
+ size_t suffix_len = strlen(suffix);
if (str_len > suffix_len
&& strcmp(str + str_len - suffix_len, suffix) == 0)
@@ -1129,6 +1129,14 @@ bump_to_23(void *baton, svn_sqlite__db_t
return SVN_NO_ERROR;
}
+static svn_error_t *
+bump_to_24(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
+{
+ SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_24));
+ SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_CREATE_NODES_TRIGGERS));
+ return SVN_NO_ERROR;
+}
+
struct upgrade_data_t {
svn_sqlite__db_t *sdb;
@@ -1390,6 +1398,12 @@ svn_wc__upgrade_sdb(int *result_format,
*result_format = 23;
/* FALLTHROUGH */
+ case 23:
+ SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_24, &bb,
+ scratch_pool));
+ *result_format = 24;
+ /* FALLTHROUGH */
+
/* ### future bumps go here. */
#if 0
case XXX-1:
Modified: subversion/branches/performance/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/util.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/util.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/util.c Wed Feb 2 13:04:51 2011
@@ -346,7 +346,7 @@ svn_wc__conflict_description2_dup(const
svn_wc_conflict_version_t *
svn_wc_conflict_version_create(const char *repos_url,
- const char* path_in_repos,
+ const char *path_in_repos,
svn_revnum_t peg_rev,
svn_node_kind_t node_kind,
apr_pool_t *pool)
Modified: subversion/branches/performance/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/wc-metadata.sql?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc-metadata.sql Wed Feb 2 13:04:51 2011
@@ -76,9 +76,12 @@ CREATE UNIQUE INDEX I_LOCAL_ABSPATH ON W
/* ------------------------------------------------------------------------- */
-/* The PRISTINE table keeps track of pristine texts. Each pristine text is
- stored in a file which may be compressed. Each pristine text is
- referenced by any number of rows in the NODES and ACTUAL_NODE tables.
+/* The PRISTINE table keeps track of pristine texts. Each row describes a
+ single pristine text. The text itself is stored in a file whose name is
+ derived from the 'checksum' column. Each pristine text is referenced by
+ any number of rows in the NODES and ACTUAL_NODE tables.
+
+ In future, the pristine text file may be compressed.
*/
CREATE TABLE PRISTINE (
/* The SHA-1 checksum of the pristine text. This is a unique key. The
@@ -95,8 +98,9 @@ CREATE TABLE PRISTINE (
Used to verify the pristine file is "proper". */
size INTEGER NOT NULL,
- /* ### this will probably go away, in favor of counting references
- ### that exist in NODES. Not yet used; always set to 1. */
+ /* The number of rows in the NODES table that have a 'checksum' column
+ value that refers to this row. (References in other places, such as
+ in the ACTUAL_NODE table, are not counted.) */
refcount INTEGER NOT NULL,
/* Alternative MD5 checksum used for communicating with older
@@ -480,6 +484,35 @@ CREATE TABLE NODES (
CREATE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath, op_depth);
+-- STMT_CREATE_NODES_TRIGGERS
+
+CREATE TRIGGER nodes_insert_trigger
+AFTER INSERT ON nodes
+/* WHEN NEW.checksum IS NOT NULL */
+BEGIN
+ UPDATE pristine SET refcount = refcount + 1
+ WHERE checksum = NEW.checksum;
+END;
+
+CREATE TRIGGER nodes_delete_trigger
+AFTER DELETE ON nodes
+/* WHEN OLD.checksum IS NOT NULL */
+BEGIN
+ UPDATE pristine SET refcount = refcount - 1
+ WHERE checksum = OLD.checksum;
+END;
+
+CREATE TRIGGER nodes_update_checksum_trigger
+AFTER UPDATE OF checksum ON nodes
+/* WHEN NEW.checksum IS NOT NULL OR OLD.checksum IS NOT NULL */
+BEGIN
+ UPDATE pristine SET refcount = refcount + 1
+ WHERE checksum = NEW.checksum;
+ UPDATE pristine SET refcount = refcount - 1
+ WHERE checksum = OLD.checksum;
+END;
+
+
/* Format 20 introduces NODES and removes BASE_NODE and WORKING_NODE */
@@ -552,6 +585,19 @@ PRAGMA user_version = 23;
/* ------------------------------------------------------------------------- */
+/* Format 24 involves no schema changes; it starts using the pristine
+ table's refcount column correctly. */
+
+-- STMT_UPGRADE_TO_24
+UPDATE pristine SET refcount =
+ (SELECT COUNT(*) FROM nodes
+ WHERE checksum = pristine.checksum /*OR checksum = pristine.md5_checksum*/);
+
+PRAGMA user_version = 24;
+
+
+/* ------------------------------------------------------------------------- */
+
/* Format YYY introduces new handling for conflict information. */
-- format: YYY
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=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc-queries.sql Wed Feb 2 13:04:51 2011
@@ -411,7 +411,7 @@ DELETE FROM work_queue WHERE id = ?1;
-- STMT_INSERT_PRISTINE
INSERT OR IGNORE INTO pristine (checksum, md5_checksum, size, refcount)
-VALUES (?1, ?2, ?3, 1);
+VALUES (?1, ?2, ?3, 0);
-- STMT_SELECT_PRISTINE_MD5_CHECKSUM
SELECT md5_checksum
@@ -423,35 +423,14 @@ SELECT checksum
FROM pristine
WHERE md5_checksum = ?1
--- STMT_SELECT_ANY_PRISTINE_REFERENCE
-SELECT 1 FROM nodes
- WHERE checksum = ?1 OR checksum = ?2
-UNION ALL
-SELECT 1 FROM actual_node
- WHERE older_checksum = ?1 OR older_checksum = ?2
- OR left_checksum = ?1 OR left_checksum = ?2
- OR right_checksum = ?1 OR right_checksum = ?2
-LIMIT 1
-
-- STMT_SELECT_UNREFERENCED_PRISTINES
SELECT checksum
FROM pristine
-EXCEPT
-SELECT checksum FROM nodes
- WHERE checksum IS NOT NULL
-EXCEPT
-SELECT older_checksum FROM actual_node
- WHERE older_checksum IS NOT NULL
-EXCEPT
-SELECT left_checksum FROM actual_node
- WHERE left_checksum IS NOT NULL
-EXCEPT
-SELECT right_checksum FROM actual_node
- WHERE right_checksum IS NOT NULL
+WHERE refcount = 0
--- STMT_DELETE_PRISTINE
+-- STMT_DELETE_PRISTINE_IF_UNREFERENCED
DELETE FROM pristine
-WHERE checksum = ?1
+WHERE checksum = ?1 AND refcount = 0
-- STMT_SELECT_ACTUAL_CONFLICT_VICTIMS
SELECT local_relpath
Modified: subversion/branches/performance/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/wc.h?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc.h Wed Feb 2 13:04:51 2011
@@ -133,12 +133,15 @@ extern "C" {
* The change from 22 to 23 introduced multi-layer op_depth processing for
* NODES.
*
+ * The change from 23 to 24 started using the 'refcount' column of the
+ * 'pristine' table correctly, instead of always setting it to '1'.
+ *
* == 1.7.x shipped with format ???
*
* Please document any further format changes here.
*/
-#define SVN_WC__VERSION 23
+#define SVN_WC__VERSION 24
/* Formats <= this have no concept of "revert text-base/props". */
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=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc_db.c Wed Feb 2 13:04:51 2011
@@ -61,8 +61,6 @@
#define SDB_FILE "wc.db"
#define SDB_FILE_UPGRADE "wc.db.upgrade"
-#define PRISTINE_STORAGE_RELPATH "pristine"
-#define PRISTINE_TEMPDIR_RELPATH ""
#define WCROOT_TEMPDIR_RELPATH "tmp"
@@ -421,77 +419,6 @@ static const char *construct_like_arg(co
-/* Returns in PRISTINE_ABSPATH a new string allocated from RESULT_POOL,
- holding the local absolute path to the file location that is dedicated
- to hold CHECKSUM's pristine file, relating to the pristine store
- configured for the working copy indicated by PDH. The returned path
- does not necessarily currently exist.
-
- Iff CREATE_SUBDIR is TRUE, then this function will make sure that the
- parent directory of PRISTINE_ABSPATH exists. This is only useful when
- about to create a new pristine.
-
- Any other allocations are made in SCRATCH_POOL. */
-static svn_error_t *
-get_pristine_fname(const char **pristine_abspath,
- const char *wcroot_abspath,
- const svn_checksum_t *sha1_checksum,
- svn_boolean_t create_subdir,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- const char *base_dir_abspath;
- const char *hexdigest = svn_checksum_to_cstring(sha1_checksum, scratch_pool);
- char subdir[3];
-
- /* ### code is in transition. make sure we have the proper data. */
- SVN_ERR_ASSERT(pristine_abspath != NULL);
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wcroot_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);
-
- /* ### need to fix this to use a symbol for ".svn". we don't need
- ### to use join_many since we know "/" is the separator for
- ### internal canonical paths */
- base_dir_abspath = svn_dirent_join_many(scratch_pool,
- wcroot_abspath,
- svn_wc_get_adm_dir(scratch_pool),
- PRISTINE_STORAGE_RELPATH,
- NULL);
-
- /* We should have a valid checksum and (thus) a valid digest. */
- SVN_ERR_ASSERT(hexdigest != NULL);
-
- /* Get the first two characters of the digest, for the subdir. */
- subdir[0] = hexdigest[0];
- subdir[1] = hexdigest[1];
- subdir[2] = '\0';
-
- if (create_subdir)
- {
- const char *subdir_abspath = svn_dirent_join(base_dir_abspath, subdir,
- scratch_pool);
- svn_error_t *err;
-
- err = svn_io_dir_make(subdir_abspath, APR_OS_DEFAULT, scratch_pool);
-
- /* Whatever error may have occurred... ignore it. Typically, this
- will be "directory already exists", but if it is something
- *different*, then presumably another error will follow when we
- try to access the file within this (missing?) pristine subdir. */
- svn_error_clear(err);
- }
-
- /* The file is located at DIR/.svn/pristine/XX/XXYYZZ... */
- *pristine_abspath = svn_dirent_join_many(result_pool,
- base_dir_abspath,
- subdir,
- hexdigest,
- NULL);
- return SVN_NO_ERROR;
-}
-
-
/* Look up REPOS_ID in SDB and set *REPOS_ROOT_URL and/or *REPOS_UUID to
* its root URL and UUID respectively. If REPOS_ID is INVALID_REPOS_ID,
* use NULL for both URL and UUID. Either or both output parameters may be
@@ -856,11 +783,12 @@ insert_base_node(void *baton, svn_sqlite
(pibb->kind == svn_wc__db_kind_symlink) ?
pibb->target : NULL)); /* 19 */
- if (pibb->kind == svn_wc__db_kind_file) {
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, pibb->checksum, scratch_pool));
- if (pibb->translated_size != SVN_INVALID_FILESIZE)
- SVN_ERR(svn_sqlite__bind_int64(stmt, 16, pibb->translated_size));
- }
+ if (pibb->kind == svn_wc__db_kind_file)
+ {
+ SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, pibb->checksum, scratch_pool));
+ if (pibb->translated_size != SVN_INVALID_FILESIZE)
+ SVN_ERR(svn_sqlite__bind_int64(stmt, 16, pibb->translated_size));
+ }
SVN_ERR(svn_sqlite__bind_properties(stmt, 15, pibb->props,
scratch_pool));
@@ -1272,9 +1200,8 @@ create_db(svn_sqlite__db_t **sdb,
/* Create the database's schema. */
SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_SCHEMA));
-
- /* Create the NODES table for the experimental schema */
SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_NODES));
+ SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_NODES_TRIGGERS));
/* Insert the repository. */
SVN_ERR(create_repos_id(repos_id, repos_root_url, repos_uuid, *sdb,
@@ -1506,7 +1433,7 @@ svn_wc__db_base_add_directory(svn_wc__db
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(repos_relpath != NULL);
- SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
+ SVN_ERR_ASSERT(svn_uri_is_canonical(repos_root_url, scratch_pool));
SVN_ERR_ASSERT(repos_uuid != NULL);
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
SVN_ERR_ASSERT(props != NULL);
@@ -1584,7 +1511,7 @@ svn_wc__db_base_add_file(svn_wc__db_t *d
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(repos_relpath != NULL);
- SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
+ SVN_ERR_ASSERT(svn_uri_is_canonical(repos_root_url, scratch_pool));
SVN_ERR_ASSERT(repos_uuid != NULL);
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
SVN_ERR_ASSERT(props != NULL);
@@ -1658,7 +1585,7 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(repos_relpath != NULL);
- SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
+ SVN_ERR_ASSERT(svn_uri_is_canonical(repos_root_url, scratch_pool));
SVN_ERR_ASSERT(repos_uuid != NULL);
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
SVN_ERR_ASSERT(props != NULL);
@@ -1727,7 +1654,7 @@ add_absent_excluded_not_present_node(svn
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(repos_relpath != NULL);
- SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
+ SVN_ERR_ASSERT(svn_uri_is_canonical(repos_root_url, scratch_pool));
SVN_ERR_ASSERT(repos_uuid != NULL);
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
SVN_ERR_ASSERT(status == svn_wc__db_status_absent
@@ -2217,478 +2144,6 @@ svn_wc__db_base_clear_dav_cache_recursiv
return SVN_NO_ERROR;
}
-svn_error_t *
-svn_wc__db_pristine_get_path(const char **pristine_abspath,
- svn_wc__db_t *db,
- const char *wri_abspath,
- const svn_checksum_t *sha1_checksum,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
- svn_boolean_t present;
-
- SVN_ERR_ASSERT(pristine_abspath != NULL);
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- /* ### Transitional: accept MD-5 and look up the SHA-1. Return an error
- * if the pristine text is not in the store. */
- if (sha1_checksum->kind != svn_checksum_sha1)
- SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db, wri_abspath,
- sha1_checksum,
- scratch_pool, scratch_pool));
- SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath,
- db, wri_abspath,
- svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- SVN_ERR(svn_wc__db_pristine_check(&present, db, wri_abspath, sha1_checksum,
- scratch_pool));
- if (! present)
- return svn_error_createf(SVN_ERR_WC_DB_ERROR, NULL,
- _("Pristine text not found"));
-
- SVN_ERR(get_pristine_fname(pristine_abspath, pdh->wcroot->abspath,
- sha1_checksum,
- FALSE /* create_subdir */,
- result_pool, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_wc__db_pristine_get_future_path(const char **pristine_abspath,
- const char *wcroot_abspath,
- svn_checksum_t *sha1_checksum,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- SVN_ERR(get_pristine_fname(pristine_abspath, wcroot_abspath,
- sha1_checksum,
- FALSE /* create_subdir */,
- result_pool, scratch_pool));
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_wc__db_pristine_read(svn_stream_t **contents,
- svn_wc__db_t *db,
- const char *wri_abspath,
- const svn_checksum_t *sha1_checksum,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
- const char *pristine_abspath;
-
- SVN_ERR_ASSERT(contents != NULL);
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- /* ### Transitional: accept MD-5 and look up the SHA-1. Return an error
- * if the pristine text is not in the store. */
- if (sha1_checksum->kind != svn_checksum_sha1)
- SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db, wri_abspath,
- sha1_checksum,
- scratch_pool, scratch_pool));
- SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- wri_abspath, svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- /* ### should we look in the PRISTINE table for anything? */
-
- SVN_ERR(get_pristine_fname(&pristine_abspath, pdh->wcroot->abspath,
- sha1_checksum,
- FALSE /* create_subdir */,
- scratch_pool, scratch_pool));
- return svn_error_return(svn_stream_open_readonly(
- contents, pristine_abspath,
- result_pool, scratch_pool));
-}
-
-
-svn_error_t *
-svn_wc__db_pristine_get_tempdir(const char **temp_dir_abspath,
- svn_wc__db_t *db,
- const char *wri_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
-
- SVN_ERR_ASSERT(temp_dir_abspath != NULL);
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- wri_abspath, svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- *temp_dir_abspath = svn_dirent_join_many(result_pool,
- pdh->wcroot->abspath,
- svn_wc_get_adm_dir(scratch_pool),
- PRISTINE_TEMPDIR_RELPATH,
- NULL);
- return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_wc__db_pristine_install(svn_wc__db_t *db,
- const char *tempfile_abspath,
- const svn_checksum_t *sha1_checksum,
- const svn_checksum_t *md5_checksum,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
- const char *wri_abspath;
- const char *pristine_abspath;
- apr_finfo_t finfo;
- svn_sqlite__stmt_t *stmt;
- svn_node_kind_t kind;
-
- SVN_ERR_ASSERT(svn_dirent_is_absolute(tempfile_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);
- SVN_ERR_ASSERT(md5_checksum != NULL);
- SVN_ERR_ASSERT(md5_checksum->kind == svn_checksum_md5);
-
- /* ### this logic assumes that TEMPFILE_ABSPATH follows this pattern:
- ### WCROOT_ABSPATH/COMPONENT/TEMPFNAME
- ### if we change this (see PRISTINE_TEMPDIR_RELPATH), then this
- ### logic should change. */
- wri_abspath = svn_dirent_dirname(svn_dirent_dirname(tempfile_abspath,
- scratch_pool),
- scratch_pool);
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- wri_abspath, svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- SVN_ERR(get_pristine_fname(&pristine_abspath, pdh->wcroot->abspath,
- sha1_checksum,
- TRUE /* create_subdir */,
- scratch_pool, scratch_pool));
-
-
- SVN_ERR(svn_io_check_path(pristine_abspath, &kind, scratch_pool));
-
- if (kind == svn_node_file)
- {
- /* Remove the tempfile, it's already there */
- return svn_error_return(
- svn_io_remove_file2(tempfile_abspath,
- FALSE, scratch_pool));
- }
-
- /* Put the file into its target location. */
- SVN_ERR(svn_io_file_rename(tempfile_abspath, pristine_abspath,
- scratch_pool));
-
- SVN_ERR(svn_io_stat(&finfo, pristine_abspath, APR_FINFO_SIZE,
- scratch_pool));
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_INSERT_PRISTINE));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 2, md5_checksum, scratch_pool));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 3, finfo.size));
- SVN_ERR(svn_sqlite__insert(NULL, stmt));
-
- return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_wc__db_pristine_get_md5(const svn_checksum_t **md5_checksum,
- svn_wc__db_t *db,
- const char *wri_abspath,
- const svn_checksum_t *sha1_checksum,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
- svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
-
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- wri_abspath, svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_SELECT_PRISTINE_MD5_CHECKSUM));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- if (!have_row)
- return svn_error_createf(SVN_ERR_WC_DB_ERROR, svn_sqlite__reset(stmt),
- _("The pristine text with checksum '%s' was "
- "not found"),
- svn_checksum_to_cstring_display(sha1_checksum,
- scratch_pool));
-
- SVN_ERR(svn_sqlite__column_checksum(md5_checksum, stmt, 0, result_pool));
- SVN_ERR_ASSERT((*md5_checksum)->kind == svn_checksum_md5);
-
- return svn_error_return(svn_sqlite__reset(stmt));
-}
-
-
-svn_error_t *
-svn_wc__db_pristine_get_sha1(const svn_checksum_t **sha1_checksum,
- svn_wc__db_t *db,
- const char *wri_abspath,
- const svn_checksum_t *md5_checksum,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
- svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
-
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- SVN_ERR_ASSERT(md5_checksum->kind == svn_checksum_md5);
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- wri_abspath, svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_SELECT_PRISTINE_SHA1_CHECKSUM));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, md5_checksum, scratch_pool));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- if (!have_row)
- return svn_error_createf(SVN_ERR_WC_DB_ERROR, svn_sqlite__reset(stmt),
- _("The pristine text with MD5 checksum '%s' was "
- "not found"),
- svn_checksum_to_cstring_display(md5_checksum,
- scratch_pool));
-
- SVN_ERR(svn_sqlite__column_checksum(sha1_checksum, stmt, 0, result_pool));
- SVN_ERR_ASSERT((*sha1_checksum)->kind == svn_checksum_sha1);
-
- return svn_error_return(svn_sqlite__reset(stmt));
-}
-
-
-/* Delete the pristine text referenced by SHA1_CHECKSUM from the pristine
- * store of WCROOT. Delete both the database row and the file on disk. */
-static svn_error_t *
-pristine_remove(svn_wc__db_wcroot_t *wcroot,
- const svn_checksum_t *sha1_checksum,
- apr_pool_t *scratch_pool)
-{
- svn_sqlite__stmt_t *stmt;
- const char *pristine_abspath;
-
- /* Remove the DB row. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_DELETE_PRISTINE));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
- SVN_ERR(svn_sqlite__update(NULL, stmt));
-
- /* Remove the file */
- SVN_ERR(get_pristine_fname(&pristine_abspath, wcroot->abspath,
- sha1_checksum, TRUE /* create_subdir */,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_io_remove_file2(pristine_abspath, TRUE /* ignore_enoent */,
- scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_wc__db_pristine_remove(svn_wc__db_t *db,
- const char *wri_abspath,
- const svn_checksum_t *sha1_checksum,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
- svn_boolean_t is_referenced;
-
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- /* ### Transitional: accept MD-5 and look up the SHA-1. Return an error
- * if the pristine text is not in the store. */
- if (sha1_checksum->kind != svn_checksum_sha1)
- SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db, wri_abspath,
- sha1_checksum,
- scratch_pool, scratch_pool));
- SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- wri_abspath, svn_sqlite__mode_readwrite,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- /* If the work queue is not empty, don't delete any pristine text because
- * the work queue may contain a reference to it. */
- {
- svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_LOOK_FOR_WORK));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- SVN_ERR(svn_sqlite__reset(stmt));
-
- if (have_row)
- return SVN_NO_ERROR;
- }
-
- /* Find whether the SHA-1 (or the MD-5) is referenced; set IS_REFERENCED. */
- {
- const svn_checksum_t *md5_checksum;
- svn_sqlite__stmt_t *stmt;
-
- /* ### Transitional: look for references to its MD-5 as well. */
- SVN_ERR(svn_wc__db_pristine_get_md5(&md5_checksum, db, wri_abspath,
- sha1_checksum, scratch_pool,
- scratch_pool));
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_SELECT_ANY_PRISTINE_REFERENCE));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 2, md5_checksum, scratch_pool));
- SVN_ERR(svn_sqlite__step(&is_referenced, stmt));
-
- SVN_ERR(svn_sqlite__reset(stmt));
- }
-
- /* If not referenced, remove the PRISTINE table row and the file. */
- if (! is_referenced)
- {
- SVN_ERR(pristine_remove(pdh->wcroot, sha1_checksum, scratch_pool));
- }
-
- return SVN_NO_ERROR;
-}
-
-
-static svn_error_t *
-pristine_cleanup_wcroot(svn_wc__db_wcroot_t *wcroot,
- apr_pool_t *scratch_pool)
-{
- svn_sqlite__stmt_t *stmt;
-
- /* Find each unreferenced pristine in the DB and remove it. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_UNREFERENCED_PRISTINES));
- while (1)
- {
- svn_boolean_t have_row;
- const svn_checksum_t *sha1_checksum;
-
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- if (! have_row)
- break;
-
- SVN_ERR(svn_sqlite__column_checksum(&sha1_checksum, stmt, 0,
- scratch_pool));
- SVN_ERR(pristine_remove(wcroot, sha1_checksum, scratch_pool));
- }
- SVN_ERR(svn_sqlite__reset(stmt));
-
- return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_wc__db_pristine_cleanup(svn_wc__db_t *db,
- const char *wri_abspath,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
-
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- wri_abspath, svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- SVN_ERR(pristine_cleanup_wcroot(pdh->wcroot, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-
-svn_error_t *
-svn_wc__db_pristine_check(svn_boolean_t *present,
- svn_wc__db_t *db,
- const char *wri_abspath,
- const svn_checksum_t *sha1_checksum,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
- const char *pristine_abspath;
- svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
- svn_node_kind_t kind_on_disk;
-
- SVN_ERR_ASSERT(present != NULL);
- SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
- SVN_ERR_ASSERT(sha1_checksum != NULL);
- /* ### Transitional: accept MD-5 and look up the SHA-1. Return an error
- * if the pristine text is not in the store. */
- if (sha1_checksum->kind != svn_checksum_sha1)
- SVN_ERR(svn_wc__db_pristine_get_sha1(&sha1_checksum, db, wri_abspath,
- sha1_checksum,
- scratch_pool, scratch_pool));
- SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);
-
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- wri_abspath, svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- /* Check that there is an entry in the PRISTINE table. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_SELECT_PRISTINE_MD5_CHECKSUM));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- SVN_ERR(svn_sqlite__reset(stmt));
-
- /* Check that the pristine text file exists. */
- SVN_ERR(get_pristine_fname(&pristine_abspath, pdh->wcroot->abspath,
- sha1_checksum,
- FALSE /* create_subdir */,
- scratch_pool, scratch_pool));
- SVN_ERR(svn_io_check_path(pristine_abspath, &kind_on_disk, scratch_pool));
-
- if (kind_on_disk != (have_row ? svn_node_file : svn_node_none))
- return svn_error_createf(SVN_ERR_WC_DB_ERROR, svn_sqlite__reset(stmt),
- _("The pristine text with checksum '%s' was "
- "found in the DB or on disk but not both"),
- svn_checksum_to_cstring_display(sha1_checksum,
- scratch_pool));
-
- *present = have_row;
- return SVN_NO_ERROR;
-}
-
-
/* Helper for svn_wc__db_op_copy to handle copying from one db to
another */
static svn_error_t *
@@ -4062,17 +3517,18 @@ svn_wc__db_op_revert_actual(svn_wc__db_t
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
- if (affected_rows == 0) {
- /* Failed to delete the row.
- Presumably because there was a changelist set on it */
+ if (affected_rows == 0)
+ {
+ /* Failed to delete the row.
+ Presumably because there was a changelist set on it */
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
- SVN_ERR(svn_sqlite__step_done(stmt));
- /* We're not interested here if there was an affected row or not:
- If there isn't by now, then there simply was no row to begin with */
- }
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+ /* We're not interested here if there was an affected row or not:
+ If there isn't by now, then there simply was no row to begin with */
+ }
/* Some entries have cached the above values. Kapow!! */
SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
Modified: subversion/branches/performance/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/workqueue.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/workqueue.c Wed Feb 2 13:04:51 2011
@@ -46,7 +46,7 @@
#define OP_DELETION_POSTCOMMIT "deletion-postcommit"
/* Arguments of OP_POSTCOMMIT:
* (local_abspath, revnum, date, [author], [checksum],
- * [dav_cache/wc_props], keep_changelist, [tmp_text_base_abspath]). */
+ * [dav_cache/wc_props], keep_changelist, no_unlock, changed_rev). */
#define OP_POSTCOMMIT "postcommit"
#define OP_FILE_INSTALL "file-install"
#define OP_FILE_REMOVE "file-remove"
@@ -761,10 +761,9 @@ svn_wc__wq_add_deletion_postcommit(svn_w
/* OP_POSTCOMMIT */
-/* If TMP_TEXT_BASE_ABSPATH is not NULL, then assume that it is a copy of
- * the new text base of the newly-committed versioned file FILE_ABSPATH,
- * and adjust the working file accordingly. TMP_TEXT_BASE_ABSPATH is in
- * repository-normal form (aka "detranslated" form).
+/* FILE_ABSPATH is the new text base of the newly-committed versioned file,
+ * in repository-normal form (aka "detranslated" form). Adjust the working
+ * file accordingly.
*
* If eol and/or keyword translation would cause the working file to
* change, then overwrite the working file with a translated copy of
@@ -790,7 +789,6 @@ static svn_error_t *
install_committed_file(svn_boolean_t *overwrote_working,
svn_wc__db_t *db,
const char *file_abspath,
- const char *tmp_text_base_abspath,
svn_boolean_t remove_executable,
svn_boolean_t remove_read_only,
svn_cancel_func_t cancel_func,
@@ -830,8 +828,7 @@ install_committed_file(svn_boolean_t *ov
* text is the same as the old working text (or TRUE if it's a special
* file). */
{
- const char *tmp
- = (tmp_text_base_abspath != NULL) ? tmp_text_base_abspath : file_abspath;
+ const char *tmp = file_abspath;
/* Copy and translate, if necessary. The output file will be deleted at
* scratch_pool cleanup.
@@ -857,6 +854,7 @@ install_committed_file(svn_boolean_t *ov
&special,
db, file_abspath,
scratch_pool, scratch_pool));
+ /* ### Should this be a strcmp()? */
if (! special && tmp != tmp_wfile)
SVN_ERR(svn_io_files_contents_same_p(&same, tmp_wfile,
file_abspath, scratch_pool));
@@ -925,13 +923,12 @@ install_committed_file(svn_boolean_t *ov
* - Remove children that are marked deleted (if it's a dir)
* - Install the new base props
* - Install the new tree state
- * - Install the new base text (if it's a file) from TMP_TEXT_BASE_ABSPATH
+ * - Install the new base text (if it's a file)
* - Adjust the parent (if it's a dir)
* */
static svn_error_t *
log_do_committed(svn_wc__db_t *db,
const char *local_abspath,
- const char *tmp_text_base_abspath,
svn_revnum_t new_revision,
svn_revnum_t changed_rev,
apr_time_t changed_date,
@@ -1110,7 +1107,7 @@ log_do_committed(svn_wc__db_t *db,
by then will have moved to `text-base'. */
SVN_ERR(install_committed_file(&overwrote_working, db,
- local_abspath, tmp_text_base_abspath,
+ local_abspath,
remove_executable, set_read_write,
cancel_func, cancel_baton,
pool));
@@ -1222,7 +1219,6 @@ run_postcommit(svn_wc__db_t *db,
const svn_checksum_t *new_checksum;
apr_hash_t *new_dav_cache;
svn_boolean_t keep_changelist, no_unlock;
- const char *tmp_text_base_abspath;
svn_error_t *err;
apr_int64_t val;
@@ -1258,32 +1254,26 @@ run_postcommit(svn_wc__db_t *db,
/* Before r927056, this WQ item didn't have this next field. Catch any
* attempt to run this code on a WC having a stale WQ item in it. */
SVN_ERR_ASSERT(arg5->next->next->next != NULL);
- if (arg5->next->next->next->len == 0)
- tmp_text_base_abspath = NULL;
- else
- tmp_text_base_abspath = apr_pstrmemdup(scratch_pool,
- arg5->next->next->next->data,
- arg5->next->next->next->len);
- if (arg5->next->next->next->next)
+ if (arg5->next->next->next)
{
- SVN_ERR(svn_skel__parse_int(&val, arg5->next->next->next->next,
+ SVN_ERR(svn_skel__parse_int(&val, arg5->next->next->next,
scratch_pool));
no_unlock = (val != 0);
}
else
no_unlock = TRUE;
- if (arg5->next->next->next->next->next)
+ if (arg5->next->next->next->next)
{
- SVN_ERR(svn_skel__parse_int(&val, arg5->next->next->next->next->next,
+ SVN_ERR(svn_skel__parse_int(&val, arg5->next->next->next->next,
scratch_pool));
changed_rev = (svn_revnum_t)val;
}
else
changed_rev = new_revision; /* Behavior before fixing issue #3676 */
- err = log_do_committed(db, local_abspath, tmp_text_base_abspath,
+ err = log_do_committed(db, local_abspath,
new_revision, changed_rev, changed_date,
changed_author, new_checksum, new_dav_cache,
keep_changelist, no_unlock,
@@ -1302,7 +1292,6 @@ run_postcommit(svn_wc__db_t *db,
svn_error_t *
svn_wc__wq_add_postcommit(svn_wc__db_t *db,
const char *local_abspath,
- const char *tmp_text_base_abspath,
svn_revnum_t new_revision,
svn_revnum_t changed_rev,
apr_time_t changed_date,
@@ -1317,8 +1306,6 @@ svn_wc__wq_add_postcommit(svn_wc__db_t *
svn_skel__prepend_int(changed_rev, work_item, scratch_pool);
svn_skel__prepend_int(no_unlock, work_item, scratch_pool);
- svn_skel__prepend_str(tmp_text_base_abspath ? tmp_text_base_abspath : "",
- work_item, scratch_pool);
svn_skel__prepend_int(keep_changelist, work_item, scratch_pool);
if (new_dav_cache == NULL || apr_hash_count(new_dav_cache) == 0)
{
Modified: subversion/branches/performance/subversion/libsvn_wc/workqueue.h
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/workqueue.h?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/workqueue.h (original)
+++ subversion/branches/performance/subversion/libsvn_wc/workqueue.h Wed Feb 2 13:04:51 2011
@@ -286,10 +286,11 @@ svn_wc__wq_add_deletion_postcommit(svn_w
apr_pool_t *scratch_pool);
+/* Queue a work item that will call log_do_committed() with all of these
+ * parameters. See log_do_committed(). */
svn_error_t *
svn_wc__wq_add_postcommit(svn_wc__db_t *db,
const char *local_abspath,
- const char *tmp_text_base_abspath,
svn_revnum_t new_revision,
svn_revnum_t changed_rev,
apr_time_t changed_date,
Modified: subversion/branches/performance/subversion/mod_authz_svn/mod_authz_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_authz_svn/mod_authz_svn.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_authz_svn/mod_authz_svn.c (original)
+++ subversion/branches/performance/subversion/mod_authz_svn/mod_authz_svn.c Wed Feb 2 13:04:51 2011
@@ -42,6 +42,8 @@
#include "svn_config.h"
#include "svn_string.h"
#include "svn_repos.h"
+#include "svn_dirent_uri.h"
+#include "private/svn_fspath.h"
extern module AP_MODULE_DECLARE_DATA authz_svn_module;
@@ -68,7 +70,7 @@ create_authz_svn_dir_config(apr_pool_t *
conf->base_path = d;
if (d)
- conf->base_path = svn_uri_canonicalize(d, p);
+ conf->base_path = svn_urlpath__canonicalize(d, p);
/* By default keep the fortress secure */
conf->authoritative = 1;
@@ -274,7 +276,6 @@ req_check_access(request_rec *r,
svn_authz_t *access_conf = NULL;
svn_error_t *svn_err;
char errbuf[256];
- const char *canonicalized_uri;
const char *username_to_authorize = get_username_to_authorize(r, conf);
switch (r->method_number)
@@ -314,8 +315,7 @@ req_check_access(request_rec *r,
break;
}
- canonicalized_uri = svn_uri_canonicalize(r->uri, r->pool);
- if (strcmp(canonicalized_uri, conf->base_path) == 0)
+ if (strcmp(svn_urlpath__canonicalize(r->uri, r->pool), conf->base_path) == 0)
{
/* Do no access control when conf->base_path(as configured in <Location>)
* and given uri are same. The reason for such relaxation of access
@@ -357,7 +357,7 @@ req_check_access(request_rec *r,
repos_path = NULL;
if (repos_path)
- repos_path = svn_path_join("/", repos_path, r->pool);
+ repos_path = svn_fspath__canonicalize(repos_path, r->pool);
*repos_path_ref = apr_pstrcat(r->pool, repos_name, ":", repos_path,
(char *)NULL);
@@ -405,7 +405,7 @@ req_check_access(request_rec *r,
}
if (dest_repos_path)
- dest_repos_path = svn_path_join("/", dest_repos_path, r->pool);
+ dest_repos_path = svn_fspath__canonicalize(dest_repos_path, r->pool);
*dest_repos_path_ref = apr_pstrcat(r->pool, dest_repos_name, ":",
dest_repos_path, (char *)NULL);
Modified: subversion/branches/performance/subversion/mod_dav_svn/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/authz.c?rev=1066452&r1=1066451&r2=1066452&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/authz.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/authz.c Wed Feb 2 13:04:51 2011
@@ -28,6 +28,8 @@
#include "svn_dirent_uri.h"
#include "svn_path.h"
+#include "private/svn_fspath.h"
+
#include "mod_authz_svn.h"
#include "dav_svn.h"
@@ -139,20 +141,21 @@ authz_read(svn_boolean_t *allowed,
copied tree. So we start at path and walk up its parents
asking if anyone was copied, and if so where from. */
while (! (svn_path_is_empty(path_s->data)
- || ((path_s->len == 1) && (path_s->data[0] == '/'))))
+ || svn_fspath__is_root(path_s->data, path_s->len)))
{
SVN_ERR(svn_fs_copied_from(&rev, &revpath, root,
path_s->data, pool));
if (SVN_IS_VALID_REVNUM(rev) && revpath)
{
- revpath = svn_path_join(revpath, lopped_path, pool);
+ revpath = svn_fspath__join(revpath, lopped_path, pool);
break;
}
/* Lop off the basename and try again. */
- lopped_path = svn_path_join(svn_uri_basename
- (path_s->data, pool), lopped_path, pool);
+ lopped_path = svn_relpath_join(svn_fspath__basename(path_s->data,
+ pool),
+ lopped_path, pool);
svn_path_remove_component(path_s);
}