You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2013/08/23 15:12:25 UTC
svn commit: r1516837 [8/13] - in /subversion/branches/reuse-ra-session: ./
build/ac-macros/ build/generator/ build/generator/swig/
build/generator/templates/ contrib/client-side/emacs/ doc/programmer/
notes/http-and-webdav/ subversion/ subversion/bindi...
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/client.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/client.c Fri Aug 23 13:12:18 2013
@@ -32,6 +32,7 @@
#include <apr_network_io.h>
#include <apr_uri.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_types.h"
#include "svn_string.h"
@@ -47,8 +48,6 @@
#include "svn_mergeinfo.h"
#include "svn_version.h"
-#include "svn_private_config.h"
-
#include "private/svn_fspath.h"
#include "private/svn_subr_private.h"
@@ -702,7 +701,7 @@ static svn_error_t *open_session(svn_ra_
N_("Module for accessing a repository using the svn network protocol.")
#endif
-static const char *ra_svn_get_description(void)
+static const char *ra_svn_get_description(apr_pool_t *pool)
{
return _(RA_SVN_DESCRIPTION);
}
@@ -1479,16 +1478,19 @@ static svn_error_t *ra_svn_diff(svn_ra_s
}
-static svn_error_t *ra_svn_log(svn_ra_session_t *session,
- const apr_array_header_t *paths,
- svn_revnum_t start, svn_revnum_t end,
- int limit,
- svn_boolean_t discover_changed_paths,
- svn_boolean_t strict_node_history,
- svn_boolean_t include_merged_revisions,
- const apr_array_header_t *revprops,
- svn_log_entry_receiver_t receiver,
- void *receiver_baton, apr_pool_t *pool)
+static svn_error_t *
+perform_ra_svn_log(svn_error_t **outer_error,
+ svn_ra_session_t *session,
+ const apr_array_header_t *paths,
+ svn_revnum_t start, svn_revnum_t end,
+ int limit,
+ svn_boolean_t discover_changed_paths,
+ svn_boolean_t strict_node_history,
+ svn_boolean_t include_merged_revisions,
+ const apr_array_header_t *revprops,
+ svn_log_entry_receiver_t receiver,
+ void *receiver_baton,
+ apr_pool_t *pool)
{
svn_ra_svn__session_baton_t *sess_baton = session->priv;
svn_ra_svn_conn_t *conn = sess_baton->conn;
@@ -1501,6 +1503,7 @@ static svn_error_t *ra_svn_log(svn_ra_se
svn_boolean_t want_author = FALSE;
svn_boolean_t want_message = FALSE;
svn_boolean_t want_date = FALSE;
+ int nreceived = 0;
SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "log"));
if (paths)
@@ -1562,7 +1565,6 @@ static svn_error_t *ra_svn_log(svn_ra_se
svn_ra_svn_item_t *item;
apr_hash_t *cphash;
svn_revnum_t rev;
- int nreceived;
svn_pool_clear(iterpool);
SVN_ERR(svn_ra_svn__read_item(conn, iterpool, &item));
@@ -1645,9 +1647,14 @@ static svn_error_t *ra_svn_log(svn_ra_se
else
cphash = NULL;
- nreceived = 0;
- if (! (limit && (nest_level == 0) && (++nreceived > limit)))
+ /* Invoke RECEIVER
+ - Except if the server sends more than a >= 1 limit top level items
+ - Or when the callback reported a SVN_ERR_CEASE_INVOCATION
+ in an earlier invocation. */
+ if (! (limit && (nest_level == 0) && (++nreceived > limit))
+ && ! *outer_error)
{
+ svn_error_t *err;
log_entry = svn_log_entry_create(iterpool);
log_entry->changed_paths = cphash;
@@ -1671,7 +1678,15 @@ static svn_error_t *ra_svn_log(svn_ra_se
svn_hash_sets(log_entry->revprops,
SVN_PROP_REVISION_LOG, message);
- SVN_ERR(receiver(receiver_baton, log_entry, iterpool));
+ err = receiver(receiver_baton, log_entry, iterpool);
+ if (err && err->apr_err == SVN_ERR_CEASE_INVOCATION)
+ {
+ *outer_error = svn_error_trace(
+ svn_error_compose_create(*outer_error, err));
+ }
+ else
+ SVN_ERR(err);
+
if (log_entry->has_children)
{
nest_level++;
@@ -1686,10 +1701,41 @@ static svn_error_t *ra_svn_log(svn_ra_se
svn_pool_destroy(iterpool);
/* Read the response. */
- return svn_ra_svn__read_cmd_response(conn, pool, "");
+ return svn_error_trace(svn_ra_svn__read_cmd_response(conn, pool, ""));
+}
+
+static svn_error_t *
+ra_svn_log(svn_ra_session_t *session,
+ const apr_array_header_t *paths,
+ svn_revnum_t start, svn_revnum_t end,
+ int limit,
+ svn_boolean_t discover_changed_paths,
+ svn_boolean_t strict_node_history,
+ svn_boolean_t include_merged_revisions,
+ const apr_array_header_t *revprops,
+ svn_log_entry_receiver_t receiver,
+ void *receiver_baton, apr_pool_t *pool)
+{
+ svn_error_t *outer_error = NULL;
+ svn_error_t *err;
+
+ err = svn_error_trace(perform_ra_svn_log(&outer_error,
+ session, paths,
+ start, end,
+ limit,
+ discover_changed_paths,
+ strict_node_history,
+ include_merged_revisions,
+ revprops,
+ receiver, receiver_baton,
+ pool));
+ return svn_error_trace(
+ svn_error_compose_create(outer_error,
+ err));
}
+
static svn_error_t *ra_svn_check_path(svn_ra_session_t *session,
const char *path, svn_revnum_t rev,
svn_node_kind_t *kind, apr_pool_t *pool)
@@ -1963,7 +2009,7 @@ static svn_error_t *ra_svn_get_file_revs
{
svn_stream_t *stream;
- if (d_handler)
+ if (d_handler && d_handler != svn_delta_noop_window_handler)
stream = svn_txdelta_parse_svndiff(d_handler, d_baton, TRUE,
rev_pool);
else
@@ -2730,7 +2776,7 @@ svn_ra_svn__init(const svn_version_t *lo
{ NULL, NULL }
};
- SVN_ERR(svn_ver_check_list(svn_ra_svn_version(), checklist));
+ SVN_ERR(svn_ver_check_list2(svn_ra_svn_version(), checklist, svn_ver_equal));
/* Simplified version check to make sure we can safely use the
VTABLE parameter. The RA loader does a more exhaustive check. */
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/editorp.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/editorp.c Fri Aug 23 13:12:18 2013
@@ -28,6 +28,7 @@
#include <apr_general.h>
#include <apr_strings.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_types.h"
#include "svn_string.h"
@@ -37,7 +38,6 @@
#include "svn_ra_svn.h"
#include "svn_path.h"
#include "svn_pools.h"
-#include "svn_private_config.h"
#include "private/svn_fspath.h"
#include "private/svn_editor.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/marshal.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_ra_svn/marshal.c Fri Aug 23 13:12:18 2013
@@ -32,13 +32,13 @@
#include <apr_lib.h>
#include <apr_strings.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_types.h"
#include "svn_string.h"
#include "svn_error.h"
#include "svn_pools.h"
#include "svn_ra_svn.h"
-#include "svn_private_config.h"
#include "svn_ctype.h"
#include "svn_time.h"
@@ -411,7 +411,7 @@ static svn_error_t *readbuf_fill(svn_ra_
return SVN_NO_ERROR;
}
-static APR_INLINE svn_error_t *
+static SVN__FORCE_INLINE svn_error_t *
readbuf_getchar(svn_ra_svn_conn_t *conn, apr_pool_t *pool, char *result)
{
if (conn->read_ptr == conn->read_end)
@@ -1534,6 +1534,58 @@ svn_ra_svn__read_cmd_response(svn_ra_svn
status);
}
+static svn_error_t *
+svn_ra_svn__handle_command(svn_boolean_t *terminate,
+ apr_hash_t *cmd_hash,
+ void *baton,
+ svn_ra_svn_conn_t *conn,
+ svn_boolean_t error_on_disconnect,
+ apr_pool_t *iterpool)
+{
+ const char *cmdname;
+ svn_error_t *err, *write_err;
+ apr_array_header_t *params;
+ const svn_ra_svn_cmd_entry_t *command;
+
+ err = svn_ra_svn__read_tuple(conn, iterpool, "wl", &cmdname, ¶ms);
+ if (err)
+ {
+ if (!error_on_disconnect
+ && err->apr_err == SVN_ERR_RA_SVN_CONNECTION_CLOSED)
+ {
+ svn_error_clear(err);
+ *terminate = TRUE;
+ return SVN_NO_ERROR;
+ }
+ return err;
+ }
+ command = svn_hash_gets(cmd_hash, cmdname);
+
+ if (command)
+ err = (*command->handler)(conn, iterpool, params, baton);
+ else
+ {
+ err = svn_error_createf(SVN_ERR_RA_SVN_UNKNOWN_CMD, NULL,
+ _("Unknown editor command '%s'"), cmdname);
+ err = svn_error_create(SVN_ERR_RA_SVN_CMD_ERR, err, NULL);
+ }
+
+ if (err && err->apr_err == SVN_ERR_RA_SVN_CMD_ERR)
+ {
+ write_err = svn_ra_svn__write_cmd_failure(
+ conn, iterpool,
+ svn_ra_svn__locate_real_error_child(err));
+ svn_error_clear(err);
+ if (write_err)
+ return write_err;
+ }
+ else if (err)
+ return err;
+
+ *terminate = (command && command->terminate);
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_ra_svn__handle_commands2(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
@@ -1543,10 +1595,7 @@ svn_ra_svn__handle_commands2(svn_ra_svn_
{
apr_pool_t *subpool = svn_pool_create(pool);
apr_pool_t *iterpool = svn_pool_create(subpool);
- const char *cmdname;
const svn_ra_svn_cmd_entry_t *command;
- svn_error_t *err, *write_err;
- apr_array_header_t *params;
apr_hash_t *cmd_hash = apr_hash_make(subpool);
for (command = commands; command->cmdname; command++)
@@ -1554,43 +1603,18 @@ svn_ra_svn__handle_commands2(svn_ra_svn_
while (1)
{
+ svn_boolean_t terminate;
+ svn_error_t *err;
svn_pool_clear(iterpool);
- err = svn_ra_svn__read_tuple(conn, iterpool, "wl", &cmdname, ¶ms);
- if (err)
- {
- if (!error_on_disconnect
- && err->apr_err == SVN_ERR_RA_SVN_CONNECTION_CLOSED)
- {
- svn_error_clear(err);
- svn_pool_destroy(subpool);
- return SVN_NO_ERROR;
- }
- return err;
- }
- command = svn_hash_gets(cmd_hash, cmdname);
-
- if (command)
- err = (*command->handler)(conn, iterpool, params, baton);
- else
- {
- err = svn_error_createf(SVN_ERR_RA_SVN_UNKNOWN_CMD, NULL,
- _("Unknown editor command '%s'"), cmdname);
- err = svn_error_create(SVN_ERR_RA_SVN_CMD_ERR, err, NULL);
- }
- if (err && err->apr_err == SVN_ERR_RA_SVN_CMD_ERR)
+ err = svn_ra_svn__handle_command(&terminate, cmd_hash, baton, conn,
+ error_on_disconnect, iterpool);
+ if (err)
{
- write_err = svn_ra_svn__write_cmd_failure(
- conn, iterpool,
- svn_ra_svn__locate_real_error_child(err));
- svn_error_clear(err);
- if (write_err)
- return write_err;
+ svn_pool_destroy(subpool);
+ return svn_error_trace(err);
}
- else if (err)
- return err;
-
- if (command && command->terminate)
+ if (terminate)
break;
}
svn_pool_destroy(iterpool);
@@ -2404,7 +2428,7 @@ svn_ra_svn__write_data_log_entry(svn_ra_
const svn_string_t *message,
svn_boolean_t has_children,
svn_boolean_t invalid_revnum,
- int revprop_count)
+ unsigned revprop_count)
{
SVN_ERR(write_tuple_revision(conn, pool, revision));
SVN_ERR(write_tuple_start_list(conn, pool));
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/authz.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/authz.c Fri Aug 23 13:12:18 2013
@@ -26,6 +26,7 @@
#include <apr_pools.h>
#include <apr_file_io.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_error.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/commit.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/commit.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/commit.c Fri Aug 23 13:12:18 2013
@@ -26,6 +26,7 @@
#include <apr_pools.h>
#include <apr_file_io.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_compat.h"
#include "svn_pools.h"
@@ -39,7 +40,6 @@
#include "svn_ctype.h"
#include "svn_props.h"
#include "svn_mergeinfo.h"
-#include "svn_private_config.h"
#include "repos.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/delta.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/delta.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/delta.c Fri Aug 23 13:12:18 2013
@@ -24,6 +24,7 @@
#include <apr_hash.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_types.h"
#include "svn_delta.h"
@@ -33,7 +34,6 @@
#include "svn_repos.h"
#include "svn_pools.h"
#include "svn_props.h"
-#include "svn_private_config.h"
#include "repos.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/deprecated.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/deprecated.c Fri Aug 23 13:12:18 2013
@@ -26,13 +26,12 @@
deprecated functions in this file. */
#define SVN_DEPRECATED
+#include "svn_private_config.h"
#include "svn_repos.h"
#include "svn_compat.h"
#include "svn_hash.h"
#include "svn_props.h"
-#include "svn_private_config.h"
-
#include "repos.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/dump.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/dump.c Fri Aug 23 13:12:18 2013
@@ -1384,6 +1384,7 @@ verify_one_revision(svn_fs_t *fs,
&cancel_edit_baton,
scratch_pool));
SVN_ERR(svn_fs_revision_root(&to_root, fs, rev, scratch_pool));
+ SVN_ERR(svn_fs_verify_root(to_root, scratch_pool));
SVN_ERR(svn_repos_replay2(to_root, "", SVN_INVALID_REVNUM, FALSE,
cancel_editor, cancel_edit_baton,
NULL, NULL, scratch_pool));
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/fs-wrap.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/fs-wrap.c Fri Aug 23 13:12:18 2013
@@ -24,6 +24,7 @@
#include <string.h>
#include <ctype.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_error.h"
@@ -34,7 +35,7 @@
#include "svn_time.h"
#include "svn_sorts.h"
#include "repos.h"
-#include "svn_private_config.h"
+
#include "private/svn_repos_private.h"
#include "private/svn_utf_private.h"
#include "private/svn_fspath.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/hooks.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/hooks.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/hooks.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/hooks.c Fri Aug 23 13:12:18 2013
@@ -27,6 +27,7 @@
#include <apr_pools.h>
#include <apr_file_io.h>
+#include "svn_private_config.h"
#include "svn_config.h"
#include "svn_hash.h"
#include "svn_error.h"
@@ -36,7 +37,7 @@
#include "svn_repos.h"
#include "svn_utf.h"
#include "repos.h"
-#include "svn_private_config.h"
+
#include "private/svn_fs_private.h"
#include "private/svn_repos_private.h"
#include "private/svn_string_private.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/load-fs-vtable.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/load-fs-vtable.c Fri Aug 23 13:12:18 2013
@@ -99,6 +99,9 @@ struct revision_baton
apr_int32_t rev_offset;
svn_boolean_t skipped;
+ /* Array of svn_prop_t with revision properties. */
+ apr_array_header_t *revprops;
+
struct parse_baton *pb;
apr_pool_t *pool;
};
@@ -448,6 +451,7 @@ make_revision_baton(apr_hash_t *headers,
rb->pb = pb;
rb->pool = pool;
rb->rev = SVN_INVALID_REVNUM;
+ rb->revprops = apr_array_make(rb->pool, 8, sizeof(svn_prop_t));
if ((val = svn_hash_gets(headers, SVN_REPOS_DUMPFILE_REVISION_NUMBER)))
{
@@ -698,10 +702,12 @@ set_revision_property(void *baton,
if (rb->rev > 0)
{
- if (rb->pb->validate_props)
- SVN_ERR(svn_repos_fs_change_txn_prop(rb->txn, name, value, rb->pool));
- else
- SVN_ERR(svn_fs_change_txn_prop(rb->txn, name, value, rb->pool));
+ svn_prop_t *prop = &APR_ARRAY_PUSH(rb->revprops, svn_prop_t);
+
+ /* Collect property changes to apply them in one FS call in
+ close_revision. */
+ prop->name = apr_pstrdup(rb->pool, name);
+ prop->value = svn_string_dup(value, rb->pool);
/* Remember any datestamp that passes through! (See comment in
close_revision() below.) */
@@ -920,6 +926,21 @@ close_revision(void *baton)
if (rb->skipped || (rb->rev <= 0))
return SVN_NO_ERROR;
+ if (!rb->datestamp)
+ {
+ /* Remove 'svn:date' revision property that was set by FS layer when TXN
+ created if source dump doesn't have 'svn:date' property. */
+ svn_prop_t *prop = &APR_ARRAY_PUSH(rb->revprops, svn_prop_t);
+ prop->name = SVN_PROP_REVISION_DATE;
+ prop->value = NULL;
+ }
+
+ /* Apply revision property changes. */
+ if (rb->pb->validate_props)
+ SVN_ERR(svn_repos_fs_change_txn_props(rb->txn, rb->revprops, rb->pool));
+ else
+ SVN_ERR(svn_fs_change_txn_props(rb->txn, rb->revprops, rb->pool));
+
/* Get the txn name and hooks environment if they will be needed. */
if (pb->use_pre_commit_hook || pb->use_post_commit_hook)
{
@@ -947,7 +968,8 @@ close_revision(void *baton)
}
/* Commit. */
- err = svn_fs_commit_txn(&conflict_msg, &committed_rev, rb->txn, rb->pool);
+ err = svn_fs_commit_txn2(&conflict_msg, &committed_rev, rb->txn, FALSE,
+ rb->pool);
if (SVN_IS_VALID_REVNUM(committed_rev))
{
if (err)
@@ -1005,15 +1027,6 @@ close_revision(void *baton)
/* Deltify the predecessors of paths changed in this revision. */
SVN_ERR(svn_fs_deltify_revision(pb->fs, committed_rev, rb->pool));
- /* Grrr, svn_fs_commit_txn rewrites the datestamp property to the
- current clock-time. We don't want that, we want to preserve
- history exactly. Good thing revision props aren't versioned!
- Note that if rb->datestamp is NULL, that's fine -- if the dump
- data doesn't carry a datestamp, we want to preserve that fact in
- the load. */
- SVN_ERR(change_rev_prop(pb->repos, committed_rev, SVN_PROP_REVISION_DATE,
- rb->datestamp, pb->validate_props, rb->pool));
-
if (pb->notify_func)
{
pb->notify->action = svn_repos_notify_load_txn_committed;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/log.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/log.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/log.c Fri Aug 23 13:12:18 2013
@@ -25,8 +25,8 @@
#define APR_WANT_STRFUNC
#include <apr_want.h>
-#include "svn_compat.h"
#include "svn_private_config.h"
+#include "svn_compat.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_error.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/replay.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/replay.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/replay.c Fri Aug 23 13:12:18 2013
@@ -25,6 +25,7 @@
#include <apr_hash.h>
+#include "svn_private_config.h"
#include "svn_types.h"
#include "svn_delta.h"
#include "svn_hash.h"
@@ -35,7 +36,7 @@
#include "svn_props.h"
#include "svn_pools.h"
#include "svn_path.h"
-#include "svn_private_config.h"
+
#include "private/svn_fspath.h"
#include "private/svn_repos_private.h"
#include "private/svn_delta_private.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/reporter.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/reporter.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/reporter.c Fri Aug 23 13:12:18 2013
@@ -21,6 +21,7 @@
* ====================================================================
*/
+#include "svn_private_config.h"
#include "svn_dirent_uri.h"
#include "svn_hash.h"
#include "svn_path.h"
@@ -32,7 +33,6 @@
#include "svn_pools.h"
#include "svn_props.h"
#include "repos.h"
-#include "svn_private_config.h"
#include "private/svn_dep_compat.h"
#include "private/svn_fspath.h"
@@ -499,7 +499,7 @@ get_revision_info(report_baton_t *b,
info->author = author ? svn_string_dup(author, b->pool) : NULL;
/* Cache it */
- apr_hash_set(b->revision_infos, &info->rev, sizeof(rev), info);
+ apr_hash_set(b->revision_infos, &info->rev, sizeof(info->rev), info);
}
*revision_info = info;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/repos.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/repos.c Fri Aug 23 13:12:18 2013
@@ -23,6 +23,7 @@
#include <apr_pools.h>
#include <apr_file_io.h>
+#include "svn_private_config.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_dirent_uri.h"
@@ -38,7 +39,6 @@
#include "private/svn_repos_private.h"
#include "private/svn_subr_private.h"
-#include "svn_private_config.h" /* for SVN_TEMPLATE_ROOT_DIR */
#include "repos.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/rev_hunt.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/rev_hunt.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/rev_hunt.c Fri Aug 23 13:12:18 2013
@@ -23,8 +23,9 @@
#include <string.h>
-#include "svn_compat.h"
+
#include "svn_private_config.h"
+#include "svn_compat.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_error.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/auth.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/auth.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/auth.c Fri Aug 23 13:12:18 2013
@@ -26,13 +26,13 @@
#include <apr_tables.h>
#include <apr_strings.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_types.h"
#include "svn_string.h"
#include "svn_error.h"
#include "svn_auth.h"
#include "svn_config.h"
-#include "svn_private_config.h"
#include "svn_dso.h"
#include "svn_version.h"
#include "private/svn_dep_compat.h"
@@ -481,7 +481,8 @@ svn_auth_get_platform_specific_provider(
check_list[0].version_query = version_function;
check_list[1].label = NULL;
check_list[1].version_query = NULL;
- SVN_ERR(svn_ver_check_list(svn_subr_version(), check_list));
+ SVN_ERR(svn_ver_check_list2(svn_subr_version(), check_list,
+ svn_ver_equal));
}
if (apr_dso_sym(&provider_function_symbol,
dso,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-inprocess.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-inprocess.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-inprocess.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-inprocess.c Fri Aug 23 13:12:18 2013
@@ -246,6 +246,37 @@ inprocess_cache_get(void **value_p,
return SVN_NO_ERROR;
}
+static svn_error_t *
+inprocess_cache_has_key_internal(svn_boolean_t *found,
+ inprocess_cache_t *cache,
+ const void *key,
+ apr_pool_t *scratch_pool)
+{
+ *found = apr_hash_get(cache->hash, key, cache->klen) != NULL;
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+inprocess_cache_has_key(svn_boolean_t *found,
+ void *cache_void,
+ const void *key,
+ apr_pool_t *scratch_pool)
+{
+ inprocess_cache_t *cache = cache_void;
+
+ if (key)
+ SVN_MUTEX__WITH_LOCK(cache->mutex,
+ inprocess_cache_has_key_internal(found,
+ cache,
+ key,
+ scratch_pool));
+ else
+ *found = FALSE;
+
+ return SVN_NO_ERROR;
+}
+
/* Removes PAGE from the LRU list, removes all of its entries from
* CACHE's hash, clears its pool, and sets its entry pointer to NULL.
* Finally, puts it in the "partial page" slot in the cache and sets
@@ -604,6 +635,7 @@ inprocess_cache_get_info(void *cache_voi
static svn_cache__vtable_t inprocess_cache_vtable = {
inprocess_cache_get,
+ inprocess_cache_has_key,
inprocess_cache_set,
inprocess_cache_iter,
inprocess_cache_is_cachable,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-membuffer.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-membuffer.c Fri Aug 23 13:12:18 2013
@@ -361,6 +361,10 @@ typedef struct entry_t
*/
apr_uint32_t previous;
+ /* Priority of this entry. This entry will not be replaced by lower-
+ * priority items.
+ */
+ apr_uint32_t priority;
#ifdef SVN_DEBUG_CACHE_MEMBUFFER
/* Remember type, content and key hashes.
*/
@@ -1013,13 +1017,15 @@ find_entry(svn_membuffer_t *cache,
if (group->used == GROUP_SIZE)
{
/* every entry gets the same chance of being removed.
- * Otherwise, we free the first entry, fill it and
- * remove it again on the next occasion without considering
- * the other entries in this group.
+ * Otherwise, we free the first entry, fill it and remove it
+ * again on the next occasion without considering the other
+ * entries in this group. Also, apply priorities strictly.
*/
entry = &group->entries[rand() % GROUP_SIZE];
for (i = 1; i < GROUP_SIZE; ++i)
- if (entry->hit_count > group->entries[i].hit_count)
+ if ( (entry->priority > group->entries[i].priority)
+ || ( entry->priority == group->entries[i].priority
+ && entry->hit_count > group->entries[i].hit_count))
entry = &group->entries[i];
/* for the entries that don't have been removed,
@@ -1128,6 +1134,16 @@ ensure_data_insertable_l2(svn_membuffer_
apr_uint64_t average_hit_value;
apr_uint64_t threshold;
+ /* accumulated size of the entries that have been removed to make
+ * room for the new one.
+ */
+ apr_size_t moved_size = 0;
+
+ /* count the number of entries that got moved. A single large entry
+ * being moved is not enough to reject an insertion.
+ */
+ apr_size_t moved_count = 0;
+
/* accumulated "worth" of items dropped so far */
apr_size_t drop_hits = 0;
@@ -1159,10 +1175,16 @@ ensure_data_insertable_l2(svn_membuffer_
if (end >= to_fit_in->size + cache->l2.current_data)
return TRUE;
+ /* Don't be too eager to cache data. If a lot of data has been
+ * moved around, the current item has probably a relatively low
+ * priority. So, give up after some time.
+ */
+ if (moved_size > 8 * to_fit_in->size && moved_count > 3)
+ return FALSE;
+
/* if the net worth (in hits) of items removed is already larger
* than what we want to insert, reject TO_FIT_IN because it still
- * does not fit in.
- */
+ * does not fit in. */
if (drop_hits > to_fit_in->hit_count)
return FALSE;
@@ -1180,8 +1202,15 @@ ensure_data_insertable_l2(svn_membuffer_
}
else
{
+ svn_boolean_t keep;
entry = get_entry(cache, cache->l2.next);
+ /* Reject insertion for entries with low priority, if the current
+ * entry has seen recent hits. */
+ if ( entry->hit_count
+ && to_fit_in->priority < SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY)
+ return FALSE;
+
/* Keep entries that are very small. Those are likely to be data
* headers or similar management structures. So, they are probably
* important while not occupying much space.
@@ -1190,56 +1219,75 @@ ensure_data_insertable_l2(svn_membuffer_
if ( (apr_uint64_t)entry->size * cache->used_entries
< cache->data_used / 8)
{
- move_entry(cache, entry);
+ keep = TRUE;
}
else if (cache->l2.next / GROUP_SIZE == idx / GROUP_SIZE)
{
/* Special case: we cannot drop entries that are in the same
- * group as TO_FIT_IN because that might the latter to become
- * invalidated it it happens to be the highest used entry in
- * the group. So, we must keep ENTRY unconditionally.
- * (this is a very rare condition)
- */
- move_entry(cache, entry);
+ * group as TO_FIT_IN because that might the latter to become
+ * invalidated it it happens to be the highest used entry in
+ * the group. So, we must keep ENTRY unconditionally.
+ * (this is a very rare condition)
+ */
+ keep = TRUE;
}
- else
+ else if ( entry->priority < SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY
+ && to_fit_in->priority > entry->priority)
+ {
+ /* Be quick to evict low-priority entries if the one to insert
+ * is of higher priority.
+ */
+ keep = FALSE;
+ }
+ else if (to_fit_in->priority != entry->priority)
+ {
+ /* Not the same priority but the lower prio side is not a
+ * clear loser either (already checked those cases above).
+ * Keep the current entry if it has seen more hits recently
+ * or is smaller than the one to insert - both relative to
+ * their respective priority.
+ */
+ keep = to_fit_in->hit_count * to_fit_in->priority
+ < entry->hit_count * entry->priority
+ || to_fit_in->size * to_fit_in->priority
+ < entry->size * entry->priority;
+ }
+ else if (cache->hit_count > cache->used_entries)
{
- svn_boolean_t keep;
+ /* Roll the dice and determine a threshold somewhere
+ * from 0 up to 2 times the average hit count.
+ */
+ average_hit_value = cache->hit_count / cache->used_entries;
+ threshold = (average_hit_value+1) * (rand() % 4096) / 2048;
- if (cache->hit_count > cache->used_entries)
- {
- /* Roll the dice and determine a threshold somewhere from
- * 0 up to 2 times the average hit count.
- */
- average_hit_value = cache->hit_count / cache->used_entries;
- threshold = (average_hit_value+1) * (rand() % 4096) / 2048;
+ keep = entry->hit_count > threshold;
+ }
+ else
+ {
+ /* general hit count is low. Keep everything that got hit
+ * at all and assign some 50% survival chance to everything
+ * else.
+ */
+ keep = rand() & 1;
+ }
- keep = entry->hit_count >= threshold;
- }
- else
- {
- /* general hit count is low. Keep everything that got
- * hit at all and assign some 50% survival chance to
- * everything else.
- */
- keep = (entry->hit_count > 0) || (rand() & 1);
- }
+ /* keepers or destroyers? */
+ if (keep)
+ {
+ /* Moving entries around is not for free -> track costs. */
+ moved_size += entry->size;
+ moved_count++;
- /* keepers or destroyers? */
- if (keep)
- {
- /* Keep ENTRY and move the insertion window.
- */
- move_entry(cache, entry);
- }
- else
- {
- /* Drop the entry from the end of the insertion window,
- * because it had been hit less than the threshold.
- */
- drop_hits += entry->hit_count;
- drop_entry(cache, entry);
- }
+ move_entry(cache, entry);
+ }
+ else
+ {
+ /* Drop the entry from the end of the insertion window, if it
+ * has been hit less than the threshold. Otherwise, keep it and
+ * move the insertion window one entry further.
+ */
+ drop_hits += entry->hit_count;
+ drop_entry(cache, entry);
}
}
}
@@ -1582,6 +1630,7 @@ membuffer_cache_set_internal(svn_membuff
apr_uint32_t group_index,
char *buffer,
apr_size_t size,
+ apr_uint32_t priority,
DEBUG_CACHE_MEMBUFFER_TAG_ARG
apr_pool_t *scratch_pool)
{
@@ -1594,6 +1643,7 @@ membuffer_cache_set_internal(svn_membuff
{
cache->data_used += size - entry->size;
entry->size = size;
+ entry->priority = priority;
#ifdef SVN_DEBUG_CACHE_MEMBUFFER
@@ -1624,6 +1674,7 @@ membuffer_cache_set_internal(svn_membuff
entry = find_entry(cache, group_index, to_find, TRUE);
entry->size = size;
entry->offset = cache->l1.current_data;
+ entry->priority = priority;
#ifdef SVN_DEBUG_CACHE_MEMBUFFER
@@ -1673,6 +1724,7 @@ membuffer_cache_set(svn_membuffer_t *cac
entry_key_t key,
void *item,
svn_cache__serialize_func_t serializer,
+ apr_uint32_t priority,
DEBUG_CACHE_MEMBUFFER_TAG_ARG
apr_pool_t *scratch_pool)
{
@@ -1697,6 +1749,7 @@ membuffer_cache_set(svn_membuffer_t *cac
group_index,
buffer,
size,
+ priority,
DEBUG_CACHE_MEMBUFFER_TAG
scratch_pool));
return SVN_NO_ERROR;
@@ -1808,6 +1861,43 @@ membuffer_cache_get(svn_membuffer_t *cac
}
/* Look for the cache entry in group GROUP_INDEX of CACHE, identified
+ * by the hash value TO_FIND. If no item has been stored for KEY, *FOUND
+ * will be FALSE and TRUE otherwise.
+ */
+static svn_error_t *
+membuffer_cache_has_key_internal(svn_membuffer_t *cache,
+ apr_uint32_t group_index,
+ entry_key_t to_find,
+ svn_boolean_t *found)
+{
+ *found = find_entry(cache, group_index, to_find, FALSE) != NULL;
+
+ return SVN_NO_ERROR;
+}
+
+/* Look for an entry identified by KEY. If no item has been stored
+ * for KEY, *FOUND will be set to FALSE and TRUE otherwise.
+ */
+/* Implements svn_cache__has_key for membuffer caches.
+ */
+static svn_error_t *
+membuffer_cache_has_key(svn_membuffer_t *cache,
+ entry_key_t key,
+ svn_boolean_t *found)
+{
+ /* find the entry group that will hold the key.
+ */
+ apr_uint32_t group_index = get_group_index(&cache, key);
+ WITH_READ_LOCK(cache,
+ membuffer_cache_has_key_internal(cache,
+ group_index,
+ key,
+ found));
+
+ return SVN_NO_ERROR;
+}
+
+/* Look for the cache entry in group GROUP_INDEX of CACHE, identified
* by the hash value TO_FIND. FOUND indicates whether that entry exists.
* If not found, *ITEM will be NULL.
*
@@ -2097,6 +2187,9 @@ typedef struct svn_membuffer_cache_t
*/
apr_ssize_t key_len;
+ /* priority class for all items written through this interface */
+ apr_uint32_t priority;
+
/* Temporary buffer containing the hash key for the current access
*/
entry_key_t combined_key;
@@ -2291,6 +2384,39 @@ svn_membuffer_cache_get(void **value_p,
/* return result */
*found = *value_p != NULL;
+
+ return SVN_NO_ERROR;
+}
+
+/* Implement svn_cache__vtable_t.has_key (not thread-safe)
+ */
+static svn_error_t *
+svn_membuffer_cache_has_key(svn_boolean_t *found,
+ void *cache_void,
+ const void *key,
+ apr_pool_t *scratch_pool)
+{
+ svn_membuffer_cache_t *cache = cache_void;
+
+ /* special case */
+ if (key == NULL)
+ {
+ *found = FALSE;
+
+ return SVN_NO_ERROR;
+ }
+
+ /* construct the full, i.e. globally unique, key by adding
+ * this cache instances' prefix
+ */
+ combine_key(cache, key, cache->key_len);
+
+ /* Look the item up. */
+ SVN_ERR(membuffer_cache_has_key(cache->membuffer,
+ cache->combined_key,
+ found));
+
+ /* return result */
return SVN_NO_ERROR;
}
@@ -2332,6 +2458,7 @@ svn_membuffer_cache_set(void *cache_void
cache->combined_key,
value,
cache->serializer,
+ cache->priority,
DEBUG_CACHE_MEMBUFFER_TAG
cache->pool);
}
@@ -2488,6 +2615,7 @@ svn_membuffer_cache_get_info(void *cache
*/
static svn_cache__vtable_t membuffer_cache_vtable = {
svn_membuffer_cache_get,
+ svn_membuffer_cache_has_key,
svn_membuffer_cache_set,
svn_membuffer_cache_iter,
svn_membuffer_cache_is_cachable,
@@ -2516,6 +2644,24 @@ svn_membuffer_cache_get_synced(void **va
return SVN_NO_ERROR;
}
+/* Implement svn_cache__vtable_t.has_key and serialize all cache access.
+ */
+static svn_error_t *
+svn_membuffer_cache_has_key_synced(svn_boolean_t *found,
+ void *cache_void,
+ const void *key,
+ apr_pool_t *result_pool)
+{
+ svn_membuffer_cache_t *cache = cache_void;
+ SVN_MUTEX__WITH_LOCK(cache->mutex,
+ svn_membuffer_cache_has_key(found,
+ cache_void,
+ key,
+ result_pool));
+
+ return SVN_NO_ERROR;
+}
+
/* Implement svn_cache__vtable_t.set and serialize all cache access.
*/
static svn_error_t *
@@ -2582,6 +2728,7 @@ svn_membuffer_cache_set_partial_synced(v
*/
static svn_cache__vtable_t membuffer_cache_synced_vtable = {
svn_membuffer_cache_get_synced,
+ svn_membuffer_cache_has_key_synced,
svn_membuffer_cache_set_synced,
svn_membuffer_cache_iter, /* no sync required */
svn_membuffer_cache_is_cachable, /* no sync required */
@@ -2636,6 +2783,7 @@ svn_cache__create_membuffer_cache(svn_ca
svn_cache__deserialize_func_t deserializer,
apr_ssize_t klen,
const char *prefix,
+ apr_uint32_t priority,
svn_boolean_t thread_safe,
apr_pool_t *pool)
{
@@ -2656,6 +2804,7 @@ svn_cache__create_membuffer_cache(svn_ca
? deserializer
: deserialize_svn_stringbuf;
cache->full_prefix = apr_pstrdup(pool, prefix);
+ cache->priority = priority;
cache->key_len = klen;
cache->pool = svn_pool_create(pool);
cache->alloc_counter = 0;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-memcache.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-memcache.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-memcache.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-memcache.c Fri Aug 23 13:12:18 2013
@@ -213,6 +213,26 @@ memcache_get(void **value_p,
return SVN_NO_ERROR;
}
+/* Implement vtable.has_key in terms of the getter.
+ */
+static svn_error_t *
+memcache_has_key(svn_boolean_t *found,
+ void *cache_void,
+ const void *key,
+ apr_pool_t *scratch_pool)
+{
+ char *data;
+ apr_size_t data_len;
+ SVN_ERR(memcache_internal_get(&data,
+ &data_len,
+ found,
+ cache_void,
+ key,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
/* Core functionality of our setter functions: store LENGH bytes of DATA
* to be identified by KEY in the memcached given by CACHE_VOID. Use POOL
* for temporary allocations.
@@ -371,6 +391,7 @@ memcache_get_info(void *cache_void,
static svn_cache__vtable_t memcache_vtable = {
memcache_get,
+ memcache_has_key,
memcache_set,
memcache_iter,
memcache_is_cachable,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache.c Fri Aug 23 13:12:18 2013
@@ -96,6 +96,21 @@ svn_cache__get(void **value_p,
}
svn_error_t *
+svn_cache__has_key(svn_boolean_t *found,
+ svn_cache__t *cache,
+ const void *key,
+ apr_pool_t *scratch_pool)
+{
+ *found = FALSE;
+ return handle_error(cache,
+ (cache->vtable->has_key)(found,
+ cache->cache_internal,
+ key,
+ scratch_pool),
+ scratch_pool);
+}
+
+svn_error_t *
svn_cache__set(svn_cache__t *cache,
const void *key,
void *value,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache.h?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache.h Fri Aug 23 13:12:18 2013
@@ -38,6 +38,12 @@ typedef struct svn_cache__vtable_t {
const void *key,
apr_pool_t *result_pool);
+ /* See svn_cache__has_key(). */
+ svn_error_t *(*has_key)(svn_boolean_t *found,
+ void *cache_implementation,
+ const void *key,
+ apr_pool_t *scratch_pool);
+
/* See svn_cache__set(). */
svn_error_t *(*set)(void *cache_implementation,
const void *key,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/cmdline.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/cmdline.c Fri Aug 23 13:12:18 2013
@@ -42,6 +42,7 @@
#include <apr_strings.h> /* for apr_snprintf */
#include <apr_pools.h>
+#include "svn_private_config.h"
#include "svn_cmdline.h"
#include "svn_ctype.h"
#include "svn_dso.h"
@@ -64,8 +65,6 @@
#include "private/svn_utf_private.h"
#include "private/svn_string_private.h"
-#include "svn_private_config.h"
-
#include "win32_crashrpt.h"
/* The stdin encoding. If null, it's the same as the native encoding. */
@@ -131,30 +130,32 @@ svn_cmdline_init(const char *progname, F
#endif /* _MSC_VER < 1400 */
#ifdef SVN_USE_WIN32_CRASHHANDLER
- /* Attach (but don't load) the crash handler */
- SetUnhandledExceptionFilter(svn__unhandled_exception_filter);
+ if (!getenv("SVN_CMDLINE_DISABLE_CRASH_HANDLER"))
+ {
+ /* Attach (but don't load) the crash handler */
+ SetUnhandledExceptionFilter(svn__unhandled_exception_filter);
#if _MSC_VER >= 1400
- /* ### This should work for VC++ 2002 (=1300) and later */
- /* Show the abort message on STDERR instead of a dialog to allow
- scripts (e.g. our testsuite) to continue after an abort without
- user intervention. Allow overriding for easier debugging. */
- if (!getenv("SVN_CMDLINE_USE_DIALOG_FOR_ABORT"))
- {
- /* In release mode: Redirect abort() errors to stderr */
- _set_error_mode(_OUT_TO_STDERR);
-
- /* In _DEBUG mode: Redirect all debug output (E.g. assert() to stderr.
- (Ignored in release builds) */
- _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR);
- _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR);
- _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR);
- _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
- _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
- _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
- }
-#endif /* _MSC_VER >= 1400 */
+ /* ### This should work for VC++ 2002 (=1300) and later */
+ /* Show the abort message on STDERR instead of a dialog to allow
+ scripts (e.g. our testsuite) to continue after an abort without
+ user intervention. Allow overriding for easier debugging. */
+ if (!getenv("SVN_CMDLINE_USE_DIALOG_FOR_ABORT"))
+ {
+ /* In release mode: Redirect abort() errors to stderr */
+ _set_error_mode(_OUT_TO_STDERR);
+ /* In _DEBUG mode: Redirect all debug output (E.g. assert() to stderr.
+ (Ignored in release builds) */
+ _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ }
+#endif /* _MSC_VER >= 1400 */
+ }
#endif /* SVN_USE_WIN32_CRASHHANDLER */
#endif /* WIN32 */
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/compat.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/compat.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/compat.c Fri Aug 23 13:12:18 2013
@@ -24,6 +24,7 @@
#include <apr_pools.h>
#include <apr_strings.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_types.h"
#include "svn_error.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/config.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/config.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/config.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/config.c Fri Aug 23 13:12:18 2013
@@ -29,12 +29,13 @@
#include <apr_general.h>
#include <apr_lib.h>
+
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_error.h"
#include "svn_pools.h"
#include "config_impl.h"
-#include "svn_private_config.h"
#include "private/svn_dep_compat.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/config_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/config_auth.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/config_auth.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/config_auth.c Fri Aug 23 13:12:18 2013
@@ -23,6 +23,7 @@
+#include "svn_private_config.h"
#include "svn_dirent_uri.h"
#include "svn_hash.h"
#include "svn_io.h"
@@ -31,14 +32,8 @@
#include "auth.h"
-#include "svn_private_config.h"
-
#include "private/svn_auth_private.h"
-/* Helper for svn_config_{read|write}_auth_data. Return a path to a
- file within ~/.subversion/auth/ that holds CRED_KIND credentials
- within REALMSTRING. If no path is available *PATH will be set to
- NULL. */
svn_error_t *
svn_auth__file_path(const char **path,
const char *cred_kind,
@@ -173,12 +168,6 @@ svn_config_walk_auth_data(const char *co
NULL
};
- if (! config_dir)
- {
- /* Can't locate the cache to clear */
- return SVN_NO_ERROR;
- }
-
iterpool = svn_pool_create(scratch_pool);
for (i = 0; cred_kinds[i]; i++)
{
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/config_file.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/config_file.c Fri Aug 23 13:12:18 2013
@@ -838,9 +838,8 @@ svn_config_ensure(const char *config_dir
"### http-max-connections Maximum number of parallel server" NL
"### connections to use for any given" NL
"### HTTP operation." NL
- "### busted-proxy The proxy may have some protocol" NL
- "### issues that Subversion needs to" NL
- "### detect and work around." NL
+ "### http-chunked-requests Whether to use chunked transfer" NL
+ "### encoding for HTTP requests body." NL
"### neon-debug-mask Debug mask for Neon HTTP library" NL
"### ssl-authority-files List of files, each of a trusted CA"
NL
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/deprecated.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/deprecated.c Fri Aug 23 13:12:18 2013
@@ -32,6 +32,7 @@
deprecated functions in this file. */
#define SVN_DEPRECATED
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_subst.h"
#include "svn_path.h"
@@ -48,9 +49,6 @@
#include "private/svn_opt_private.h"
#include "private/svn_mergeinfo_private.h"
-#include "svn_private_config.h"
-
-
/*** Code. ***/
@@ -1301,4 +1299,10 @@ svn_subst_build_keywords(svn_subst_keywo
return SVN_NO_ERROR;
}
-
+/*** From version.c ***/
+svn_error_t *
+svn_ver_check_list(const svn_version_t *my_version,
+ const svn_version_checklist_t *checklist)
+{
+ return svn_ver_check_list2(my_version, checklist, svn_ver_compatible);
+}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/dirent_uri.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/dirent_uri.c Fri Aug 23 13:12:18 2013
@@ -1862,6 +1862,9 @@ svn_uri_is_canonical(const char *uri, ap
#endif /* SVN_USE_DOS_PATHS */
/* Now validate the rest of the URI. */
+ seg = ptr;
+ while (*ptr && (*ptr != '/'))
+ ptr++;
while(1)
{
apr_size_t seglen = ptr - seg;
@@ -1880,9 +1883,8 @@ svn_uri_is_canonical(const char *uri, ap
if (*ptr == '/')
ptr++;
- seg = ptr;
-
+ seg = ptr;
while (*ptr && (*ptr != '/'))
ptr++;
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/dso.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/dso.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/dso.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/dso.c Fri Aug 23 13:12:18 2013
@@ -22,10 +22,10 @@
#include <apr_thread_mutex.h>
#include <apr_hash.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_dso.h"
#include "svn_pools.h"
-#include "svn_private_config.h"
#include "private/svn_mutex.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/error.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/error.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/error.c Fri Aug 23 13:12:18 2013
@@ -110,7 +110,8 @@ make_error_internal(apr_status_t apr_err
pool = child->pool;
else
{
- if (apr_pool_create(&pool, NULL))
+ pool = svn_pool_create(NULL);
+ if (!pool)
abort();
}
@@ -339,7 +340,8 @@ svn_error_dup(svn_error_t *err)
apr_pool_t *pool;
svn_error_t *new_err = NULL, *tmp_err = NULL;
- if (apr_pool_create(&pool, NULL))
+ pool = svn_pool_create(NULL);
+ if (!pool)
abort();
for (; err; err = err->child)
@@ -559,7 +561,7 @@ svn_handle_error2(svn_error_t *err,
preferring apr_pool_*() instead. I can't remember why -- it may
be an artifact of r843793, or it may be for some deeper reason --
but I'm playing it safe and using apr_pool_*() here too. */
- apr_pool_create(&subpool, err->pool);
+ subpool = svn_pool_create(err->pool);
empties = apr_array_make(subpool, 0, sizeof(apr_status_t));
tmp_err = err;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/hash.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/hash.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/hash.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/hash.c Fri Aug 23 13:12:18 2013
@@ -31,6 +31,7 @@
#include <apr_hash.h>
#include <apr_file_io.h>
+#include "svn_private_config.h"
#include "svn_types.h"
#include "svn_string.h"
#include "svn_error.h"
@@ -42,8 +43,6 @@
#include "private/svn_dep_compat.h"
#include "private/svn_subr_private.h"
-#include "svn_private_config.h"
-
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c Fri Aug 23 13:12:18 2013
@@ -55,6 +55,7 @@
#include <fcntl.h>
#endif
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_types.h"
#include "svn_dirent_uri.h"
@@ -65,7 +66,6 @@
#include "svn_pools.h"
#include "svn_utf.h"
#include "svn_config.h"
-#include "svn_private_config.h"
#include "svn_ctype.h"
#include "private/svn_atomic.h"
@@ -1166,9 +1166,11 @@ svn_io_make_dir_recursively(const char *
return SVN_NO_ERROR;
}
-svn_error_t *svn_io_file_create(const char *file,
- const char *contents,
- apr_pool_t *pool)
+svn_error_t *
+svn_io_file_create_binary(const char *file,
+ const char *contents,
+ apr_size_t length,
+ apr_pool_t *pool)
{
apr_file_t *f;
apr_size_t written;
@@ -1178,25 +1180,57 @@ svn_error_t *svn_io_file_create(const ch
(APR_WRITE | APR_CREATE | APR_EXCL),
APR_OS_DEFAULT,
pool));
- if (contents && *contents)
- err = svn_io_file_write_full(f, contents, strlen(contents),
- &written, pool);
+ if (length)
+ err = svn_io_file_write_full(f, contents, length, &written, pool);
+ err = svn_error_compose_create(
+ err,
+ svn_io_file_close(f, pool));
- return svn_error_trace(
- svn_error_compose_create(err,
- svn_io_file_close(f, pool)));
+ if (err)
+ {
+ /* Our caller doesn't know if we left a file or not if we return
+ an error. Better to cleanup after ourselves if we created the
+ file. */
+ return svn_error_trace(
+ svn_error_compose_create(
+ err,
+ svn_io_remove_file2(file, TRUE, pool)));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_io_file_create(const char *file,
+ const char *contents,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(svn_io_file_create_binary(file, contents,
+ contents
+ ? strlen(contents)
+ : 0,
+ pool));
+}
+
+svn_error_t *
+svn_io_file_create_empty(const char *file,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(svn_io_file_create_binary(file, "", 0, pool));
}
-svn_error_t *svn_io_dir_file_copy(const char *src_path,
- const char *dest_path,
- const char *file,
- apr_pool_t *pool)
+svn_error_t *
+svn_io_dir_file_copy(const char *src_path,
+ const char *dest_path,
+ const char *file,
+ apr_pool_t *pool)
{
const char *file_dest_path = svn_dirent_join(dest_path, file, pool);
const char *file_src_path = svn_dirent_join(src_path, file, pool);
- return svn_io_copy_file(file_src_path, file_dest_path, TRUE, pool);
+ return svn_error_trace(
+ svn_io_copy_file(file_src_path, file_dest_path, TRUE, pool));
}
@@ -2300,36 +2334,35 @@ stringbuf_from_aprfile(svn_stringbuf_t *
svn_error_t *err;
svn_stringbuf_t *res = NULL;
apr_size_t res_initial_len = SVN__STREAM_CHUNK_SIZE;
- char *buf = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
+ char *buf;
/* If our caller wants us to check the size of the file for
efficient memory handling, we'll try to do so. */
if (check_size)
{
- apr_status_t status;
-
- /* If our caller didn't tell us the file's name, we'll ask APR
- if it knows the name. No problem if we can't figure it out. */
- if (! filename)
- {
- const char *filename_apr;
- if (! (status = apr_file_name_get(&filename_apr, file)))
- filename = filename_apr;
- }
+ apr_finfo_t finfo;
- /* If we now know the filename, try to stat(). If we succeed,
- we know how to allocate our stringbuf. */
- if (filename)
- {
- apr_finfo_t finfo;
- if (! (status = apr_stat(&finfo, filename, APR_FINFO_MIN, pool)))
- res_initial_len = (apr_size_t)finfo.size;
+ /* In some cases we get size 0 and no error for non files,
+ so we also check for the name. (= cached in apr_file_t) */
+ if (! apr_file_info_get(&finfo, APR_FINFO_SIZE | APR_FINFO_NAME, file)
+ && finfo.name != NULL)
+ {
+ /* we've got the file length. Now, read it in one go. */
+ svn_boolean_t eof;
+ res_initial_len = (apr_size_t)finfo.size;
+ res = svn_stringbuf_create_ensure(res_initial_len, pool);
+ SVN_ERR(svn_io_file_read_full2(file, res->data,
+ res_initial_len, &res->len,
+ &eof, pool));
+ res->data[res->len] = 0;
+
+ *result = res;
+ return SVN_NO_ERROR;
}
}
-
/* XXX: We should check the incoming data for being of type binary. */
-
+ buf = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
res = svn_stringbuf_create_ensure(res_initial_len, pool);
/* apr_file_read will not return data and eof in the same call. So this loop
@@ -2345,7 +2378,7 @@ stringbuf_from_aprfile(svn_stringbuf_t *
/* Having read all the data we *expect* EOF */
if (err && !APR_STATUS_IS_EOF(err->apr_err))
- return err;
+ return svn_error_trace(err);
svn_error_clear(err);
*result = res;
@@ -3557,6 +3590,101 @@ svn_io_file_seek(apr_file_t *file, apr_s
pool);
}
+svn_error_t *
+svn_io_file_aligned_seek(apr_file_t *file,
+ apr_off_t block_size,
+ apr_off_t *buffer_start,
+ apr_off_t offset,
+ apr_pool_t *pool)
+{
+ const apr_size_t apr_default_buffer_size = 4096;
+ apr_size_t file_buffer_size = apr_default_buffer_size;
+ apr_off_t desired_offset = 0;
+ apr_off_t current = 0;
+ apr_off_t aligned_offset = 0;
+ svn_boolean_t fill_buffer = FALSE;
+
+ /* paranoia check: huge blocks on 32 bit machines may cause overflows */
+ SVN_ERR_ASSERT(block_size == (apr_size_t)block_size);
+
+ /* default for invalid block sizes */
+ if (block_size == 0)
+ block_size = apr_default_buffer_size;
+
+ /* on old APRs, we are simply stuck with 4k blocks */
+#if APR_VERSION_AT_LEAST(1,3,0)
+ file_buffer_size = apr_file_buffer_size_get(file);
+
+ /* don't try to set a buffer size for non-buffered files! */
+ if (file_buffer_size == 0)
+ {
+ aligned_offset = offset;
+ }
+ else if (file_buffer_size != (apr_size_t)block_size)
+ {
+ /* FILE has the wrong buffer size. correct it */
+ char *buffer;
+ file_buffer_size = (apr_size_t)block_size;
+ buffer = apr_palloc(apr_file_pool_get(file), file_buffer_size);
+ apr_file_buffer_set(file, buffer, file_buffer_size);
+
+ /* seek to the start of the block and cause APR to read 1 block */
+ aligned_offset = offset - (offset % block_size);
+ fill_buffer = TRUE;
+ }
+#endif
+ {
+ aligned_offset = offset - (offset % file_buffer_size);
+
+ /* We have no way to determine the block start of an APR file.
+ Furthermore, we don't want to throw away the current buffer
+ contents. Thus, we re-align the buffer only if the CURRENT
+ offset definitely lies outside the desired, aligned buffer.
+ This covers the typical case of linear reads getting very
+ close to OFFSET but reading the previous / following block.
+
+ Note that ALIGNED_OFFSET may still be within the current
+ buffer and no I/O will actually happen in the FILL_BUFFER
+ section below.
+ */
+ SVN_ERR(svn_io_file_seek(file, SEEK_CUR, ¤t, pool));
+ fill_buffer = aligned_offset + file_buffer_size <= current
+ || current <= aligned_offset;
+ }
+
+ if (fill_buffer)
+ {
+ char dummy;
+ apr_status_t status;
+
+ /* seek to the start of the block and cause APR to read 1 block */
+ SVN_ERR(svn_io_file_seek(file, SEEK_SET, &aligned_offset, pool));
+ status = apr_file_getc(&dummy, file);
+
+ /* read may fail if we seek to or behind EOF. That's ok then. */
+ if (status != APR_SUCCESS && !APR_STATUS_IS_EOF(status))
+ return do_io_file_wrapper_cleanup(file, status,
+ N_("Can't read file '%s'"),
+ N_("Can't read stream"),
+ pool);
+ }
+
+ /* finally, seek to the OFFSET the caller wants */
+ desired_offset = offset;
+ SVN_ERR(svn_io_file_seek(file, SEEK_SET, &offset, pool));
+ if (desired_offset != offset)
+ return do_io_file_wrapper_cleanup(file, APR_EOF,
+ N_("Can't seek in file '%s'"),
+ N_("Can't seek in stream"),
+ pool);
+
+ /* return the buffer start that we (probably) enforced */
+ if (buffer_start)
+ *buffer_start = aligned_offset;
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_io_file_write(apr_file_t *file, const void *buf,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/mergeinfo.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/mergeinfo.c Fri Aug 23 13:12:18 2013
@@ -23,6 +23,7 @@
#include <assert.h>
#include <ctype.h>
+#include "svn_private_config.h"
#include "svn_path.h"
#include "svn_types.h"
#include "svn_ctype.h"
@@ -36,7 +37,6 @@
#include "private/svn_mergeinfo_private.h"
#include "private/svn_string_private.h"
#include "private/svn_subr_private.h"
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "private/svn_dep_compat.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/nls.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/nls.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/nls.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/nls.c Fri Aug 23 13:12:18 2013
@@ -58,7 +58,7 @@ svn_nls_init(void)
apr_pool_t* pool;
apr_size_t inwords, outbytes, outlength;
- apr_pool_create(&pool, 0);
+ pool = svn_pool_create(0);
/* get exe name - our locale info will be in '../share/locale' */
inwords = GetModuleFileNameW(0, ucs2_path,
sizeof(ucs2_path) / sizeof(ucs2_path[0]));
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/opt.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/opt.c Fri Aug 23 13:12:18 2013
@@ -34,6 +34,7 @@
#include <apr_lib.h>
#include <apr_file_info.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_cmdline.h"
#include "svn_version.h"
@@ -50,7 +51,6 @@
#include "private/svn_opt_private.h"
#include "opt.h"
-#include "svn_private_config.h"
/*** Code. ***/
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/properties.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/properties.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/properties.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/properties.c Fri Aug 23 13:12:18 2013
@@ -27,6 +27,8 @@
#include <apr_hash.h>
#include <apr_tables.h>
#include <string.h> /* for strncmp() */
+
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_string.h"
#include "svn_props.h"
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/simple_providers.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/simple_providers.c Fri Aug 23 13:12:18 2013
@@ -28,6 +28,8 @@
/*** Includes. ***/
#include <apr_pools.h>
+
+#include "svn_private_config.h"
#include "svn_auth.h"
#include "svn_dirent_uri.h"
#include "svn_hash.h"
@@ -39,8 +41,6 @@
#include "private/svn_auth_private.h"
-#include "svn_private_config.h"
-
#include "auth.h"
/*-----------------------------------------------------------------------*/
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/sorts.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/sorts.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/sorts.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/sorts.c Fri Aug 23 13:12:18 2013
@@ -28,6 +28,8 @@
#include <apr_tables.h>
#include <stdlib.h> /* for qsort() */
#include <assert.h>
+
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_sorts.h"
@@ -307,3 +309,148 @@ svn_sort__array_reverse(apr_array_header
}
}
}
+
+/* Our priority queue data structure:
+ * Simply remember the constructor parameters.
+ */
+struct svn_priority_queue__t
+{
+ /* the queue elements, ordered as a heap according to COMPARE_FUNC */
+ apr_array_header_t *elements;
+
+ /* predicate used to order the heap */
+ int (*compare_func)(const void *, const void *);
+};
+
+/* Return TRUE, if heap element number LHS in QUEUE is smaller than element
+ * number RHS according to QUEUE->COMPARE_FUNC
+ */
+static int
+heap_is_less(svn_priority_queue__t *queue,
+ apr_size_t lhs,
+ apr_size_t rhs)
+{
+ char *lhs_value = queue->elements->elts + lhs * queue->elements->elt_size;
+ char *rhs_value = queue->elements->elts + rhs * queue->elements->elt_size;
+
+ assert(lhs < queue->elements->nelts);
+ assert(rhs < queue->elements->nelts);
+ return queue->compare_func((void *)lhs_value, (void *)rhs_value) < 0;
+}
+
+/* Exchange elements number LHS and RHS in QUEUE.
+ */
+static void
+heap_swap(svn_priority_queue__t *queue,
+ apr_size_t lhs,
+ apr_size_t rhs)
+{
+ int i;
+ char *lhs_value = queue->elements->elts + lhs * queue->elements->elt_size;
+ char *rhs_value = queue->elements->elts + rhs * queue->elements->elt_size;
+
+ for (i = 0; i < queue->elements->elt_size; ++i)
+ {
+ char temp = lhs_value[i];
+ lhs_value[i] = rhs_value[i];
+ rhs_value[i] = temp;
+ }
+}
+
+/* Move element number IDX to lower indexes until the heap criterion is
+ * fulfilled again.
+ */
+static void
+heap_bubble_down(svn_priority_queue__t *queue,
+ int idx)
+{
+ while (idx > 0 && heap_is_less(queue, idx, (idx - 1) / 2))
+ {
+ heap_swap(queue, idx, (idx - 1) / 2);
+ idx = (idx - 1) / 2;
+ }
+}
+
+/* Move element number IDX to higher indexes until the heap criterion is
+ * fulfilled again.
+ */
+static void
+heap_bubble_up(svn_priority_queue__t *queue,
+ int idx)
+{
+ while (2 * idx + 2 < queue->elements->nelts)
+ {
+ int child = heap_is_less(queue, 2 * idx + 1, 2 * idx + 2)
+ ? 2 * idx + 1
+ : 2 * idx + 2;
+
+ if (heap_is_less(queue, idx, child))
+ return;
+
+ heap_swap(queue, idx, child);
+ idx = child;
+ }
+
+ if ( 2 * idx + 1 < queue->elements->nelts
+ && heap_is_less(queue, 2 * idx + 1, idx))
+ heap_swap(queue, 2 * idx + 1, idx);
+}
+
+svn_priority_queue__t *
+svn_priority_queue__create(apr_array_header_t *elements,
+ int (*compare_func)(const void *, const void *))
+{
+ int i;
+
+ svn_priority_queue__t *queue = apr_pcalloc(elements->pool, sizeof(*queue));
+ queue->elements = elements;
+ queue->compare_func = compare_func;
+
+ for (i = elements->nelts / 2; i >= 0; --i)
+ heap_bubble_up(queue, i);
+
+ return queue;
+}
+
+apr_size_t
+svn_priority_queue__size(svn_priority_queue__t *queue)
+{
+ return queue->elements->nelts;
+}
+
+void *
+svn_priority_queue__peek(svn_priority_queue__t *queue)
+{
+ return queue->elements->nelts ? queue->elements->elts : NULL;
+}
+
+void
+svn_priority_queue__update(svn_priority_queue__t *queue)
+{
+ heap_bubble_up(queue, 0);
+}
+
+void
+svn_priority_queue__pop(svn_priority_queue__t *queue)
+{
+ if (queue->elements->nelts)
+ {
+ memcpy(queue->elements->elts,
+ queue->elements->elts + (queue->elements->nelts - 1)
+ * queue->elements->elt_size,
+ queue->elements->elt_size);
+ --queue->elements->nelts;
+ heap_bubble_up(queue, 0);
+ }
+}
+
+void
+svn_priority_queue__push(svn_priority_queue__t *queue,
+ const void *element)
+{
+ /* we cannot duplicate elements due to potential array re-allocs */
+ assert(element && element != queue->elements->elts);
+
+ memcpy(apr_array_push(queue->elements), element, queue->elements->elt_size);
+ heap_bubble_down(queue, queue->elements->nelts - 1);
+}
\ No newline at end of file
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/spillbuf.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/spillbuf.c?rev=1516837&r1=1516836&r2=1516837&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/spillbuf.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/spillbuf.c Fri Aug 23 13:12:18 2013
@@ -73,12 +73,26 @@ struct svn_spillbuf_t {
/* How much content remains in SPILL. */
svn_filesize_t spill_size;
+
+ /* When false, do not delete the spill file when it is closed. */
+ svn_boolean_t delete_on_close;
+
+ /* When true, and the amount of data written to the spillbuf is
+ larger than MAXSIZE, all spillbuf contents will be written to the
+ spill file. */
+ svn_boolean_t spill_all_contents;
+
+ /* The directory in which the spill file is created. */
+ const char *dirpath;
+
+ /* The name of the temporary spill file. */
+ const char *filename;
};
struct svn_spillbuf_reader_t {
/* Embed the spill-buffer within the reader. */
- struct svn_spillbuf_t buf;
+ struct svn_spillbuf_t *buf;
/* When we read content from the underlying spillbuf, these fields store
the ptr/len pair. The ptr will be incremented as we "read" out of this
@@ -99,28 +113,86 @@ struct svn_spillbuf_reader_t {
};
+/* Extended spillbuf initialization. */
+static void
+init_spillbuf_extended(svn_spillbuf_t *buf,
+ apr_size_t blocksize,
+ apr_size_t maxsize,
+ svn_boolean_t delete_on_close,
+ svn_boolean_t spill_all_contents,
+ const char *dirpath,
+ apr_pool_t *result_pool)
+{
+ buf->pool = result_pool;
+ buf->blocksize = blocksize;
+ buf->maxsize = maxsize;
+ buf->delete_on_close = delete_on_close;
+ buf->spill_all_contents = spill_all_contents;
+ buf->dirpath = dirpath;
+}
+
+/* Common constructor for initializing spillbufs.
+ Used by svn_spillbuf__create, svn_spilbuff__reader_create. */
+static void
+init_spillbuf(svn_spillbuf_t *buf,
+ apr_size_t blocksize,
+ apr_size_t maxsize,
+ apr_pool_t *result_pool)
+{
+ init_spillbuf_extended(buf, blocksize, maxsize,
+ TRUE, FALSE, NULL,
+ result_pool);
+}
+
svn_spillbuf_t *
svn_spillbuf__create(apr_size_t blocksize,
apr_size_t maxsize,
apr_pool_t *result_pool)
{
svn_spillbuf_t *buf = apr_pcalloc(result_pool, sizeof(*buf));
+ init_spillbuf(buf, blocksize, maxsize, result_pool);
+ return buf;
+}
- buf->pool = result_pool;
- buf->blocksize = blocksize;
- buf->maxsize = maxsize;
- /* Note: changes here should also go into svn_spillbuf__reader_create() */
+svn_spillbuf_t *
+svn_spillbuf__create_extended(apr_size_t blocksize,
+ apr_size_t maxsize,
+ svn_boolean_t delete_on_close,
+ svn_boolean_t spill_all_contents,
+ const char *dirpath,
+ apr_pool_t *result_pool)
+{
+ svn_spillbuf_t *buf = apr_pcalloc(result_pool, sizeof(*buf));
+ init_spillbuf_extended(buf, blocksize, maxsize,
+ delete_on_close, spill_all_contents, dirpath,
+ result_pool);
return buf;
}
-
svn_filesize_t
svn_spillbuf__get_size(const svn_spillbuf_t *buf)
{
return buf->memory_size + buf->spill_size;
}
+svn_filesize_t
+svn_spillbuf__get_memory_size(const svn_spillbuf_t *buf)
+{
+ return buf->memory_size;
+}
+
+const char *
+svn_spillbuf__get_filename(const svn_spillbuf_t *buf)
+{
+ return buf->filename;
+}
+
+apr_file_t *
+svn_spillbuf__get_file(const svn_spillbuf_t *buf)
+{
+ return buf->spill;
+}
/* Get a memblock from the spill-buffer. It will be the block that we
passed out for reading, come from the free list, or allocated. */
@@ -173,10 +245,32 @@ svn_spillbuf__write(svn_spillbuf_t *buf,
&& (buf->memory_size + len) > buf->maxsize)
{
SVN_ERR(svn_io_open_unique_file3(&buf->spill,
- NULL /* temp_path */,
- NULL /* dirpath */,
- svn_io_file_del_on_close,
+ &buf->filename,
+ buf->dirpath,
+ (buf->delete_on_close
+ ? svn_io_file_del_on_close
+ : svn_io_file_del_none),
buf->pool, scratch_pool));
+
+ /* Optionally write the memory contents into the file. */
+ if (buf->spill_all_contents)
+ {
+ mem = buf->head;
+ while (mem != NULL)
+ {
+ SVN_ERR(svn_io_file_write_full(buf->spill, mem->data, mem->size,
+ NULL, scratch_pool));
+ mem = mem->next;
+ }
+
+ /* Adjust the start offset for reading from the spill file.
+
+ ### FIXME: Instead, we should simply discard the memory
+ buffers; but currently some tests expect to read data in
+ the same chunk sizes as were written, so we'll leave this
+ change for later.*/
+ buf->spill_start = buf->memory_size;
+ }
}
/* Once a spill file has been constructed, then we need to put all
@@ -440,16 +534,10 @@ svn_spillbuf__reader_create(apr_size_t b
apr_pool_t *result_pool)
{
svn_spillbuf_reader_t *sbr = apr_pcalloc(result_pool, sizeof(*sbr));
-
- /* See svn_spillbuf__create() */
- sbr->buf.pool = result_pool;
- sbr->buf.blocksize = blocksize;
- sbr->buf.maxsize = maxsize;
-
+ sbr->buf = svn_spillbuf__create(blocksize, maxsize, result_pool);
return sbr;
}
-
svn_error_t *
svn_spillbuf__reader_read(apr_size_t *amt,
svn_spillbuf_reader_t *reader,
@@ -488,7 +576,7 @@ svn_spillbuf__reader_read(apr_size_t *am
if (reader->sb_len == 0)
{
SVN_ERR(svn_spillbuf__read(&reader->sb_ptr, &reader->sb_len,
- &reader->buf,
+ reader->buf,
scratch_pool));
/* We've run out of content, so return with whatever has
@@ -547,7 +635,8 @@ svn_spillbuf__reader_write(svn_spillbuf_
if (reader->sb_len > 0)
{
if (reader->save_ptr == NULL)
- reader->save_ptr = apr_palloc(reader->buf.pool, reader->buf.blocksize);
+ reader->save_ptr = apr_palloc(reader->buf->pool,
+ reader->buf->blocksize);
memcpy(reader->save_ptr, reader->sb_ptr, reader->sb_len);
reader->save_len = reader->sb_len;
@@ -557,7 +646,7 @@ svn_spillbuf__reader_write(svn_spillbuf_
reader->sb_len = 0;
}
- return svn_error_trace(svn_spillbuf__write(&reader->buf, data, len,
+ return svn_error_trace(svn_spillbuf__write(reader->buf, data, len,
scratch_pool));
}
@@ -596,14 +685,14 @@ write_handler_spillbuf(void *baton, cons
svn_stream_t *
-svn_stream__from_spillbuf(apr_size_t blocksize,
- apr_size_t maxsize,
+svn_stream__from_spillbuf(svn_spillbuf_t *buf,
apr_pool_t *result_pool)
{
svn_stream_t *stream;
struct spillbuf_baton *sb = apr_palloc(result_pool, sizeof(*sb));
- sb->reader = svn_spillbuf__reader_create(blocksize, maxsize, result_pool);
+ sb->reader = apr_pcalloc(result_pool, sizeof(*sb->reader));
+ sb->reader->buf = buf;
sb->scratch_pool = svn_pool_create(result_pool);
stream = svn_stream_create(sb, result_pool);