You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/12/12 17:43:45 UTC
svn commit: r1044847 [2/4] - in
/subversion/branches/diff-optimizations-bytes: ./ build/ build/ac-macros/
build/generator/templates/ notes/ notes/api-errata/ notes/api-errata/1.7/
subversion/include/ subversion/include/private/ subversion/libsvn_client...
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/fs_fs.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/fs_fs.c Sun Dec 12 16:43:42 2010
@@ -246,8 +246,6 @@ path_rev(svn_fs_t *fs, svn_revnum_t rev,
apr_psprintf(pool, "%ld", rev), NULL);
}
-/* Returns the path of REV in FS, whether in a pack file or not.
- Allocate in POOL. */
svn_error_t *
svn_fs_fs__path_rev_absolute(const char **path,
svn_fs_t *fs,
@@ -256,45 +254,16 @@ svn_fs_fs__path_rev_absolute(const char
{
fs_fs_data_t *ffd = fs->fsap_data;
- if (ffd->format < SVN_FS_FS__MIN_PACKED_FORMAT)
+ if (ffd->format < SVN_FS_FS__MIN_PACKED_FORMAT
+ || ! is_packed_rev(fs, rev))
{
*path = path_rev(fs, rev, pool);
- return SVN_NO_ERROR;
}
-
- if (! is_packed_rev(fs, rev))
+ else
{
- svn_node_kind_t kind;
-
- /* Initialize the return variable. */
- *path = path_rev(fs, rev, pool);
-
- SVN_ERR(svn_io_check_path(*path, &kind, pool));
- if (kind == svn_node_file)
- {
- /* *path is already set correctly. */
- return SVN_NO_ERROR;
- }
- else
- {
- /* Someone must have run 'svnadmin pack' while this fs object
- * was open. */
-
- SVN_ERR(update_min_unpacked_rev(fs, pool));
-
- /* The rev really should be present now. */
- if (! is_packed_rev(fs, rev))
- return svn_error_createf(APR_ENOENT, NULL,
- _("Revision file '%s' does not exist, "
- "and r%ld is not packed"),
- svn_dirent_local_style(*path, pool),
- rev);
- /* Fall through. */
- }
+ *path = path_rev_packed(fs, rev, "pack", pool);
}
- *path = path_rev_packed(fs, rev, "pack", pool);
-
return SVN_NO_ERROR;
}
@@ -1894,7 +1863,14 @@ ensure_revision_exists(svn_fs_t *fs,
/* Open the correct revision file for REV. If the filesystem FS has
been packed, *FILE will be set to the packed file; otherwise, set *FILE
to the revision file for REV. Return SVN_ERR_FS_NO_SUCH_REVISION if the
- file doesn't exist. Use POOL for allocations. */
+ file doesn't exist.
+
+ TODO: Consider returning an indication of whether this is a packed rev
+ file, so the caller need not rely on is_packed_rev() which in turn
+ relies on the cached FFD->min_unpacked_rev value not having changed
+ since the rev file was opened.
+
+ Use POOL for allocations. */
static svn_error_t *
open_pack_or_rev_file(apr_file_t **file,
svn_fs_t *fs,
@@ -1934,13 +1910,12 @@ open_pack_or_rev_file(apr_file_t **file,
}
else
{
- /* the file exists but something prevented us from opnening it */
- return svn_error_return(err);
+ retry = FALSE;
}
}
- while (err);
+ while (retry);
- return SVN_NO_ERROR;
+ return svn_error_return(err);
}
/* Given REV in FS, set *REV_OFFSET to REV's offset in the packed file.
@@ -2646,8 +2621,18 @@ get_fs_id_at_offset(svn_fs_id_t **id_p,
specifies the offset to the root node-id and to the changed path
information. Store the root node offset in *ROOT_OFFSET and the
changed path offset in *CHANGES_OFFSET. If either of these
- pointers is NULL, do nothing with it. If PACKED is true, REV_FILE
- should be a packed shard file. Allocate temporary variables from POOL. */
+ pointers is NULL, do nothing with it.
+
+ If PACKED is true, REV_FILE should be a packed shard file.
+ ### There is currently no such parameter. This function assumes that
+ is_packed_rev(FS, REV) will indicate whether REV_FILE is a packed
+ file. Therefore FS->fsap_data->min_unpacked_rev must not have been
+ refreshed since REV_FILE was opened if there is a possibility that
+ revision REV may have become packed since then.
+ TODO: Take an IS_PACKED parameter instead, in order to remove this
+ requirement.
+
+ Allocate temporary variables from POOL. */
static svn_error_t *
get_root_changes_offset(apr_off_t *root_offset,
apr_off_t *changes_offset,
@@ -3506,7 +3491,8 @@ rep_read_contents(void *baton,
svn_checksum_t *md5_checksum;
rb->checksum_finalized = TRUE;
- svn_checksum_final(&md5_checksum, rb->md5_checksum_ctx, rb->pool);
+ SVN_ERR(svn_checksum_final(&md5_checksum, rb->md5_checksum_ctx,
+ rb->pool));
if (!svn_checksum_match(md5_checksum, rb->md5_checksum))
return svn_error_createf
(SVN_ERR_FS_CORRUPT, NULL,
@@ -5667,7 +5653,7 @@ write_hash_rep(svn_filesize_t *size,
SVN_ERR(svn_hash_write2(hash, stream, SVN_HASH_TERMINATOR, pool));
/* Store the results. */
- svn_checksum_final(checksum, whb->checksum_ctx, pool);
+ SVN_ERR(svn_checksum_final(checksum, whb->checksum_ctx, pool));
*size = whb->size;
return svn_stream_printf(whb->stream, pool, "ENDREP\n");
@@ -6966,11 +6952,10 @@ recover_body(void *baton, apr_pool_t *po
if (ffd->format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
{
svn_revnum_t min_unpacked_revprop;
- const char *min_unpacked_revprop_path =
- svn_dirent_join(fs->path, PATH_MIN_UNPACKED_REVPROP, pool);
SVN_ERR(read_min_unpacked_rev(&min_unpacked_revprop,
- min_unpacked_revprop_path, pool));
+ path_min_unpacked_revprop(fs, pool),
+ pool));
if (min_unpacked_revprop == (max_rev + 1))
uhohs = FALSE;
}
@@ -7517,6 +7502,31 @@ svn_fs_fs__begin_obliteration_txn(svn_fs
/****** Packing FSFS shards *********/
+
+/* Write a file FILENAME in directory FS_PATH, containing a single line
+ * with the number REVNUM in ASCII decimal. Move the file into place
+ * atomically, overwriting any existing file.
+ *
+ * Similar to write_current(). */
+static svn_error_t *
+write_revnum_file(const char *fs_path,
+ const char *filename,
+ svn_revnum_t revnum,
+ apr_pool_t *scratch_pool)
+{
+ const char *final_path, *tmp_path;
+ svn_stream_t *tmp_stream;
+
+ final_path = svn_dirent_join(fs_path, filename, scratch_pool);
+ SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_path, fs_path,
+ svn_io_file_del_none,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_stream_printf(tmp_stream, scratch_pool, "%ld\n", revnum));
+ SVN_ERR(svn_stream_close(tmp_stream));
+ SVN_ERR(move_into_place(tmp_path, final_path, final_path, scratch_pool));
+ return SVN_NO_ERROR;
+}
+
/* Pack a single shard SHARD in REVS_DIR, using POOL for allocations.
CANCEL_FUNC and CANCEL_BATON are what you think they are.
@@ -7533,12 +7543,10 @@ pack_shard(const char *revs_dir,
void *cancel_baton,
apr_pool_t *pool)
{
- const char *tmp_path, *final_path;
const char *pack_file_path, *manifest_file_path, *shard_path;
const char *pack_file_dir;
svn_stream_t *pack_stream, *manifest_stream;
svn_revnum_t start_rev, end_rev, rev;
- svn_stream_t *tmp_stream;
apr_off_t next_offset;
apr_pool_t *iterpool;
@@ -7549,8 +7557,8 @@ pack_shard(const char *revs_dir,
pack_file_path = svn_dirent_join(pack_file_dir, "pack", pool);
manifest_file_path = svn_dirent_join(pack_file_dir, "manifest", pool);
shard_path = svn_dirent_join(revs_dir,
- apr_psprintf(pool, "%" APR_INT64_T_FMT, shard),
- pool);
+ apr_psprintf(pool, "%" APR_INT64_T_FMT, shard),
+ pool);
/* Notify caller we're starting to pack this shard. */
if (notify_func)
@@ -7588,8 +7596,8 @@ pack_shard(const char *revs_dir,
SVN_ERR(svn_io_stat(&finfo, path, APR_FINFO_SIZE, iterpool));
/* Update the manifest. */
- svn_stream_printf(manifest_stream, iterpool, "%" APR_OFF_T_FMT "\n",
- next_offset);
+ SVN_ERR(svn_stream_printf(manifest_stream, iterpool, "%" APR_OFF_T_FMT
+ "\n", next_offset));
next_offset += finfo.size;
/* Copy all the bits from the rev file to the end of the pack file. */
@@ -7608,13 +7616,9 @@ pack_shard(const char *revs_dir,
/* Update the min-unpacked-rev file to reflect our newly packed shard.
* (This doesn't update ffd->min_unpacked_rev. That will be updated by
* update_min_unpacked_rev() when necessary.) */
- final_path = svn_dirent_join(fs_path, PATH_MIN_UNPACKED_REV, iterpool);
- SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_path, fs_path,
- svn_io_file_del_none, iterpool, iterpool));
- SVN_ERR(svn_stream_printf(tmp_stream, iterpool, "%ld\n",
- (svn_revnum_t) ((shard + 1) * max_files_per_dir)));
- SVN_ERR(svn_stream_close(tmp_stream));
- SVN_ERR(move_into_place(tmp_path, final_path, final_path, iterpool));
+ SVN_ERR(write_revnum_file(fs_path, PATH_MIN_UNPACKED_REV,
+ (svn_revnum_t)((shard + 1) * max_files_per_dir),
+ iterpool));
svn_pool_destroy(iterpool);
/* Finally, remove the existing shard directory. */
@@ -7642,10 +7646,9 @@ pack_revprop_shard(svn_fs_t *fs,
apr_pool_t *pool)
{
fs_fs_data_t *ffd = fs->fsap_data;
- const char *shard_path, *final_path, *tmp_path;
+ const char *shard_path;
svn_revnum_t start_rev, end_rev, rev;
svn_sqlite__stmt_t *stmt;
- svn_stream_t *tmp_stream;
apr_pool_t *iterpool;
shard_path = svn_dirent_join(revprops_dir,
@@ -7676,13 +7679,9 @@ pack_revprop_shard(svn_fs_t *fs,
/* Update the min-unpacked-revprop file to reflect our newly packed shard.
* (This doesn't update ffd->min_unpacked_revprop.) */
- final_path = svn_dirent_join(fs_path, PATH_MIN_UNPACKED_REVPROP, iterpool);
- SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_path, fs_path,
- svn_io_file_del_none, iterpool, iterpool));
- SVN_ERR(svn_stream_printf(tmp_stream, iterpool, "%ld\n",
- (svn_revnum_t) ((shard + 1) * max_files_per_dir)));
- SVN_ERR(svn_stream_close(tmp_stream));
- SVN_ERR(move_into_place(tmp_path, final_path, final_path, iterpool));
+ SVN_ERR(write_revnum_file(fs_path, PATH_MIN_UNPACKED_REVPROP,
+ (svn_revnum_t)((shard + 1) * max_files_per_dir),
+ iterpool));
svn_pool_destroy(iterpool);
/* Finally, remove the existing shard directory. */
@@ -7706,6 +7705,22 @@ struct pack_baton
void *cancel_baton;
};
+
+/* The work-horse for svn_fs_fs__pack, called with the FS write lock.
+ This implements the svn_fs_fs__with_write_lock() 'body' callback
+ type. BATON is a 'struct pack_baton *'.
+
+ WARNING: if you add a call to this function, please note:
+ The code currently assumes that any piece of code running with
+ the write-lock set can rely on the ffd->min_unpacked_rev and
+ ffd->min_unpacked_revprop caches to be up-to-date (and, by
+ extension, on not having to use a retry when calling
+ svn_fs_fs__path_rev_absolute() and friends). If you add a call
+ to this function, consider whether you have to call
+ update_min_unpacked_rev() and update_min_unpacked_revprop()
+ afterwards.
+ See this thread: http://thread.gmane.org/1291206765.3782.3309.camel@edith
+ */
static svn_error_t *
pack_body(void *baton,
apr_pool_t *pool)
@@ -7720,31 +7735,28 @@ pack_body(void *baton,
svn_revnum_t min_unpacked_rev;
svn_revnum_t min_unpacked_revprop;
- SVN_ERR(read_format(&format, &max_files_per_dir,
- svn_dirent_join(pb->fs->path, PATH_FORMAT, pool),
+ SVN_ERR(read_format(&format, &max_files_per_dir, path_format(pb->fs, pool),
pool));
/* If the repository isn't a new enough format, we don't support packing.
Return a friendly error to that effect. */
if (format < SVN_FS_FS__MIN_PACKED_FORMAT)
- return svn_error_create(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL,
- _("FS format too old to pack, please upgrade."));
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("FSFS format (%d) too old to pack, please upgrade."),
+ format);
/* If we aren't using sharding, we can't do any packing, so quit. */
if (!max_files_per_dir)
return SVN_NO_ERROR;
SVN_ERR(read_min_unpacked_rev(&min_unpacked_rev,
- svn_dirent_join(pb->fs->path,
- PATH_MIN_UNPACKED_REV, pool),
+ path_min_unpacked_rev(pb->fs, pool),
pool));
if (format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
{
SVN_ERR(read_min_unpacked_rev(&min_unpacked_revprop,
- svn_dirent_join(pb->fs->path,
- PATH_MIN_UNPACKED_REVPROP,
- pool),
+ path_min_unpacked_revprop(pb->fs, pool),
pool));
}
else
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/fs_fs.h?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/fs_fs.h Sun Dec 12 16:43:42 2010
@@ -411,8 +411,10 @@ svn_error_t *svn_fs_fs__move_into_place(
Allocate *PATH in POOL.
Note: If the caller does not have the write lock on FS, then the path is
- not guaranteed to remain correct after the function returns, because the
- revision might become packed just after this call. */
+ not guaranteed to be correct or to remain correct after the function
+ returns, because the revision might become packed before or after this
+ call. If a file exists at that path, then it is correct; if not, then
+ the caller should call update_min_unpacked_rev() and re-try once. */
svn_error_t *
svn_fs_fs__path_rev_absolute(const char **path,
svn_fs_t *fs,
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/lock.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_fs_fs/lock.c Sun Dec 12 16:43:42 2010
@@ -60,16 +60,18 @@
/*** Generic helper functions. ***/
-/* Return the MD5 hash of STR. */
-static const char *
-make_digest(const char *str,
+/* Set *DIGEST to the MD5 hash of STR. */
+static svn_error_t *
+make_digest(const char **digest,
+ const char *str,
apr_pool_t *pool)
{
svn_checksum_t *checksum;
- svn_checksum(&checksum, svn_checksum_md5, str, strlen(str), pool);
+ SVN_ERR(svn_checksum(&checksum, svn_checksum_md5, str, strlen(str), pool));
- return svn_checksum_to_cstring_display(checksum, pool);
+ *digest = svn_checksum_to_cstring_display(checksum, pool);
+ return SVN_NO_ERROR;
}
@@ -134,18 +136,22 @@ digest_path_from_digest(const char *fs_p
}
-/* Return the path to the lock/entries digest file associate with
- PATH, where PATH is the path to the lock file or lock entries file
+/* Set *DIGEST_PATH to the path to the lock/entries digest file associate
+ with PATH, where PATH is the path to the lock file or lock entries file
in FS. */
-static const char *
-digest_path_from_path(const char *fs_path,
+static svn_error_t *
+digest_path_from_path(const char **digest_path,
+ const char *fs_path,
const char *path,
apr_pool_t *pool)
{
- const char *digest = make_digest(path, pool);
- return svn_dirent_join_many(pool, fs_path, PATH_LOCKS_DIR,
- apr_pstrmemdup(pool, digest, DIGEST_SUBDIR_LEN),
- digest, NULL);
+ const char *digest;
+ SVN_ERR(make_digest(&digest, path, pool));
+ *digest_path = svn_dirent_join_many(pool, fs_path, PATH_LOCKS_DIR,
+ apr_pstrmemdup(pool, digest,
+ DIGEST_SUBDIR_LEN),
+ digest, NULL);
+ return SVN_NO_ERROR;
}
@@ -362,7 +368,8 @@ set_lock(const char *fs_path,
/* Calculate the DIGEST_PATH for the currently FS path, and then
get its DIGEST_FILE basename. */
- digest_path = digest_path_from_path(fs_path, this_path->data, subpool);
+ SVN_ERR(digest_path_from_path(&digest_path, fs_path, this_path->data,
+ subpool));
digest_file = svn_dirent_basename(digest_path, subpool);
SVN_ERR(read_digest_file(&this_children, &this_lock, fs_path,
@@ -424,7 +431,8 @@ delete_lock(svn_fs_t *fs,
/* Calculate the DIGEST_PATH for the currently FS path, and then
get its DIGEST_FILE basename. */
- digest_path = digest_path_from_path(fs->path, this_path->data, subpool);
+ SVN_ERR(digest_path_from_path(&digest_path, fs->path, this_path->data,
+ subpool));
digest_file = svn_dirent_basename(digest_path, subpool);
SVN_ERR(read_digest_file(&this_children, &this_lock, fs->path,
@@ -478,7 +486,9 @@ get_lock(svn_lock_t **lock_p,
apr_pool_t *pool)
{
svn_lock_t *lock;
- const char *digest_path = digest_path_from_path(fs->path, path, pool);
+ const char *digest_path;
+
+ SVN_ERR(digest_path_from_path(&digest_path, fs->path, path, pool));
SVN_ERR(read_digest_file(NULL, &lock, fs->path, digest_path, pool));
if (! lock)
@@ -702,7 +712,8 @@ svn_fs_fs__allow_locked_operation(const
if (recurse)
{
/* Discover all locks at or below the path. */
- const char *digest_path = digest_path_from_path(fs->path, path, pool);
+ const char *digest_path;
+ SVN_ERR(digest_path_from_path(&digest_path, fs->path, path, pool));
SVN_ERR(walk_locks(fs, digest_path, get_locks_callback,
fs, have_write_lock, pool));
}
@@ -1052,7 +1063,7 @@ svn_fs_fs__get_locks(svn_fs_t *fs,
glfb.get_locks_baton = get_locks_baton;
/* Get the top digest path in our tree of interest, and then walk it. */
- digest_path = digest_path_from_path(fs->path, path, pool);
+ SVN_ERR(digest_path_from_path(&digest_path, fs->path, path, pool));
SVN_ERR(walk_locks(fs, digest_path, get_locks_filter_func, &glfb,
FALSE, pool));
return SVN_NO_ERROR;
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra/compat.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra/compat.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra/compat.c Sun Dec 12 16:43:42 2010
@@ -763,12 +763,12 @@ svn_ra__file_revs_from_log(svn_ra_sessio
currpool = lastpool;
lastpool = tmppool;
- svn_stream_close(last_stream);
+ SVN_ERR(svn_stream_close(last_stream));
last_stream = stream;
last_props = props;
}
- svn_stream_close(last_stream);
+ SVN_ERR(svn_stream_close(last_stream));
svn_pool_destroy(currpool);
svn_pool_destroy(lastpool);
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/commit.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/commit.c Sun Dec 12 16:43:42 2010
@@ -525,9 +525,9 @@ get_version_url(const char **checked_in_
propfind_url = session->repos_url.path;
}
- svn_ra_serf__deliver_props(&propfind_ctx, props, session, conn,
- propfind_url, base_revision, "0",
- checked_in_props, FALSE, NULL, pool);
+ SVN_ERR(svn_ra_serf__deliver_props(&propfind_ctx, props, session, conn,
+ propfind_url, base_revision, "0",
+ checked_in_props, FALSE, NULL, pool));
SVN_ERR(svn_ra_serf__wait_for_props(propfind_ctx, session, pool));
@@ -2401,9 +2401,9 @@ svn_ra_serf__change_rev_prop(svn_ra_sess
props = apr_hash_make(pool);
propfind_ctx = NULL;
- svn_ra_serf__deliver_props(&propfind_ctx, props, commit->session,
- commit->conn, vcc_url, rev, "0",
- checked_in_props, FALSE, NULL, pool);
+ SVN_ERR(svn_ra_serf__deliver_props(&propfind_ctx, props, commit->session,
+ commit->conn, vcc_url, rev, "0",
+ checked_in_props, FALSE, NULL, pool));
SVN_ERR(svn_ra_serf__wait_for_props(propfind_ctx, commit->session, pool));
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/options.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/options.c Sun Dec 12 16:43:42 2010
@@ -494,8 +494,9 @@ svn_ra_serf__exchange_capabilities(svn_r
svn_error_t *err;
/* This routine automatically fills in serf_sess->capabilities */
- svn_ra_serf__create_options_req(&opt_ctx, serf_sess, serf_sess->conns[0],
- serf_sess->repos_url.path, pool);
+ SVN_ERR(svn_ra_serf__create_options_req(&opt_ctx, serf_sess,
+ serf_sess->conns[0],
+ serf_sess->repos_url.path, pool));
err = svn_ra_serf__context_run_wait(
svn_ra_serf__get_options_done_ptr(opt_ctx), serf_sess, pool);
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/property.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/property.c Sun Dec 12 16:43:42 2010
@@ -990,8 +990,9 @@ svn_ra_serf__get_baseline_info(const cha
{
svn_ra_serf__options_context_t *opt_ctx;
- svn_ra_serf__create_options_req(&opt_ctx, session, conn,
- session->repos_url.path, pool);
+ SVN_ERR(svn_ra_serf__create_options_req(&opt_ctx, session, conn,
+ session->repos_url.path,
+ pool));
SVN_ERR(svn_ra_serf__context_run_wait(
svn_ra_serf__get_options_done_ptr(opt_ctx), session, pool));
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/serf.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/serf.c Sun Dec 12 16:43:42 2010
@@ -600,9 +600,10 @@ fetch_path_props(svn_ra_serf__propfind_c
*/
if (!SVN_IS_VALID_REVNUM(revision))
{
- svn_ra_serf__deliver_props(&prop_ctx, props, session, session->conns[0],
- path, revision, "0", desired_props, TRUE,
- NULL, session->pool);
+ SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx, props, session,
+ session->conns[0], path, revision,
+ "0", desired_props, TRUE, NULL,
+ session->pool));
}
else
{
@@ -619,10 +620,10 @@ fetch_path_props(svn_ra_serf__propfind_c
prop_ctx = NULL;
path = svn_path_url_add_component2(basecoll_url, relative_url, pool);
revision = SVN_INVALID_REVNUM;
- svn_ra_serf__deliver_props(&prop_ctx, props, session, session->conns[0],
- path, revision, "0",
- desired_props, TRUE,
- NULL, session->pool);
+ SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx, props, session,
+ session->conns[0], path, revision,
+ "0", desired_props, TRUE, NULL,
+ session->pool));
}
if (prop_ctx)
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/update.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_serf/update.c Sun Dec 12 16:43:42 2010
@@ -1189,10 +1189,11 @@ fetch_file(report_context_t *ctx, report
info->propfind = NULL;
if (info->fetch_props)
{
- svn_ra_serf__deliver_props(&info->propfind, info->props,
- ctx->sess, conn,
- info->url, info->target_rev, "0", all_props,
- FALSE, &ctx->done_propfinds, info->dir->pool);
+ SVN_ERR(svn_ra_serf__deliver_props(&info->propfind, info->props,
+ ctx->sess, conn, info->url,
+ info->target_rev, "0", all_props,
+ FALSE, &ctx->done_propfinds,
+ info->dir->pool));
SVN_ERR_ASSERT(info->propfind);
@@ -1743,12 +1744,14 @@ end_report(svn_ra_serf__xml_parser_t *pa
/* Unconditionally set fetch_props now. */
info->dir->fetch_props = TRUE;
- svn_ra_serf__deliver_props(&info->dir->propfind, info->dir->props,
- ctx->sess,
- ctx->sess->conns[ctx->sess->cur_conn],
- info->dir->url, info->dir->target_rev,
- "0", all_props, FALSE,
- &ctx->done_propfinds, info->dir->pool);
+ SVN_ERR(svn_ra_serf__deliver_props(&info->dir->propfind,
+ info->dir->props, ctx->sess,
+ ctx->sess->conns[ctx->sess->cur_conn],
+ info->dir->url,
+ info->dir->target_rev, "0",
+ all_props, FALSE,
+ &ctx->done_propfinds,
+ info->dir->pool));
SVN_ERR_ASSERT(info->dir->propfind);
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_svn/client.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_ra_svn/client.c Sun Dec 12 16:43:42 2010
@@ -1063,7 +1063,7 @@ static svn_error_t *ra_svn_get_file(svn_
svn_checksum_t *checksum;
const char *hex_digest;
- svn_checksum_final(&checksum, checksum_ctx, pool);
+ SVN_ERR(svn_checksum_final(&checksum, checksum_ctx, pool));
hex_digest = svn_checksum_to_cstring_display(checksum, pool);
if (strcmp(hex_digest, expected_checksum) != 0)
return svn_error_createf
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/dump.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/dump.c Sun Dec 12 16:43:42 2010
@@ -480,8 +480,8 @@ dump_node(struct edit_baton *eb,
oldhash = apr_hash_make(pool);
propstring = svn_stringbuf_create_ensure(0, pool);
propstream = svn_stream_from_stringbuf(propstring, pool);
- svn_hash_write_incremental(prophash, oldhash, propstream, "PROPS-END",
- pool);
+ SVN_ERR(svn_hash_write_incremental(prophash, oldhash, propstream,
+ "PROPS-END", pool));
SVN_ERR(svn_stream_close(propstream));
proplen = propstring->len;
content_length += proplen;
@@ -907,7 +907,7 @@ write_revision_record(svn_stream_t *stre
encoded_prophash = svn_stringbuf_create_ensure(0, pool);
propstream = svn_stream_from_stringbuf(encoded_prophash, pool);
- svn_hash_write2(props, propstream, "PROPS-END", pool);
+ SVN_ERR(svn_hash_write2(props, propstream, "PROPS-END", pool));
SVN_ERR(svn_stream_close(propstream));
/* ### someday write a revision-content-checksum */
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/load-fs-vtable.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/load-fs-vtable.c Sun Dec 12 16:43:42 2010
@@ -279,8 +279,9 @@ renumber_mergeinfo_revs(svn_string_t **f
/** vtable for doing commits to a fs **/
-static struct node_baton *
-make_node_baton(apr_hash_t *headers,
+static svn_error_t *
+make_node_baton(struct node_baton **node_baton_p,
+ apr_hash_t *headers,
struct revision_baton *rb,
apr_pool_t *pool)
{
@@ -344,26 +345,29 @@ make_node_baton(apr_hash_t *headers,
if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM,
APR_HASH_KEY_STRING)))
{
- svn_checksum_parse_hex(&nb->result_checksum, svn_checksum_md5, val, pool);
+ SVN_ERR(svn_checksum_parse_hex(&nb->result_checksum, svn_checksum_md5,
+ val, pool));
}
if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM,
APR_HASH_KEY_STRING)))
{
- svn_checksum_parse_hex(&nb->base_checksum, svn_checksum_md5, val, pool);
+ SVN_ERR(svn_checksum_parse_hex(&nb->base_checksum, svn_checksum_md5, val,
+ pool));
}
if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM,
APR_HASH_KEY_STRING)))
{
- svn_checksum_parse_hex(&nb->copy_source_checksum, svn_checksum_md5, val,
- pool);
+ SVN_ERR(svn_checksum_parse_hex(&nb->copy_source_checksum,
+ svn_checksum_md5, val, pool));
}
/* What's cool about this dump format is that the parser just
ignores any unrecognized headers. :-) */
- return nb;
+ *node_baton_p = nb;
+ return SVN_NO_ERROR;
}
static struct revision_baton *
@@ -539,7 +543,7 @@ new_node_record(void **node_baton,
_("Malformed dumpstream: "
"Revision 0 must not contain node records"));
- nb = make_node_baton(headers, rb, pool);
+ SVN_ERR(make_node_baton(&nb, headers, rb, pool));
/* Make sure we have an action we recognize. */
if (nb->action < svn_node_action_change
@@ -725,12 +729,10 @@ apply_textdelta(svn_txdelta_window_handl
return svn_fs_apply_textdelta(handler, handler_baton,
rb->txn_root, nb->path,
- nb->base_checksum ?
svn_checksum_to_cstring(nb->base_checksum,
- nb->pool) : NULL,
- nb->result_checksum ?
+ nb->pool),
svn_checksum_to_cstring(nb->result_checksum,
- nb->pool) : NULL,
+ nb->pool),
nb->pool);
}
@@ -744,9 +746,8 @@ set_fulltext(svn_stream_t **stream,
return svn_fs_apply_text(stream,
rb->txn_root, nb->path,
- nb->result_checksum ?
svn_checksum_to_cstring(nb->result_checksum,
- nb->pool) : NULL,
+ nb->pool),
nb->pool);
}
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/repos.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_repos/repos.c Sun Dec 12 16:43:42 2010
@@ -545,6 +545,7 @@ PREWRITTEN_HOOKS_TEXT
} /* end pre-revprop-change hook */
+#ifdef SVN_WITH_EXPERIMENTAL_OBLITERATE
/* Pre-obliterate hook. */
{
this_path = apr_psprintf(pool, "%s%s",
@@ -617,6 +618,7 @@ PREWRITTEN_HOOKS_TEXT
SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
_("Creating pre-obliterate hook"));
} /* end pre-obliterate hook */
+#endif
/* Pre-lock hook. */
@@ -672,6 +674,8 @@ PREWRITTEN_HOOKS_TEXT
"REPOS=\"$1\"" NL
"PATH=\"$2\"" NL
"USER=\"$3\"" NL
+"COMMENT=\"$4\"" NL
+"STEAL=\"$5\"" NL
"" NL
"# If a lock exists and is owned by a different person, don't allow it" NL
"# to be stolen (e.g., with 'svn lock --force ...')." NL
@@ -755,6 +759,8 @@ PREWRITTEN_HOOKS_TEXT
"REPOS=\"$1\"" NL
"PATH=\"$2\"" NL
"USER=\"$3\"" NL
+"TOKEN=\"$4\"" NL
+"BREAK=\"$5\"" NL
"" NL
"# If a lock is owned by a different person, don't allow it be broken." NL
"# (Maybe this script could send email to the lock owner?)" NL
@@ -1032,6 +1038,7 @@ PREWRITTEN_HOOKS_TEXT
_("Creating post-revprop-change hook"));
} /* end post-revprop-change hook */
+#ifdef SVN_WITH_EXPERIMENTAL_OBLITERATE
/* Post-obliterate hook. */
{
this_path = apr_psprintf(pool, "%s%s",
@@ -1089,6 +1096,7 @@ PREWRITTEN_HOOKS_TEXT
SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
_("Creating post-obliterate hook"));
} /* end post-obliterate hook */
+#endif
return SVN_NO_ERROR;
}
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/cache-memcache.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/cache-memcache.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/cache-memcache.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/cache-memcache.c Sun Dec 12 16:43:42 2010
@@ -75,10 +75,11 @@ struct svn_memcache_t {
2 * APR_MD5_DIGESTSIZE)
-/* Returns a memcache key for the given key KEY for CACHE, allocated
+/* Set *MC_KEY to a memcache key for the given key KEY for CACHE, allocated
in POOL. */
-static const char *
-build_key(memcache_t *cache,
+static svn_error_t *
+build_key(const char **mc_key,
+ memcache_t *cache,
const void *raw_key,
apr_pool_t *pool)
{
@@ -111,7 +112,8 @@ build_key(memcache_t *cache,
if (long_key_len > MEMCACHED_KEY_UNHASHED_LEN)
{
svn_checksum_t *checksum;
- svn_checksum(&checksum, svn_checksum_md5, long_key, long_key_len, pool);
+ SVN_ERR(svn_checksum(&checksum, svn_checksum_md5, long_key, long_key_len,
+ pool));
long_key = apr_pstrcat(pool,
apr_pstrmemdup(pool, long_key,
@@ -120,7 +122,8 @@ build_key(memcache_t *cache,
(char *)NULL);
}
- return long_key;
+ *mc_key = long_key;
+ return SVN_NO_ERROR;
}
@@ -138,7 +141,7 @@ memcache_get(void **value_p,
apr_size_t data_len;
apr_pool_t *subpool = svn_pool_create(pool);
- mc_key = build_key(cache, key, subpool);
+ SVN_ERR(build_key(&mc_key, cache, key, subpool));
apr_err = apr_memcache_getp(cache->memcache,
(cache->deserialize_func ? subpool : pool),
@@ -184,10 +187,12 @@ memcache_set(void *cache_void,
memcache_t *cache = cache_void;
apr_pool_t *subpool = svn_pool_create(pool);
char *data;
- const char *mc_key = build_key(cache, key, subpool);
+ const char *mc_key;
apr_size_t data_len;
apr_status_t apr_err;
+ SVN_ERR(build_key(&mc_key, cache, key, subpool));
+
if (cache->serialize_func)
{
SVN_ERR((cache->serialize_func)(&data, &data_len, value, subpool));
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/checksum.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/checksum.c Sun Dec 12 16:43:42 2010
@@ -193,9 +193,28 @@ svn_checksum_parse_hex(svn_checksum_t **
const char *hex,
apr_pool_t *pool)
{
- int len;
- int i;
- unsigned char is_zeros = '\0';
+ int i, len;
+ char is_nonzero = '\0';
+ char *digest;
+ static const char xdigitval[256] =
+ {
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, /* 0-9 */
+ -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A-F */
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* a-f */
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ };
if (hex == NULL)
{
@@ -206,23 +225,21 @@ svn_checksum_parse_hex(svn_checksum_t **
SVN_ERR(validate_kind(kind));
*checksum = svn_checksum_create(kind, pool);
+ digest = (char *)(*checksum)->digest;
len = DIGESTSIZE(kind);
for (i = 0; i < len; i++)
{
- if ((! svn_ctype_isxdigit(hex[i * 2])) ||
- (! svn_ctype_isxdigit(hex[i * 2 + 1])))
+ char x1 = xdigitval[(unsigned char)hex[i * 2]];
+ char x2 = xdigitval[(unsigned char)hex[i * 2 + 1]];
+ if (x1 == (char)-1 || x2 == (char)-1)
return svn_error_create(SVN_ERR_BAD_CHECKSUM_PARSE, NULL, NULL);
- ((unsigned char *)(*checksum)->digest)[i] =
- ((svn_ctype_isalpha(hex[i*2]) ? hex[i*2] - 'a' + 10
- : hex[i*2] - '0') << 4) |
- (svn_ctype_isalpha(hex[i*2+1]) ? hex[i*2+1] - 'a' + 10
- : hex[i*2+1] - '0');
- is_zeros |= (*checksum)->digest[i];
+ digest[i] = (x1 << 4) | x2;
+ is_nonzero |= (x1 << 4) | x2;
}
- if (is_zeros == '\0')
+ if (!is_nonzero)
*checksum = NULL;
return SVN_NO_ERROR;
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/mergeinfo.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/mergeinfo.c Sun Dec 12 16:43:42 2010
@@ -668,7 +668,7 @@ parse_revision_line(const char **input,
absolute path key. */
existing_rangelist = apr_hash_get(hash, pathname->data, APR_HASH_KEY_STRING);
if (existing_rangelist)
- svn_rangelist_merge(&rangelist, existing_rangelist, pool);
+ SVN_ERR(svn_rangelist_merge(&rangelist, existing_rangelist, pool));
apr_hash_set(hash, pathname->data, APR_HASH_KEY_STRING, rangelist);
@@ -1188,9 +1188,9 @@ mergeinfo_hash_diff_cb(const void *key,
apr_array_header_t *deleted_rangelist, *added_rangelist;
from_rangelist = apr_hash_get(cb->from, path, APR_HASH_KEY_STRING);
to_rangelist = apr_hash_get(cb->to, path, APR_HASH_KEY_STRING);
- svn_rangelist_diff(&deleted_rangelist, &added_rangelist,
- from_rangelist, to_rangelist,
- cb->consider_inheritance, cb->pool);
+ SVN_ERR(svn_rangelist_diff(&deleted_rangelist, &added_rangelist,
+ from_rangelist, to_rangelist,
+ cb->consider_inheritance, cb->pool));
if (cb->deleted && deleted_rangelist->nelts > 0)
apr_hash_set(cb->deleted, apr_pstrdup(cb->pool, path),
APR_HASH_KEY_STRING, deleted_rangelist);
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/opt.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/opt.c Sun Dec 12 16:43:42 2010
@@ -662,7 +662,7 @@ svn_opt_push_implicit_dot_target(apr_arr
apr_pool_t *pool)
{
if (targets->nelts == 0)
- array_push_str(targets, "", pool); /* Ha! "", not ".", is the canonical */
+ APR_ARRAY_PUSH(targets, const char *) = ""; /* Ha! "", not ".", is the canonical */
assert(targets->nelts);
}
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/adm_crawler.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/adm_crawler.c Sun Dec 12 16:43:42 2010
@@ -709,7 +709,7 @@ find_base_rev(svn_revnum_t *base_rev,
else if (status == svn_wc__db_status_deleted)
{
const char *work_del_abspath;
- SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, NULL, &work_del_abspath,
+ SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, &work_del_abspath,
db, local_abspath, pool, pool));
if (work_del_abspath != NULL)
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/adm_ops.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/adm_ops.c Sun Dec 12 16:43:42 2010
@@ -510,7 +510,7 @@ svn_wc_process_committed_queue2(svn_wc_c
iterpool));
}
- svn_hash__clear(queue->queue, iterpool);
+ SVN_ERR(svn_hash__clear(queue->queue, iterpool));
svn_pool_destroy(iterpool);
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/deprecated.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/deprecated.c Sun Dec 12 16:43:42 2010
@@ -3366,8 +3366,8 @@ svn_wc_relocate3(const char *path,
svn_wc_context_t *wc_ctx;
if (! recurse)
- svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, 0,
- _("Non-recursive relocation not supported"));
+ SVN_ERR(svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Non-recursive relocation not supported")));
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/entries.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/entries.c Sun Dec 12 16:43:42 2010
@@ -91,7 +91,6 @@ typedef struct {
svn_depth_t depth;
apr_time_t last_mod_time;
apr_hash_t *properties;
- svn_boolean_t keep_local;
} db_working_node_t;
typedef struct {
@@ -254,7 +253,6 @@ get_base_info_for_deleted(svn_wc_entry_t
SVN_ERR(svn_wc__db_scan_deletion(NULL,
NULL,
- NULL,
&work_del_abspath,
db, entry_abspath,
scratch_pool, scratch_pool));
@@ -309,165 +307,6 @@ get_base_info_for_deleted(svn_wc_entry_t
entry->revision = parent_entry->revision;
}
- /* For deleted nodes, our COPIED flag has a rather complex meaning.
-
- In general, COPIED means "an operation on an ancestor took care
- of me." This typically refers to a copy of an ancestor (and
- this node just came along for the ride). However, in certain
- situations the COPIED flag is set for deleted nodes.
-
- First off, COPIED will *never* be set for nodes/subtrees that
- are simply deleted. The deleted node/subtree *must* be under
- an ancestor that has been copied. Plain additions do not count;
- only copies (add-with-history).
-
- The basic algorithm to determine whether we live within a
- copied subtree is as follows:
-
- 1) find the root of the deletion operation that affected us
- (we may be that root, or an ancestor was deleted and took
- us with it)
-
- 2) look at the root's *parent* and determine whether that was
- a copy or a simple add.
-
- It would appear that we would be done at this point. Once we
- determine that the parent was copied, then we could just set
- the COPIED flag.
-
- Not so fast. Back to the general concept of "an ancestor
- operation took care of me." Further consider two possibilities:
-
- 1) this node is scheduled for deletion from the copied subtree,
- so at commit time, we copy then delete
-
- 2) this node is scheduled for deletion because a subtree was
- deleted and then a copied subtree was added (causing a
- replacement). at commit time, we delete a subtree, and then
- copy a subtree. we do not need to specifically touch this
- node -- all operations occur on ancestors.
-
- Given the "ancestor operation" concept, then in case (1) we
- must *clear* the COPIED flag since we'll have more work to do.
- In case (2), we *set* the COPIED flag to indicate that no
- real work is going to happen on this node.
-
- Great fun. And just maybe the code reading the entries has no
- bugs in interpreting that gobbledygook... but that *is* the
- expectation of the code. Sigh.
-
- We can get a little bit of shortcut here if THIS_DIR is
- also schduled for deletion.
- */
- if (parent_entry != NULL
- && parent_entry->schedule == svn_wc_schedule_delete)
- {
- /* ### not entirely sure that we can rely on the parent. for
- ### example, what if we are a deletion of a BASE node, but
- ### the parent is a deletion of a copied subtree? sigh. */
-
- /* Child nodes simply inherit the parent's COPIED flag. */
- entry->copied = parent_entry->copied;
- }
- else
- {
- svn_boolean_t base_replaced;
- const char *work_del_abspath;
-
- /* Find out details of our deletion. */
- SVN_ERR(svn_wc__db_scan_deletion(NULL,
- &base_replaced,
- NULL,
- &work_del_abspath,
- db, entry_abspath,
- scratch_pool, scratch_pool));
-
- /* If there is no deletion in the WORKING tree, then the
- node is a child of a simple explicit deletion of the
- BASE tree. It certainly isn't copied. If we *do* find
- a deletion in the WORKING tree, then we need to discover
- information about the parent. */
- if (work_del_abspath != NULL)
- {
- const char *parent_abspath;
- svn_wc__db_status_t parent_status;
-
- /* The parent is in WORKING except during post-commit when
- it may have been moved from the WORKING tree to the BASE
- tree. */
- parent_abspath = svn_dirent_dirname(work_del_abspath,
- scratch_pool);
- SVN_ERR(svn_wc__db_read_info(&parent_status,
- NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- db, parent_abspath,
- scratch_pool, scratch_pool));
- if (parent_status == svn_wc__db_status_added)
- SVN_ERR(svn_wc__db_scan_addition(&parent_status,
- NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- db,
- parent_abspath,
- scratch_pool, scratch_pool));
- if (parent_status == svn_wc__db_status_copied
- || parent_status == svn_wc__db_status_moved_here
- || parent_status == svn_wc__db_status_normal)
- {
- /* The parent is copied/moved here, so WORK_DEL_ABSPATH
- is the root of a deleted subtree. Our COPIED status
- is now dependent upon whether the copied root is
- replacing a BASE tree or not.
-
- But: if we are schedule-delete as a result of being
- a copied DELETED node, then *always* mark COPIED.
- Normal copies have cmt_* data; copied DELETED nodes
- are missing this info.
-
- Note: MOVED_HERE is a concept foreign to this old
- interface, but it is best represented as if a copy
- had occurred, so we'll model it that way to old
- clients.
-
- Note: svn_wc__db_status_normal corresponds to the
- post-commit parent that was copied or moved in
- WORKING but has now been converted to BASE.
- */
- if (SVN_IS_VALID_REVNUM(entry->cmt_rev))
- {
- /* The scan_deletion call will tell us if there
- was an explicit move-away of an ancestor (which
- also means a replacement has occurred since
- there is a WORKING tree that isn't simply
- BASE deletions). The call will also tell us if
- there was an implicit deletion caused by a
- replacement. All stored in BASE_REPLACED. */
- entry->copied = base_replaced;
- }
- else
- {
- entry->copied = TRUE;
- }
- }
- else
- {
- SVN_ERR_ASSERT(parent_status == svn_wc__db_status_added);
-
- /* Whoops. WORK_DEL_ABSPATH is scheduled for deletion,
- yet the parent is scheduled for a plain addition.
- This can occur when a subtree is deleted, and then
- nodes are added *later*. Since the parent is a simple
- add, then nothing has been copied. Nothing more to do.
-
- Note: if a subtree is added, *then* deletions are
- made, the nodes should simply be removed from
- version control. */
- }
- }
- }
-
return SVN_NO_ERROR;
}
@@ -688,9 +527,18 @@ read_one_entry(const svn_wc_entry_t **ne
else if (status == svn_wc__db_status_deleted)
{
svn_node_kind_t path_kind;
+ const char *work_del_abspath;
+
/* ### we don't have to worry about moves, so this is a delete. */
entry->schedule = svn_wc_schedule_delete;
+ SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
+ &work_del_abspath,
+ db, entry_abspath,
+ scratch_pool, scratch_pool));
+ if (work_del_abspath)
+ entry->copied = TRUE;
+
/* If there is still a directory on-disk we keep it, if not it is
already deleted. Simple, isn't it?
@@ -1738,7 +1586,7 @@ write_entry(struct write_baton **entry_n
apr_pool_t *scratch_pool)
{
db_base_node_t *base_node = NULL;
- db_working_node_t *working_node = NULL;
+ db_working_node_t *working_node = NULL, *below_working_node = NULL;
db_actual_node_t *actual_node = NULL;
const char *parent_relpath;
@@ -1832,6 +1680,11 @@ write_entry(struct write_baton **entry_n
switch (entry->schedule)
{
case svn_wc_schedule_normal:
+ SVN_ERR_ASSERT(!parent_node
+ || (parent_node->base && !parent_node->work
+ && !entry->copied)
+ || (!parent_node->base && parent_node->work
+ && entry->copied));
if (entry->copied)
working_node = MAYBE_ALLOC(working_node, result_pool);
else
@@ -1839,26 +1692,26 @@ write_entry(struct write_baton **entry_n
break;
case svn_wc_schedule_add:
+ SVN_ERR_ASSERT((parent_node->base && !parent_node->work)
+ || (parent_node->work && !parent_node->base));
working_node = MAYBE_ALLOC(working_node, result_pool);
break;
case svn_wc_schedule_delete:
+ SVN_ERR_ASSERT(!entry->copied);
working_node = MAYBE_ALLOC(working_node, result_pool);
- /* If the entry is part of a REPLACED (not COPIED) subtree,
- then it needs a BASE node. */
- if (parent_node->base
- && (! (entry->copied
- || (this_dir->copied
- && (this_dir->schedule == svn_wc_schedule_add ||
- this_dir->schedule == svn_wc_schedule_delete ||
- this_dir->schedule == svn_wc_schedule_replace)))))
+ if (parent_node->base)
base_node = MAYBE_ALLOC(base_node, result_pool);
break;
case svn_wc_schedule_replace:
+ SVN_ERR_ASSERT((parent_node->base && !parent_node->work)
+ || (parent_node->work && !parent_node->base));
working_node = MAYBE_ALLOC(working_node, result_pool);
if (parent_node->base)
base_node = MAYBE_ALLOC(base_node, result_pool);
+ else
+ below_working_node = MAYBE_ALLOC(below_working_node, scratch_pool);
break;
}
@@ -1866,15 +1719,19 @@ write_entry(struct write_baton **entry_n
BASE node to indicate the not-present node. */
if (entry->deleted)
{
- base_node = MAYBE_ALLOC(base_node, result_pool);
+ SVN_ERR_ASSERT(base_node && !working_node && !below_working_node);
+ SVN_ERR_ASSERT(!entry->incomplete);
+ base_node->presence = svn_wc__db_status_not_present;
}
- if (entry->copied)
+ if (entry->absent)
{
- /* Make sure we get a WORKING_NODE inserted. The copyfrom information
- will occur here or on a parent, as appropriate. */
- working_node = MAYBE_ALLOC(working_node, result_pool);
+ SVN_ERR_ASSERT(base_node && !working_node);
+ base_node->presence = svn_wc__db_status_absent;
+ }
+ if (entry->copied)
+ {
if (entry->copyfrom_url)
{
const char *relative_url;
@@ -1915,20 +1772,6 @@ write_entry(struct write_baton **entry_n
scratch_pool));
}
- if (entry->keep_local)
- {
- SVN_ERR_ASSERT(working_node != NULL);
- SVN_ERR_ASSERT(entry->schedule == svn_wc_schedule_delete);
- working_node->keep_local = TRUE;
- }
-
- if (entry->absent)
- {
- SVN_ERR_ASSERT(working_node == NULL);
- SVN_ERR_ASSERT(base_node != NULL);
- base_node->presence = svn_wc__db_status_absent;
- }
-
if (entry->conflict_old)
{
actual_node = MAYBE_ALLOC(actual_node, scratch_pool);
@@ -1983,8 +1826,6 @@ write_entry(struct write_baton **entry_n
if (entry->deleted)
{
- SVN_ERR_ASSERT(!entry->incomplete);
-
base_node->presence = svn_wc__db_status_not_present;
/* ### should be svn_node_unknown, but let's store what we have. */
base_node->kind = entry->kind;
@@ -2014,7 +1855,10 @@ write_entry(struct write_baton **entry_n
}
}
- if (entry->kind == svn_node_dir)
+ /* If there is a WORKING node file then we don't have the
+ revert-base checksum for this file. It will get updated
+ later when we transfer the pristine texts. */
+ if (entry->kind == svn_node_dir || working_node)
base_node->checksum = NULL;
else
SVN_ERR(svn_checksum_parse_hex(&base_node->checksum, svn_checksum_md5,
@@ -2102,6 +1946,40 @@ write_entry(struct write_baton **entry_n
}
}
+#ifdef SVN_WC__OP_DEPTH
+ if (below_working_node)
+ {
+ below_working_node->wc_id = wc_id;
+ below_working_node->local_relpath = local_relpath;
+ below_working_node->op_depth = parent_node->work->op_depth;
+ below_working_node->parent_relpath = parent_relpath;
+ below_working_node->presence = svn_wc__db_status_normal;
+ below_working_node->kind = svn_node_file;
+ below_working_node->copyfrom_repos_id
+ = parent_node->work->copyfrom_repos_id;
+ below_working_node->copyfrom_repos_path
+ = svn_relpath_join(parent_node->work->copyfrom_repos_path, entry->name,
+ scratch_pool);
+ below_working_node->copyfrom_revnum
+ = parent_node->work->copyfrom_revnum;
+ below_working_node->moved_here = FALSE;
+ below_working_node->moved_to = FALSE;
+
+ /* We have a problem, the revert_base information isn't
+ available in the entry structure. The checksum will get
+ updated later when we transfer the pristines. */
+ below_working_node->checksum = NULL;
+ below_working_node->translated_size = 0;
+ below_working_node->changed_rev = SVN_INVALID_REVNUM;
+ below_working_node->changed_date = 0;
+ below_working_node->changed_author = NULL;
+ below_working_node->depth = svn_depth_infinity;
+ below_working_node->last_mod_time = 0;
+ below_working_node->properties = NULL;
+ SVN_ERR(insert_working_node(sdb, below_working_node, scratch_pool));
+ }
+#endif
+
/* Insert the working node. */
if (working_node)
{
@@ -2217,7 +2095,7 @@ write_entry(struct write_baton **entry_n
if (entry_node)
{
- *entry_node = apr_palloc(result_pool, sizeof(*entry_node));
+ *entry_node = apr_palloc(result_pool, sizeof(**entry_node));
(*entry_node)->base = base_node;
(*entry_node)->work = working_node;
}
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/node.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/node.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/node.c Sun Dec 12 16:43:42 2010
@@ -984,7 +984,7 @@ svn_wc__node_get_working_rev_info(svn_re
const char *base_del_abspath;
SVN_ERR(svn_wc__db_scan_deletion(&base_del_abspath, NULL,
- NULL, &work_del_abspath, wc_ctx->db,
+ &work_del_abspath, wc_ctx->db,
local_abspath, scratch_pool,
scratch_pool));
if (work_del_abspath)
@@ -1075,7 +1075,7 @@ svn_wc__node_get_commit_base_rev(svn_rev
const char *parent_abspath;
svn_wc__db_status_t parent_status;
- SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL, NULL,
+ SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
&work_del_abspath,
wc_ctx->db, local_abspath,
scratch_pool, scratch_pool));
@@ -1263,9 +1263,7 @@ svn_wc__internal_node_get_schedule(svn_w
break;
/* Find out details of our deletion. */
- SVN_ERR(svn_wc__db_scan_deletion(NULL,
- NULL,
- NULL,
+ SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
&work_del_abspath,
db, local_abspath,
scratch_pool, scratch_pool));
@@ -1273,11 +1271,7 @@ svn_wc__internal_node_get_schedule(svn_w
if (!work_del_abspath)
break; /* Base deletion */
- /* We miss the 4th tree to properly find out if this is
- the root of a working-delete. Only in that case
- should copied be set to true. See entries.c for details. */
-
- *copied = FALSE; /* Until we can fix this test */
+ *copied = TRUE;
break;
}
case svn_wc__db_status_added:
@@ -1472,3 +1466,29 @@ svn_wc__node_get_info_bits(apr_time_t *t
return SVN_NO_ERROR;
}
+
+svn_error_t *
+svn_wc__get_mergeinfo_walk_info(svn_boolean_t *is_present,
+ svn_boolean_t *is_deleted,
+ svn_boolean_t *is_absent,
+ svn_depth_t *depth,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_status_t status;
+
+ SVN_ERR(svn_wc__db_read_info(&status,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, depth, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ wc_ctx->db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ *is_present = (status != svn_wc__db_status_not_present);
+ *is_deleted = (status == svn_wc__db_status_deleted);
+ *is_absent = (status == svn_wc__db_status_absent);
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/props.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/props.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/props.c Sun Dec 12 16:43:42 2010
@@ -836,7 +836,7 @@ maybe_generate_propconflict(svn_boolean_
(mergestream, diff, the_val, working_val, new_val,
NULL, NULL, NULL, NULL,
svn_diff_conflict_display_modified_latest, filepool));
- svn_stream_close(mergestream);
+ SVN_ERR(svn_stream_close(mergestream));
}
}
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/status.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/status.c Sun Dec 12 16:43:42 2010
@@ -2305,7 +2305,7 @@ svn_wc_get_status_editor5(const svn_delt
{
apr_array_header_t *ignores;
- svn_wc_get_default_ignores(&ignores, NULL, result_pool);
+ SVN_ERR(svn_wc_get_default_ignores(&ignores, NULL, result_pool));
eb->ignores = ignores;
}
@@ -2375,7 +2375,7 @@ svn_wc_walk_status(svn_wc_context_t *wc_
{
apr_array_header_t *ignores;
- svn_wc_get_default_ignores(&ignores, NULL, scratch_pool);
+ SVN_ERR(svn_wc_get_default_ignores(&ignores, NULL, scratch_pool));
ignore_patterns = ignores;
}
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/update_editor.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/update_editor.c Sun Dec 12 16:43:42 2010
@@ -3460,8 +3460,7 @@ apply_textdelta(void *file_baton,
fb->edit_baton->db,
fb->local_abspath,
pool, pool));
- recorded_base_checksum
- = checksum ? svn_checksum_to_cstring(checksum, pool) : NULL;
+ recorded_base_checksum = svn_checksum_to_cstring(checksum, pool);
if (recorded_base_checksum && expected_base_checksum
&& strcmp(expected_base_checksum, recorded_base_checksum) != 0)
return svn_error_createf(SVN_ERR_WC_CORRUPT_TEXT_BASE, NULL,
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/upgrade.c?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/upgrade.c Sun Dec 12 16:43:42 2010
@@ -1026,10 +1026,13 @@ bump_to_18(void *baton, svn_sqlite__db_t
return SVN_NO_ERROR;
}
-
+/* If DIR_RELPATH is set then any .svn-revert files will trigger an
+ attempt to update the checksum in a NODES row below the top WORKING
+ node. */
static svn_error_t *
migrate_text_bases(const char *dir_abspath,
const char *new_wcroot_abspath,
+ const char *dir_relpath,
svn_sqlite__db_t *sdb,
apr_pool_t *scratch_pool)
{
@@ -1098,6 +1101,52 @@ migrate_text_bases(const char *dir_abspa
pristine directory as well as the text-base directory. */
SVN_ERR(svn_io_copy_file(text_base_path, pristine_path, TRUE,
iterpool));
+
+ if (dir_relpath)
+ {
+ apr_size_t len = strlen(text_base_basename);
+ if (len >= sizeof(SVN_WC__REVERT_EXT)
+ && strcmp(text_base_basename
+ + len - sizeof(SVN_WC__REVERT_EXT) - 1,
+ SVN_WC__REVERT_EXT))
+ {
+ /* Assumming this revert-base is not an orphan, the
+ upgrade process will have inserted a NODES row with a
+ null checksum below the top-level working node.
+ Update that checksum now. */
+ apr_int64_t op_depth = -1, wc_id = 1;
+ const char *name
+ = apr_pstrndup(iterpool, text_base_basename,
+ len - sizeof(SVN_WC__REVERT_EXT) + 1);
+ const char *local_relpath = svn_relpath_join(dir_relpath, name,
+ iterpool);
+ svn_boolean_t have_row;
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ STMT_SELECT_NODE_INFO));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ if (have_row)
+ {
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ if (have_row && svn_sqlite__column_is_null(stmt, 6)
+ && !strcmp(svn_sqlite__column_text(stmt, 4, NULL),
+ "file"))
+ op_depth = svn_sqlite__column_int64(stmt, 0);
+ }
+ SVN_ERR(svn_sqlite__reset(stmt));
+ if (op_depth != -1)
+ {
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ STMT_UPDATE_CHECKSUM));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isi", wc_id, local_relpath,
+ op_depth));
+ SVN_ERR(svn_sqlite__bind_checksum(stmt, 4, sha1_checksum,
+ iterpool));
+ SVN_ERR(svn_sqlite__update(NULL, stmt));
+ }
+ }
+ }
}
svn_pool_destroy(iterpool);
@@ -1112,7 +1161,7 @@ bump_to_17(void *baton, svn_sqlite__db_t
const char *wcroot_abspath = ((struct bump_baton *)baton)->wcroot_abspath;
SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_17));
- SVN_ERR(migrate_text_bases(wcroot_abspath, wcroot_abspath, sdb,
+ SVN_ERR(migrate_text_bases(wcroot_abspath, wcroot_abspath, NULL, sdb,
scratch_pool));
return SVN_NO_ERROR;
@@ -1141,6 +1190,29 @@ bump_to_22(void *baton, svn_sqlite__db_t
return SVN_NO_ERROR;
}
+#if SVN_WC__VERSION >= 23
+static svn_error_t *
+bump_to_23(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
+{
+ const char *wcroot_abspath = ((struct bump_baton *)baton)->wcroot_abspath;
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t have_row;
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_HAS_WORKING_NODES));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ SVN_ERR(svn_sqlite__reset(stmt));
+ if (have_row)
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("The working copy at '%s' is format 22 with "
+ "WORKING nodes; use a format 22 client to "
+ "diff/revert before using this client"),
+ wcroot_abspath);
+
+ SVN_ERR(svn_sqlite__exec_statements(sdb, STMT_UPGRADE_TO_23));
+ return SVN_NO_ERROR;
+}
+#endif
+
struct upgrade_data_t {
svn_sqlite__db_t *sdb;
@@ -1180,6 +1252,7 @@ upgrade_to_wcng(void **dir_baton,
svn_node_kind_t logfile_on_disk;
apr_hash_t *entries;
svn_wc_entry_t *this_dir;
+ const char *old_wcroot_abspath, *dir_relpath;
/* Don't try to mess with the WC if there are old log files left. */
@@ -1276,14 +1349,13 @@ upgrade_to_wcng(void **dir_baton,
/***** WC PROPS *****/
/* Ugh. We don't know precisely where the wcprops are. Ignore them. */
+ old_wcroot_abspath = svn_dirent_get_longest_ancestor(dir_abspath,
+ data->root_abspath,
+ scratch_pool);
+ dir_relpath = svn_dirent_skip_ancestor(old_wcroot_abspath, dir_abspath);
if (old_format != SVN_WC__WCPROPS_LOST)
{
apr_hash_t *all_wcprops;
- const char *old_wcroot_abspath
- = svn_dirent_get_longest_ancestor(dir_abspath, data->root_abspath,
- scratch_pool);
- const char *dir_relpath = svn_dirent_skip_ancestor(old_wcroot_abspath,
- dir_abspath);
if (old_format <= SVN_WC__WCPROPS_MANY_FILES_VERSION)
SVN_ERR(read_many_wcprops(&all_wcprops, dir_abspath,
@@ -1296,8 +1368,8 @@ upgrade_to_wcng(void **dir_baton,
all_wcprops, scratch_pool));
}
- SVN_ERR(migrate_text_bases(dir_abspath, data->root_abspath, data->sdb,
- scratch_pool));
+ SVN_ERR(migrate_text_bases(dir_abspath, data->root_abspath, dir_relpath,
+ data->sdb, scratch_pool));
/* Upgrade all the properties (including "this dir").
@@ -1437,6 +1509,14 @@ svn_wc__upgrade_sdb(int *result_format,
*result_format = 22;
/* FALLTHROUGH */
+#if SVN_WC__VERSION >= 23
+ case 22:
+ SVN_ERR(svn_sqlite__with_transaction(sdb, bump_to_23, &bb,
+ scratch_pool));
+ *result_format = 23;
+ /* FALLTHROUGH */
+#endif
+
/* ### future bumps go here. */
#if 0
case XXX-1:
Modified: subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-metadata.sql?rev=1044847&r1=1044846&r2=1044847&view=diff
==============================================================================
--- subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/diff-optimizations-bytes/subversion/libsvn_wc/wc-metadata.sql Sun Dec 12 16:43:42 2010
@@ -325,42 +325,58 @@ CREATE TABLE NODES (
/* WC state fields */
- /* Is this node "present" or has it been excluded for some reason?
+ /* The tree state of the node.
- In case 'op_depth' is equal to 0, this is part of the BASE tree; in
- that case, all presence values except 'base-deleted' are allowed.
+ ### This applies to SVN_WC__OP_DEPTH, the intended final code!
- In case 'op_depth' is greater than 0, this is part of a layer of
- working nodes; in that case, the following presence values apply:
+ In case 'op_depth' is equal to 0, this node is part of the 'BASE'
+ tree. The 'BASE' represents pristine nodes that are in the
+ repository; it is obtained and modified by commands such as
+ checkout/update/switch.
+
+ In case 'op_depth' is greater than 0, this node is part of a
+ layer of working nodes. The 'WORKING' tree is obtained and
+ modified by commands like delete/copy/revert.
+
+ The 'BASE' and 'WORKING' trees use the same literal values for
+ the 'presence' but the meaning of each value can vary depending
+ on the tree.
+
+ normal: in the 'BASE' tree this is an ordinary node for which we
+ have full information. In the 'WORKING' tree it's an added or
+ copied node for which we have full information.
+
+ not-present: in the 'BASE' tree this is a node that is implied to
+ exist by the parent node, but is not present in the working
+ copy. Typically obtained by delete/commit, or by update to
+ revision in which the node does not exist. In the 'WORKING'
+ tree this is a copy of a 'not-present' node from the 'BASE'
+ tree, and it will be deleted on commit. Such a node cannot be
+ copied directly, but can be copied as a descendant.
+
+ incomplete: in the 'BASE' tree this is an ordinary node for which
+ we do not have full information. Only the name is guaranteed;
+ we may not have all its children, we may not have its checksum,
+ etc. In the 'WORKING' tree this is a copied node for which we
+ do not have the full information. This state is generally
+ obtained when an operation was interrupted.
+
+ base-deleted: not valid in 'BASE' tree. In the 'WORKING' tree
+ this represents a node that is deleted from the tree below the
+ current 'op_depth'. This state is badly named, it should be
+ something like 'deleted'.
+
+ absent: in the 'BASE' tree this is a node that is excluded by
+ authz. The name of the node is known from the parent, but no
+ other information is available. Not valid in the 'WORKING'
+ tree as there is no way to commit such a node.
+
+ excluded: in the 'BASE' tree this node is administratively
+ excluded by the user (sparse WC). In the 'WORKING' tree this
+ is a copy of an excluded node from the 'BASE' tree. Such a
+ node cannot be copied directly but can be copied as a
+ descendant. */
- Only allowed values: normal, not-present, incomplete, base-deleted,
- excluded. (the others do not make sense for the WORKING tree)
-
- normal: this node has been added/copied/moved-here. There may be an
- underlying BASE node at this location, implying this is a replace.
- Scan upwards from here looking for copyfrom or moved_here values
- to detect the type of operation constructing this node.
-
- not-present: the node (or parent) was originally copied or moved-here.
- A subtree of that source has since been deleted. There may be
- underlying BASE node to replace. For a move-here or copy-here, the
- records are simply removed rather than switched to not-present.
- Note this reflects a deletion only. It is not possible move-away
- nodes from the WORKING tree. The purported destination would receive
- a copy from the original source of a copy-here/move-here, or if the
- nodes were plain adds, those nodes would be shifted to that target
- for addition.
-
- incomplete: nodes are being added into the WORKING tree, and the full
- information about this node is not (yet) present.
-
- base-deleted: the underlying BASE node has been marked for deletion due
- to a delete or a move-away (see the moved_to column to determine
- which), and has not been replaced.
-
- excluded: this node is administratively excluded (sparse WC). This must
- be a child (or grandchild etc.) of a copied directory.
- */
presence TEXT NOT NULL,
/* ### JF: For an old-style move, "copyfrom" info stores its source, but a
@@ -649,6 +665,15 @@ PRAGMA user_version = 22;
/* ------------------------------------------------------------------------- */
+/* Format 23 involves no schema changes, it introduces multi-layer
+ op-depth processing for NODES. */
+
+-- STMT_UPGRADE_TO_23
+PRAGMA user_version = 23;
+
+
+/* ------------------------------------------------------------------------- */
+
/* Format YYY introduces new handling for conflict information. */
-- format: YYY