You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/06/11 10:06:28 UTC
svn commit: r1348743 [1/2] - in /subversion/branches/ev2-export: ./
notes/wc-ng/ subversion/include/ subversion/libsvn_delta/
subversion/libsvn_diff/ subversion/libsvn_fs_fs/ subversion/libsvn_ra/
subversion/libsvn_ra_serf/ subversion/libsvn_ra_svn/ su...
Author: hwright
Date: Mon Jun 11 08:06:26 2012
New Revision: 1348743
URL: http://svn.apache.org/viewvc?rev=1348743&view=rev
Log:
On the ev2-export branch:
Bring up-to-date with trunk.
Added:
subversion/branches/ev2-export/notes/wc-ng/conflict-storage-2.0
- copied unchanged from r1348741, subversion/trunk/notes/wc-ng/conflict-storage-2.0
Modified:
subversion/branches/ev2-export/ (props changed)
subversion/branches/ev2-export/COMMITTERS
subversion/branches/ev2-export/configure.ac
subversion/branches/ev2-export/get-deps.sh
subversion/branches/ev2-export/subversion/include/svn_delta.h
subversion/branches/ev2-export/subversion/libsvn_delta/text_delta.c
subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c
subversion/branches/ev2-export/subversion/libsvn_diff/diff_file.c
subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c
subversion/branches/ev2-export/subversion/libsvn_ra/compat.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/blame.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/get_deleted_rev.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/getdate.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocations.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocationsegments.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocks.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/locks.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/log.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/merge.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/mergeinfo.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/options.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h
subversion/branches/ev2-export/subversion/libsvn_ra_serf/update.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c
subversion/branches/ev2-export/subversion/libsvn_ra_serf/xml.c
subversion/branches/ev2-export/subversion/libsvn_ra_svn/marshal.c
subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c
subversion/branches/ev2-export/subversion/libsvn_wc/copy.c
subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c
subversion/branches/ev2-export/subversion/mod_dav_svn/reports/update.c
subversion/branches/ev2-export/subversion/tests/cmdline/davautocheck.sh
subversion/branches/ev2-export/subversion/tests/cmdline/svnserveautocheck.sh
subversion/branches/ev2-export/subversion/tests/libsvn_delta/random-test.c
subversion/branches/ev2-export/subversion/tests/libsvn_delta/svndiff-test.c
subversion/branches/ev2-export/subversion/tests/libsvn_delta/vdelta-test.c
subversion/branches/ev2-export/subversion/tests/libsvn_delta/window-test.c
subversion/branches/ev2-export/subversion/tests/libsvn_wc/utils.c
subversion/branches/ev2-export/tools/dev/unix-build/Makefile.svn
Propchange: subversion/branches/ev2-export/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1346867-1348741
Modified: subversion/branches/ev2-export/COMMITTERS
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/COMMITTERS?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/COMMITTERS [UTF-8] (original)
+++ subversion/branches/ev2-export/COMMITTERS [UTF-8] Mon Jun 11 08:06:26 2012
@@ -13,7 +13,7 @@ Blanket commit access:
sussman Ben Collins-Sussman <su...@red-bean.com>
kfogel Karl Fogel <kf...@red-bean.com>
gstein Greg Stein <gs...@gmail.com>
- brane Branko Čibej <br...@xbc.nu>
+ brane Branko Čibej <br...@apache.org>
jorton Joe Orton <jo...@manyfish.co.uk>
ghudson Greg Hudson <gh...@mit.edu>
fitz Brian W. Fitzpatrick <fi...@red-bean.com>
Modified: subversion/branches/ev2-export/configure.ac
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/configure.ac?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/configure.ac (original)
+++ subversion/branches/ev2-export/configure.ac Mon Jun 11 08:06:26 2012
@@ -166,8 +166,8 @@ dnl Find Apache with a recent-enough mag
SVN_FIND_APACHE(20020903)
dnl Search for SQLite
-SQLITE_MINIMUM_VER="3.6.18"
-SQLITE_RECOMMENDED_VER="3.7.6.3"
+SQLITE_MINIMUM_VER="3.7.12"
+SQLITE_RECOMMENDED_VER="3.7.12"
SQLITE_URL="http://www.sqlite.org/sqlite-amalgamation-${SQLITE_RECOMMENDED_VER}.tar.gz"
SVN_LIB_SQLITE(${SQLITE_MINIMUM_VER}, ${SQLITE_RECOMMENDED_VER},
${SQLITE_URL})
Modified: subversion/branches/ev2-export/get-deps.sh
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/get-deps.sh?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/get-deps.sh (original)
+++ subversion/branches/ev2-export/get-deps.sh Mon Jun 11 08:06:26 2012
@@ -28,7 +28,7 @@ APR_UTIL=apr-util-1.4.1
NEON=neon-0.29.6
SERF=serf-1.0.1
ZLIB=zlib-1.2.6
-SQLITE_VERSION=3.7.10
+SQLITE_VERSION=3.7.12
SQLITE=sqlite-amalgamation-$(printf %u%02u%02u%02u $(echo $SQLITE_VERSION | sed -e "s/\./ /g"))
HTTPD=httpd-2.2.22
Modified: subversion/branches/ev2-export/subversion/include/svn_delta.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/include/svn_delta.h?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/include/svn_delta.h (original)
+++ subversion/branches/ev2-export/subversion/include/svn_delta.h Mon Jun 11 08:06:26 2012
@@ -367,10 +367,26 @@ svn_txdelta_md5_digest(svn_txdelta_strea
*
* @a source and @a target are both readable generic streams. When we call
* svn_txdelta_next_window() on @a *stream, it will read from @a source and
- * @a target to gather as much data as it needs.
+ * @a target to gather as much data as it needs. If @a calculate_checksum
+ * is set, you may call @ref svn_txdelta_md5_digest to get an MD5 checksum
+ * for @a target.
*
* Do any necessary allocation in a sub-pool of @a pool.
+ *
+ * @since New in 1.8.
+ */
+void
+svn_txdelta2(svn_txdelta_stream_t **stream,
+ svn_stream_t *source,
+ svn_stream_t *target,
+ svn_boolean_t calculate_checksum,
+ apr_pool_t *pool);
+
+/** Similar to svn_txdelta2 but always calculating the target checksum.
+ *
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
+SVN_DEPRECATED
void
svn_txdelta(svn_txdelta_stream_t **stream,
svn_stream_t *source,
Modified: subversion/branches/ev2-export/subversion/libsvn_delta/text_delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_delta/text_delta.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_delta/text_delta.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_delta/text_delta.c Mon Jun 11 08:06:26 2012
@@ -57,7 +57,8 @@ struct txdelta_baton {
svn_filesize_t pos; /* Offset of next read in source file. */
char *buf; /* Buffer for input data. */
- svn_checksum_ctx_t *context; /* Context for computing the checksum. */
+ svn_checksum_ctx_t *context; /* If not NULL, the context for computing
+ the checksum. */
svn_checksum_t *checksum; /* If non-NULL, the checksum of TARGET. */
apr_pool_t *result_pool; /* For results (e.g. checksum) */
@@ -405,6 +406,10 @@ txdelta_md5_digest(void *baton)
if (b->more)
return NULL;
+ /* If checksumming has not been activated, there will be no digest. */
+ if (b->context == NULL)
+ return NULL;
+
/* The checksum should be there. */
return b->checksum->digest;
}
@@ -463,10 +468,11 @@ svn_txdelta_run(svn_stream_t *source,
void
-svn_txdelta(svn_txdelta_stream_t **stream,
- svn_stream_t *source,
- svn_stream_t *target,
- apr_pool_t *pool)
+svn_txdelta2(svn_txdelta_stream_t **stream,
+ svn_stream_t *source,
+ svn_stream_t *target,
+ svn_boolean_t calculate_checksum,
+ apr_pool_t *pool)
{
struct txdelta_baton *b = apr_pcalloc(pool, sizeof(*b));
@@ -475,13 +481,24 @@ svn_txdelta(svn_txdelta_stream_t **strea
b->more_source = TRUE;
b->more = TRUE;
b->buf = apr_palloc(pool, 2 * SVN_DELTA_WINDOW_SIZE);
- b->context = svn_checksum_ctx_create(svn_checksum_md5, pool);
+ b->context = calculate_checksum
+ ? svn_checksum_ctx_create(svn_checksum_md5, pool)
+ : NULL;
b->result_pool = pool;
*stream = svn_txdelta_stream_create(b, txdelta_next_window,
txdelta_md5_digest, pool);
}
+void
+svn_txdelta(svn_txdelta_stream_t **stream,
+ svn_stream_t *source,
+ svn_stream_t *target,
+ apr_pool_t *pool)
+{
+ return svn_txdelta2(stream, source, target, TRUE, pool);
+}
+
/* Functions for implementing a "target push" delta. */
Modified: subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_delta/xdelta.c Mon Jun 11 08:06:26 2012
@@ -109,8 +109,13 @@ struct block
/* A hash table, using open addressing, of the blocks of the source. */
struct blocks
{
- /* The largest valid index of slots. */
- apr_size_t max;
+ /* The largest valid index of slots.
+ This value has an upper bound proportionate to the text delta
+ window size, so unless we dramatically increase the window size,
+ it's safe to make this a 32-bit value. In any case, it has to be
+ hte same width as the block position index, (struct
+ block).pos. */
+ apr_uint32_t max;
/* Source buffer that the positions in SLOTS refer to. */
const char* data;
/* The vector of blocks. A pos value of NO_POSITION represents an unused
@@ -133,7 +138,7 @@ static apr_uint32_t hash_func(apr_uint32
data into the table BLOCKS. Ignore true duplicates, i.e. blocks with
actually the same content. */
static void
-add_block(struct blocks *blocks, apr_uint32_t adlersum, apr_size_t pos)
+add_block(struct blocks *blocks, apr_uint32_t adlersum, apr_uint32_t pos)
{
apr_uint32_t h = hash_func(adlersum) & blocks->max;
@@ -176,17 +181,30 @@ init_blocks_table(const char *data,
struct blocks *blocks,
apr_pool_t *pool)
{
- apr_size_t i;
apr_size_t nblocks;
- apr_size_t nslots = 1;
+ apr_size_t wnslots = 1;
+ apr_uint32_t nslots;
+ apr_uint32_t i;
/* Be pessimistic about the block count. */
nblocks = datalen / MATCH_BLOCKSIZE + 1;
/* Find nearest larger power of two. */
- while (nslots <= nblocks)
- nslots *= 2;
+ while (wnslots <= nblocks)
+ wnslots *= 2;
/* Double the number of slots to avoid a too high load. */
- nslots *= 2;
+ wnslots *= 2;
+ /* Narrow the number of slots to 32 bits, which is the size of the
+ block position index in the hash table.
+ Sanity check: On 64-bit platforms, apr_size_t is likely to be
+ larger than apr_uint32_t. Make sure that the number of slots
+ actually fits into blocks->max. It's safe to use a hard assert
+ here, because the largest possible value for nslots is
+ proportional to the text delta window size and is therefore much
+ smaller than the range of an apr_uint32_t. If we ever happen to
+ increase the window size too much, this assertion will get
+ triggered by the test suite. */
+ nslots = (apr_uint32_t) wnslots;
+ SVN_ERR_ASSERT_NO_RETURN(wnslots == nslots);
blocks->max = nslots - 1;
blocks->data = data;
blocks->slots = apr_palloc(pool, nslots * sizeof(*(blocks->slots)));
Modified: subversion/branches/ev2-export/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_diff/diff_file.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_diff/diff_file.c Mon Jun 11 08:06:26 2012
@@ -432,15 +432,15 @@ find_identical_prefix(svn_boolean_t *rea
is_match = TRUE;
for (delta = 0; delta < max_delta && is_match; delta += sizeof(apr_uintptr_t))
{
- apr_uintptr_t chunk = *(const apr_size_t *)(file[0].curp + delta);
+ apr_uintptr_t chunk = *(const apr_uintptr_t *)(file[0].curp + delta);
if (contains_eol(chunk))
break;
for (i = 1; i < file_len; i++)
- if (chunk != *(const apr_size_t *)(file[i].curp + delta))
+ if (chunk != *(const apr_uintptr_t *)(file[i].curp + delta))
{
is_match = FALSE;
- delta -= sizeof(apr_size_t);
+ delta -= sizeof(apr_uintptr_t);
break;
}
}
Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c Mon Jun 11 08:06:26 2012
@@ -4115,7 +4115,11 @@ svn_fs_fs__get_file_delta_stream(svn_txd
else
source_stream = svn_stream_empty(pool);
SVN_ERR(read_representation(&target_stream, fs, target->data_rep, pool));
- svn_txdelta(stream_p, source_stream, target_stream, pool);
+
+ /* Because source and target stream will already verify their content,
+ * there is no need to do this once more. In particular if the stream
+ * content is being fetched from cache. */
+ svn_txdelta2(stream_p, source_stream, target_stream, FALSE, pool);
return SVN_NO_ERROR;
}
@@ -8427,7 +8431,7 @@ svn_fs_fs__verify(svn_fs_t *fs,
pool));
/* Issue #4129: bogus pred-counts and minfo-cnt's on the root node-rev
- (and elsewhere). This code makes more thorough checks that the
+ (and elsewhere). This code makes more thorough checks than the
commit-time checks in validate_root_noderev(). */
{
svn_revnum_t i;
Modified: subversion/branches/ev2-export/subversion/libsvn_ra/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra/compat.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra/compat.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra/compat.c Mon Jun 11 08:06:26 2012
@@ -757,8 +757,9 @@ svn_ra__file_revs_from_log(svn_ra_sessio
/* Compute and send delta if client asked for it. */
if (delta_handler)
{
- /* Get the content delta. */
- svn_txdelta(&delta_stream, last_stream, stream, lastpool);
+ /* Get the content delta. Don't calculate checksums as we don't
+ * use them. */
+ svn_txdelta2(&delta_stream, last_stream, stream, FALSE, lastpool);
/* And send. */
SVN_ERR(svn_txdelta_send_txstream(delta_stream, delta_handler,
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/blame.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/blame.c Mon Jun 11 08:06:26 2012
@@ -120,25 +120,25 @@ typedef struct blame_context_t {
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t blame_ttable[] = {
{ INITIAL, S_, "file-revs-report", FILE_REVS_REPORT,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ FILE_REVS_REPORT, S_, "file-rev", FILE_REV,
- FALSE, { "path", "rev", NULL }, FALSE, TRUE },
+ FALSE, { "path", "rev", NULL }, TRUE },
{ FILE_REV, D_, "rev-prop", REV_PROP,
- TRUE, { "name", "?encoding", NULL }, FALSE, TRUE },
+ TRUE, { "name", "?encoding", NULL }, TRUE },
{ FILE_REV, D_, "set-prop", SET_PROP,
- TRUE, { "name", "?encoding", NULL }, FALSE, TRUE },
+ TRUE, { "name", "?encoding", NULL }, TRUE },
{ FILE_REV, D_, "remove-prop", REMOVE_PROP,
- FALSE, { "name", "?encoding", NULL }, FALSE, TRUE },
+ FALSE, { "name", "?encoding", NULL }, TRUE },
{ FILE_REV, D_, "merged-revision", MERGED_REVISION,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ FILE_REV, D_, "txdelta", TXDELTA,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ 0 }
};
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c Mon Jun 11 08:06:26 2012
@@ -2135,40 +2135,37 @@ close_edit(void *edit_baton,
apr_pool_t *pool)
{
commit_context_t *ctx = edit_baton;
- svn_ra_serf__merge_context_t *merge_ctx;
- svn_ra_serf__handler_t *handler;
- svn_boolean_t *merge_done;
const char *merge_target =
ctx->activity_url ? ctx->activity_url : ctx->txn_url;
+ const svn_commit_info_t *commit_info;
+ int response_code;
/* MERGE our activity */
- SVN_ERR(svn_ra_serf__merge_create_req(&merge_ctx, ctx->session,
- ctx->session->conns[0],
- merge_target,
- ctx->lock_tokens,
- ctx->keep_locks,
- pool));
-
- merge_done = svn_ra_serf__merge_get_done_ptr(merge_ctx);
+ SVN_ERR(svn_ra_serf__run_merge(&commit_info, &response_code,
+ ctx->session,
+ ctx->session->conns[0],
+ merge_target,
+ ctx->lock_tokens,
+ ctx->keep_locks,
+ pool, pool));
- SVN_ERR(svn_ra_serf__context_run_wait(merge_done, ctx->session, pool));
-
- if (svn_ra_serf__merge_get_status(merge_ctx) != 200)
+ if (response_code != 200)
{
return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
_("MERGE request failed: returned %d "
"(during commit)"),
- svn_ra_serf__merge_get_status(merge_ctx));
+ response_code);
}
/* Inform the WC that we did a commit. */
if (ctx->callback)
- SVN_ERR(ctx->callback(svn_ra_serf__merge_get_commit_info(merge_ctx),
- ctx->callback_baton, pool));
+ SVN_ERR(ctx->callback(commit_info, ctx->callback_baton, pool));
/* If we're using activities, DELETE our completed activity. */
if (ctx->activity_url)
{
+ svn_ra_serf__handler_t *handler;
+
handler = apr_pcalloc(pool, sizeof(*handler));
handler->handler_pool = pool;
handler->method = "DELETE";
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/get_deleted_rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/get_deleted_rev.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/get_deleted_rev.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/get_deleted_rev.c Mon Jun 11 08:06:26 2012
@@ -56,10 +56,10 @@ typedef struct drev_context_t {
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t getdrev_ttable[] = {
{ INITIAL, S_, "get-deleted-rev-report", REPORT,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ REPORT, D_, SVN_DAV__VERSION_NAME, VERSION_NAME,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ 0 }
};
@@ -151,7 +151,8 @@ svn_ra_serf__get_deleted_rev(svn_ra_sess
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(getdrev_ttable,
- NULL, getdrev_closed, drev_ctx,
+ NULL, getdrev_closed, NULL,
+ drev_ctx,
pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/getdate.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/getdate.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/getdate.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/getdate.c Mon Jun 11 08:06:26 2012
@@ -63,10 +63,10 @@ typedef struct date_context_t {
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t date_ttable[] = {
{ INITIAL, S_, "dated-rev-report", REPORT,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ REPORT, D_, SVN_DAV__VERSION_NAME, VERSION_NAME,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ 0 }
};
@@ -139,7 +139,8 @@ svn_ra_serf__get_dated_revision(svn_ra_s
SVN_ERR(svn_ra_serf__report_resource(&report_target, session, NULL, pool));
xmlctx = svn_ra_serf__xml_context_create(date_ttable,
- NULL, date_closed, date_ctx,
+ NULL, date_closed, NULL,
+ date_ctx,
pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocations.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocations.c Mon Jun 11 08:06:26 2012
@@ -65,10 +65,10 @@ typedef struct loc_context_t {
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t getloc_ttable[] = {
{ INITIAL, S_, "get-locations-report", REPORT,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ REPORT, S_, "location", LOCATION,
- FALSE, { "?rev", "?path", NULL }, FALSE, TRUE },
+ FALSE, { "?rev", "?path", NULL }, TRUE },
{ 0 }
};
@@ -175,7 +175,8 @@ svn_ra_serf__get_locations(svn_ra_sessio
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(getloc_ttable,
- NULL, getloc_closed, loc_ctx,
+ NULL, getloc_closed, NULL,
+ loc_ctx,
pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocationsegments.c Mon Jun 11 08:06:26 2012
@@ -61,10 +61,10 @@ enum {
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t gls_ttable[] = {
{ INITIAL, S_, "get-location-segments-report", REPORT,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ REPORT, S_, "location-segment", SEGMENT,
- FALSE, { "?path", "range-start", "range-end", NULL }, FALSE, TRUE },
+ FALSE, { "?path", "range-start", "range-end", NULL }, TRUE },
{ 0 }
};
@@ -177,7 +177,8 @@ svn_ra_serf__get_location_segments(svn_r
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(gls_ttable,
- NULL, gls_closed, gls_ctx,
+ NULL, gls_closed, NULL,
+ gls_ctx,
pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocks.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocks.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocks.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/getlocks.c Mon Jun 11 08:06:26 2012
@@ -74,28 +74,28 @@ typedef struct lock_context_t {
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t getlocks_ttable[] = {
{ INITIAL, S_, "get-locks-report", REPORT,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ REPORT, S_, "lock", LOCK,
- FALSE, { NULL }, FALSE, TRUE },
+ FALSE, { NULL }, TRUE },
{ LOCK, S_, "path", PATH,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ LOCK, S_, "token", TOKEN,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ LOCK, S_, "owner", OWNER,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ LOCK, S_, "comment", COMMENT,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ LOCK, S_, SVN_DAV__CREATIONDATE, CREATION_DATE,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ LOCK, S_, "expirationdate", EXPIRATION_DATE,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ 0 }
};
@@ -248,7 +248,8 @@ svn_ra_serf__get_locks(svn_ra_session_t
lock_ctx->hash = apr_hash_make(pool);
xmlctx = svn_ra_serf__xml_context_create(getlocks_ttable,
- NULL, getlocks_closed, lock_ctx,
+ NULL, getlocks_closed, NULL,
+ lock_ctx,
pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/locks.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/locks.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/locks.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/locks.c Mon Jun 11 08:06:26 2012
@@ -85,24 +85,24 @@ static const svn_ra_serf__xml_transition
/* The INITIAL state can transition into D:prop (LOCK) or
to D:multistatus (PROPFIND) */
{ INITIAL, D_, "prop", PROP,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ INITIAL, D_, "multistatus", MULTISTATUS,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ MULTISTATUS, D_, "response", RESPONSE,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ RESPONSE, D_, "propstat", PROPSTAT,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ PROPSTAT, D_, "prop", PROP,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ PROP, D_, "lockdiscovery", LOCK_DISCOVERY,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ LOCK_DISCOVERY, D_, "activelock", ACTIVE_LOCK,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
#if 0
/* ### we don't really need to parse locktype/lockscope. we know what
@@ -113,29 +113,29 @@ static const svn_ra_serf__xml_transition
### just isn't important to validate, so disable this for now... */
{ ACTIVE_LOCK, D_, "locktype", LOCK_TYPE,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ LOCK_TYPE, D_, "write", WRITE,
- FALSE, { NULL }, FALSE, TRUE },
+ FALSE, { NULL }, TRUE },
{ ACTIVE_LOCK, D_, "lockscope", LOCK_SCOPE,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ LOCK_SCOPE, D_, "exclusive", EXCLUSIVE,
- FALSE, { NULL }, FALSE, TRUE },
+ FALSE, { NULL }, TRUE },
#endif /* 0 */
{ ACTIVE_LOCK, D_, "timeout", TIMEOUT,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ ACTIVE_LOCK, D_, "locktoken", LOCK_TOKEN,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ LOCK_TOKEN, D_, "href", HREF,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ ACTIVE_LOCK, D_, "owner", OWNER,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
/* ACTIVE_LOCK has a D:depth child, but we can ignore that. */
@@ -381,7 +381,8 @@ svn_ra_serf__get_lock(svn_ra_session_t *
lock_ctx->lock->path = apr_pstrdup(pool, path); /* be sure */
xmlctx = svn_ra_serf__xml_context_create(locks_ttable,
- NULL, locks_closed, lock_ctx,
+ NULL, locks_closed, NULL,
+ lock_ctx,
pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
@@ -471,7 +472,8 @@ svn_ra_serf__lock(svn_ra_session_t *ra_s
lock_ctx->path, iterpool);
xmlctx = svn_ra_serf__xml_context_create(locks_ttable,
- NULL, locks_closed, lock_ctx,
+ NULL, locks_closed, NULL,
+ lock_ctx,
iterpool);
handler = svn_ra_serf__create_expat_handler(xmlctx, iterpool);
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/log.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/log.c Mon Jun 11 08:06:26 2012
@@ -99,47 +99,47 @@ typedef struct log_context_t {
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t log_ttable[] = {
{ INITIAL, S_, "log-report", REPORT,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
/* Note that we have an opener here. We need to construct a new LOG_ENTRY
to record multiple paths. */
{ REPORT, S_, "log-item", ITEM,
- FALSE, { NULL }, TRUE, TRUE },
+ FALSE, { NULL }, TRUE },
{ ITEM, D_, SVN_DAV__VERSION_NAME, VERSION,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ ITEM, D_, "creator-displayname", CREATOR,
- TRUE, { "?encoding", NULL }, FALSE, TRUE },
+ TRUE, { "?encoding", NULL }, TRUE },
{ ITEM, S_, "date", DATE,
- TRUE, { "?encoding", NULL }, FALSE, TRUE },
+ TRUE, { "?encoding", NULL }, TRUE },
{ ITEM, D_, "comment", COMMENT,
- TRUE, { "?encoding", NULL }, FALSE, TRUE },
+ TRUE, { "?encoding", NULL }, TRUE },
{ ITEM, S_, "revprop", REVPROP,
- TRUE, { "name", "?encoding", NULL }, FALSE, TRUE },
+ TRUE, { "name", "?encoding", NULL }, TRUE },
{ ITEM, S_, "has-children", HAS_CHILDREN,
- FALSE, { NULL }, FALSE, TRUE },
+ FALSE, { NULL }, TRUE },
{ ITEM, S_, "subtractive-merge", SUBTRACTIVE_MERGE,
- FALSE, { NULL }, FALSE, TRUE },
+ FALSE, { NULL }, TRUE },
{ ITEM, S_, "added-path", ADDED_PATH,
TRUE, { "?node-kind", "?text-mods", "?prop-mods",
- "?copyfrom-path", "?copyfrom-rev", NULL }, FALSE, TRUE },
+ "?copyfrom-path", "?copyfrom-rev", NULL }, TRUE },
{ ITEM, S_, "replaced-path", REPLACED_PATH,
TRUE, { "?node-kind", "?text-mods", "?prop-mods",
- "?copyfrom-path", "?copyfrom-rev", NULL }, FALSE, TRUE },
+ "?copyfrom-path", "?copyfrom-rev", NULL }, TRUE },
{ ITEM, S_, "deleted-path", DELETED_PATH,
- TRUE, { "?node-kind", "?text-mods", "?prop-mods", NULL }, FALSE, TRUE },
+ TRUE, { "?node-kind", "?text-mods", "?prop-mods", NULL }, TRUE },
{ ITEM, S_, "modified-path", MODIFIED_PATH,
- TRUE, { "?node-kind", "?text-mods", "?prop-mods", NULL }, FALSE, TRUE },
+ TRUE, { "?node-kind", "?text-mods", "?prop-mods", NULL }, TRUE },
{ 0 }
};
@@ -237,15 +237,18 @@ static svn_error_t *
log_opened(svn_ra_serf__xml_estate_t *xes,
void *baton,
int entered_state,
+ const svn_ra_serf__dav_props_t *tag,
apr_pool_t *scratch_pool)
{
log_context_t *log_ctx = baton;
- apr_pool_t *state_pool = svn_ra_serf__xml_state_pool(xes);
- SVN_ERR_ASSERT(entered_state == ITEM);
+ if (entered_state == ITEM)
+ {
+ apr_pool_t *state_pool = svn_ra_serf__xml_state_pool(xes);
- log_ctx->collect_revprops = apr_hash_make(state_pool);
- log_ctx->collect_paths = apr_hash_make(state_pool);
+ log_ctx->collect_revprops = apr_hash_make(state_pool);
+ log_ctx->collect_paths = apr_hash_make(state_pool);
+ }
return SVN_NO_ERROR;
}
@@ -582,7 +585,8 @@ svn_ra_serf__get_log(svn_ra_session_t *r
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(log_ttable,
- log_opened, log_closed, log_ctx,
+ log_opened, log_closed, NULL,
+ log_ctx,
pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/merge.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/merge.c Mon Jun 11 08:06:26 2012
@@ -47,7 +47,7 @@
* This enum represents the current state of our XML parsing for a MERGE.
*/
typedef enum merge_state_e {
- NONE = 0,
+ INITIAL = 0,
MERGE_RESPONSE,
UPDATED_SET,
RESPONSE,
@@ -55,37 +55,21 @@ typedef enum merge_state_e {
PROPSTAT,
PROP,
RESOURCE_TYPE,
- AUTHOR,
- NAME,
- DATE,
- IGNORE_PROP_NAME,
- NEED_PROP_NAME,
- PROP_VAL
-} merge_state_e;
-
-typedef enum resource_type_e {
- UNSET,
BASELINE,
COLLECTION,
- CHECKED_IN
-} resource_type_e;
-
-typedef struct merge_info_t {
- /* Temporary allocations here please */
- apr_pool_t *pool;
-
- resource_type_e type;
-
- apr_hash_t *props;
+ SKIP_HREF,
+ CHECKED_IN,
+ VERSION_NAME,
+ DATE,
+ AUTHOR,
+ POST_COMMIT_ERR,
- const char *prop_ns;
- const char *prop_name;
- svn_stringbuf_t *prop_value;
+ PROP_VAL
+} merge_state_e;
-} merge_info_t;
/* Structure associated with a MERGE request. */
-struct svn_ra_serf__merge_context_t
+typedef struct merge_context_t
{
apr_pool_t *pool;
@@ -98,308 +82,194 @@ struct svn_ra_serf__merge_context_t
const char *merge_resource_url; /* URL of resource to be merged. */
const char *merge_url; /* URL at which the MERGE request is aimed. */
- svn_boolean_t done;
-
svn_commit_info_t *commit_info;
-};
-
-static merge_info_t *
-push_state(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__merge_context_t *ctx,
- merge_state_e state)
-{
- merge_info_t *info;
+} merge_context_t;
- svn_ra_serf__xml_push_state(parser, state);
- if (state == RESPONSE)
- {
- info = apr_palloc(parser->state->pool, sizeof(*info));
- info->pool = parser->state->pool;
- info->props = apr_hash_make(info->pool);
- info->prop_value = svn_stringbuf_create_empty(info->pool);
+#define D_ "DAV:"
+#define S_ SVN_XML_NAMESPACE
+static const svn_ra_serf__xml_transition_t merge_ttable[] = {
+ { INITIAL, D_, "merge-response", MERGE_RESPONSE,
+ FALSE, { NULL }, FALSE },
- parser->state->private = info;
- }
+ { MERGE_RESPONSE, D_, "updated-set", UPDATED_SET,
+ FALSE, { NULL }, FALSE },
- return parser->state->private;
-}
+ { UPDATED_SET, D_, "response", RESPONSE,
+ FALSE, { NULL }, TRUE },
-static svn_error_t *
-start_merge(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__dav_props_t name,
- const char **attrs,
- apr_pool_t *scratch_pool)
-{
- svn_ra_serf__merge_context_t *ctx = parser->user_data;
- merge_state_e state;
- merge_info_t *info;
+ { RESPONSE, D_, "href", HREF,
+ TRUE, { NULL }, TRUE },
- state = parser->state->current_state;
+ { RESPONSE, D_, "propstat", PROPSTAT,
+ FALSE, { NULL }, FALSE },
- if (state == NONE &&
- strcmp(name.name, "merge-response") == 0)
- {
- push_state(parser, ctx, MERGE_RESPONSE);
- }
- else if (state == NONE)
- {
- /* do nothing as we haven't seen our valid start tag yet. */
- }
- else if (state == MERGE_RESPONSE &&
- strcmp(name.name, "updated-set") == 0)
- {
- push_state(parser, ctx, UPDATED_SET);
- }
- else if (state == UPDATED_SET &&
- strcmp(name.name, "response") == 0)
- {
- push_state(parser, ctx, RESPONSE);
- }
- else if (state == RESPONSE &&
- strcmp(name.name, "href") == 0)
- {
- info = push_state(parser, ctx, PROP_VAL);
+#if 0
+ /* Not needed. */
+ { PROPSTAT, D_, "status", STATUS,
+ FALSE, { NULL }, FALSE },
+#endif
- info->prop_ns = name.namespace;
- info->prop_name = "href";
- svn_stringbuf_setempty(info->prop_value);
- }
- else if (state == RESPONSE &&
- strcmp(name.name, "propstat") == 0)
- {
- push_state(parser, ctx, PROPSTAT);
- }
- else if (state == PROPSTAT &&
- strcmp(name.name, "prop") == 0)
- {
- push_state(parser, ctx, PROP);
- }
- else if (state == PROPSTAT &&
- strcmp(name.name, "status") == 0)
- {
- /* Do nothing for now. */
- }
- else if (state == PROP &&
- strcmp(name.name, "resourcetype") == 0)
- {
- info = push_state(parser, ctx, RESOURCE_TYPE);
- info->type = UNSET;
- }
- else if (state == RESOURCE_TYPE &&
- strcmp(name.name, "baseline") == 0)
- {
- info = parser->state->private;
+ { PROPSTAT, D_, "prop", PROP,
+ FALSE, { NULL }, FALSE },
- info->type = BASELINE;
- }
- else if (state == RESOURCE_TYPE &&
- strcmp(name.name, "collection") == 0)
- {
- info = parser->state->private;
+ { PROP, D_, "resourcetype", RESOURCE_TYPE,
+ FALSE, { NULL }, FALSE },
- info->type = COLLECTION;
- }
- else if (state == PROP &&
- strcmp(name.name, "checked-in") == 0)
- {
- info = push_state(parser, ctx, IGNORE_PROP_NAME);
- info->prop_ns = name.namespace;
- info->prop_name = "checked-in";
- svn_stringbuf_setempty(info->prop_value);
- }
- else if (state == PROP)
- {
- push_state(parser, ctx, PROP_VAL);
- }
- else if (state == IGNORE_PROP_NAME)
- {
- push_state(parser, ctx, PROP_VAL);
- }
- else if (state == NEED_PROP_NAME)
- {
- info = push_state(parser, ctx, PROP_VAL);
- info->prop_ns = name.namespace;
- info->prop_name = apr_pstrdup(info->pool, name.name);
- svn_stringbuf_setempty(info->prop_value);
- }
- else
- {
- SVN_ERR_MALFUNCTION();
- }
+ { RESOURCE_TYPE, D_, "baseline", BASELINE,
+ FALSE, { NULL }, TRUE },
- return SVN_NO_ERROR;
-}
+ { RESOURCE_TYPE, D_, "collection", COLLECTION,
+ FALSE, { NULL }, TRUE },
+
+ { PROP, D_, "checked-in", SKIP_HREF,
+ FALSE, { NULL }, FALSE },
+
+ { SKIP_HREF, D_, "href", CHECKED_IN,
+ TRUE, { NULL }, TRUE },
+
+ { PROP, D_, SVN_DAV__VERSION_NAME, VERSION_NAME,
+ TRUE, { NULL }, TRUE },
+
+ { PROP, D_, SVN_DAV__CREATIONDATE, DATE,
+ TRUE, { NULL }, TRUE },
+
+ { PROP, D_, "creator-displayname", AUTHOR,
+ TRUE, { NULL }, TRUE },
+ { PROP, S_, "post-commit-err", POST_COMMIT_ERR,
+ TRUE, { NULL }, TRUE },
+
+ { 0 }
+};
+
+
+/* Conforms to svn_ra_serf__xml_closed_t */
static svn_error_t *
-end_merge(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__dav_props_t name,
- apr_pool_t *scratch_pool)
+merge_closed(svn_ra_serf__xml_estate_t *xes,
+ void *baton,
+ int leaving_state,
+ const svn_string_t *cdata,
+ apr_hash_t *attrs,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__merge_context_t *ctx = parser->user_data;
- merge_state_e state;
- merge_info_t *info;
+ merge_context_t *merge_ctx = baton;
- state = parser->state->current_state;
- info = parser->state->private;
-
- if (state == NONE)
+ if (leaving_state == RESPONSE)
{
- /* nothing to close yet. */
- return SVN_NO_ERROR;
- }
+ const char *rtype;
- if (state == RESPONSE &&
- strcmp(name.name, "response") == 0)
- {
- if (info->type == BASELINE)
+ rtype = apr_hash_get(attrs, "resourcetype", APR_HASH_KEY_STRING);
+
+ /* rtype can only be "baseline" or "collection" (or NULL). We can
+ keep this check simple. */
+ if (rtype && *rtype == 'b')
{
- const char *str;
+ const char *rev_str;
- str = apr_hash_get(info->props, SVN_DAV__VERSION_NAME,
- APR_HASH_KEY_STRING);
- if (str)
- {
- ctx->commit_info->revision = SVN_STR_TO_REV(str);
- }
+ rev_str = apr_hash_get(attrs, "revision", APR_HASH_KEY_STRING);
+ if (rev_str)
+ merge_ctx->commit_info->revision = SVN_STR_TO_REV(rev_str);
else
- {
- ctx->commit_info->revision = SVN_INVALID_REVNUM;
- }
+ merge_ctx->commit_info->revision = SVN_INVALID_REVNUM;
- ctx->commit_info->date =
- apr_pstrdup(ctx->pool,
- apr_hash_get(info->props, SVN_DAV__CREATIONDATE,
- APR_HASH_KEY_STRING));
-
- ctx->commit_info->author =
- apr_pstrdup(ctx->pool,
- apr_hash_get(info->props, "creator-displayname",
- APR_HASH_KEY_STRING));
-
- ctx->commit_info->post_commit_err =
- apr_pstrdup(ctx->pool,
- apr_hash_get(info->props,
+ merge_ctx->commit_info->date =
+ apr_pstrdup(merge_ctx->pool,
+ apr_hash_get(attrs, "date", APR_HASH_KEY_STRING));
+
+ merge_ctx->commit_info->author =
+ apr_pstrdup(merge_ctx->pool,
+ apr_hash_get(attrs, "author", APR_HASH_KEY_STRING));
+
+ merge_ctx->commit_info->post_commit_err =
+ apr_pstrdup(merge_ctx->pool,
+ apr_hash_get(attrs,
"post-commit-err", APR_HASH_KEY_STRING));
}
else
{
const char *href;
- href = apr_hash_get(info->props, "href", APR_HASH_KEY_STRING);
- if (! svn_urlpath__skip_ancestor(ctx->merge_url, href))
- {
- return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
- _("A MERGE response for '%s' is not "
- "a child of the destination ('%s')"),
- href, ctx->merge_url);
- }
+ href = svn_urlpath__skip_ancestor(
+ merge_ctx->merge_url,
+ apr_hash_get(attrs, "href", APR_HASH_KEY_STRING));
+
+ if (href == NULL)
+ return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+ _("A MERGE response for '%s' is not "
+ "a child of the destination ('%s')"),
+ href, merge_ctx->merge_url);
/* We now need to dive all the way into the WC to update the
- * base VCC url.
- */
- if ((! SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(ctx->session))
- && ctx->session->wc_callbacks->push_wc_prop)
+ base VCC url. */
+ if (!SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(merge_ctx->session)
+ && merge_ctx->session->wc_callbacks->push_wc_prop)
{
- svn_string_t checked_in_str;
const char *checked_in;
+ svn_string_t checked_in_str;
- /* From the above check, we know that CTX->MERGE_URL is
- an ancestor of HREF. All that remains is to
- determine if HREF is the same as CTX->MERGE_URL, or --
- if not -- its relative value as a child thereof. */
- href = svn_urlpath__skip_ancestor(ctx->merge_url, href);
-
- checked_in = apr_hash_get(info->props, "checked-in",
- APR_HASH_KEY_STRING);
+ checked_in = apr_hash_get(attrs,
+ "checked-in", APR_HASH_KEY_STRING);
checked_in_str.data = checked_in;
checked_in_str.len = strlen(checked_in);
- SVN_ERR(ctx->session->wc_callbacks->push_wc_prop(
- ctx->session->wc_callback_baton, href,
- SVN_RA_SERF__WC_CHECKED_IN_URL, &checked_in_str, info->pool));
+ SVN_ERR(merge_ctx->session->wc_callbacks->push_wc_prop(
+ merge_ctx->session->wc_callback_baton,
+ href,
+ SVN_RA_SERF__WC_CHECKED_IN_URL,
+ &checked_in_str,
+ scratch_pool));
}
}
-
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == PROPSTAT &&
- strcmp(name.name, "propstat") == 0)
- {
- svn_ra_serf__xml_pop_state(parser);
}
- else if (state == PROP &&
- strcmp(name.name, "prop") == 0)
+ else if (leaving_state == BASELINE)
{
- svn_ra_serf__xml_pop_state(parser);
+ svn_ra_serf__xml_note(xes, RESPONSE, "resourcetype", "baseline");
}
- else if (state == RESOURCE_TYPE &&
- strcmp(name.name, "resourcetype") == 0)
+ else if (leaving_state == COLLECTION)
{
- svn_ra_serf__xml_pop_state(parser);
+ svn_ra_serf__xml_note(xes, RESPONSE, "resourcetype", "collection");
}
- else if (state == IGNORE_PROP_NAME || state == NEED_PROP_NAME)
- {
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == PROP_VAL)
+ else
{
- const char *value;
+ const char *name;
+ const char *value = cdata->data;
- if (!info->prop_name)
+ if (leaving_state == HREF)
{
- /* ### gstein sez: dunno what this is about. */
- info->prop_name = apr_pstrdup(info->pool, name.name);
+ name = "href";
+ value = svn_urlpath__canonicalize(value, scratch_pool);
}
-
- if (strcmp(info->prop_name, "href") == 0)
- value = svn_urlpath__canonicalize(info->prop_value->data, info->pool);
+ else if (leaving_state == CHECKED_IN)
+ {
+ name = "checked-in";
+ value = svn_urlpath__canonicalize(value, scratch_pool);
+ }
+ else if (leaving_state == VERSION_NAME)
+ name = "revision";
+ else if (leaving_state == DATE)
+ name = "date";
+ else if (leaving_state == AUTHOR)
+ name = "author";
+ else if (leaving_state == POST_COMMIT_ERR)
+ name = "post-commit-err";
else
- value = apr_pstrmemdup(info->pool,
- info->prop_value->data, info->prop_value->len);
-
- /* Set our property. */
- apr_hash_set(info->props, info->prop_name, APR_HASH_KEY_STRING,
- value);
-
- info->prop_ns = NULL;
- info->prop_name = NULL;
- svn_stringbuf_setempty(info->prop_value);
+ SVN_ERR_MALFUNCTION();
- svn_ra_serf__xml_pop_state(parser);
+ svn_ra_serf__xml_note(xes, RESPONSE, name, value);
}
return SVN_NO_ERROR;
}
-static svn_error_t *
-cdata_merge(svn_ra_serf__xml_parser_t *parser,
- const char *data,
- apr_size_t len,
- apr_pool_t *scratch_pool)
-{
- svn_ra_serf__merge_context_t *ctx = parser->user_data;
- merge_state_e state;
- merge_info_t *info;
-
- UNUSED_CTX(ctx);
-
- state = parser->state->current_state;
- info = parser->state->private;
-
- if (state == PROP_VAL)
- svn_stringbuf_appendbytes(info->prop_value, data, len);
-
- return SVN_NO_ERROR;
-}
static svn_error_t *
setup_merge_headers(serf_bucket_t *headers,
void *baton,
apr_pool_t *pool)
{
- svn_ra_serf__merge_context_t *ctx = baton;
+ merge_context_t *ctx = baton;
if (!ctx->keep_locks)
{
@@ -464,7 +334,7 @@ create_merge_body(serf_bucket_t **bkt,
serf_bucket_alloc_t *alloc,
apr_pool_t *pool)
{
- svn_ra_serf__merge_context_t *ctx = baton;
+ merge_context_t *ctx = baton;
serf_bucket_t *body_bkt;
body_bkt = serf_bucket_aggregate_create(alloc);
@@ -506,21 +376,23 @@ create_merge_body(serf_bucket_t **bkt,
svn_error_t *
-svn_ra_serf__merge_create_req(svn_ra_serf__merge_context_t **ret_ctx,
- svn_ra_serf__session_t *session,
- svn_ra_serf__connection_t *conn,
- const char *merge_resource_url,
- apr_hash_t *lock_tokens,
- svn_boolean_t keep_locks,
- apr_pool_t *pool)
+svn_ra_serf__run_merge(const svn_commit_info_t **commit_info,
+ int *response_code,
+ svn_ra_serf__session_t *session,
+ svn_ra_serf__connection_t *conn,
+ const char *merge_resource_url,
+ apr_hash_t *lock_tokens,
+ svn_boolean_t keep_locks,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- svn_ra_serf__merge_context_t *merge_ctx;
+ merge_context_t *merge_ctx;
svn_ra_serf__handler_t *handler;
- svn_ra_serf__xml_parser_t *parser_ctx;
+ svn_ra_serf__xml_context_t *xmlctx;
- merge_ctx = apr_pcalloc(pool, sizeof(*merge_ctx));
+ merge_ctx = apr_pcalloc(scratch_pool, sizeof(*merge_ctx));
- merge_ctx->pool = pool;
+ merge_ctx->pool = result_pool;
merge_ctx->session = session;
merge_ctx->merge_resource_url = merge_resource_url;
@@ -528,13 +400,16 @@ svn_ra_serf__merge_create_req(svn_ra_ser
merge_ctx->lock_tokens = lock_tokens;
merge_ctx->keep_locks = keep_locks;
- merge_ctx->commit_info = svn_create_commit_info(pool);
+ merge_ctx->commit_info = svn_create_commit_info(result_pool);
merge_ctx->merge_url = session->session_url.path;
- handler = apr_pcalloc(pool, sizeof(*handler));
+ xmlctx = svn_ra_serf__xml_context_create(merge_ttable,
+ NULL, merge_closed, NULL,
+ merge_ctx,
+ scratch_pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, scratch_pool);
- handler->handler_pool = pool;
handler->method = "MERGE";
handler->path = merge_ctx->merge_url;
handler->body_delegate = create_merge_body;
@@ -542,44 +417,15 @@ svn_ra_serf__merge_create_req(svn_ra_ser
handler->conn = conn;
handler->session = session;
- parser_ctx = apr_pcalloc(pool, sizeof(*parser_ctx));
-
- parser_ctx->pool = pool;
- parser_ctx->user_data = merge_ctx;
- parser_ctx->start = start_merge;
- parser_ctx->end = end_merge;
- parser_ctx->cdata = cdata_merge;
- parser_ctx->done = &merge_ctx->done;
-
handler->header_delegate = setup_merge_headers;
handler->header_delegate_baton = merge_ctx;
- handler->response_handler = svn_ra_serf__handle_xml_parser;
- handler->response_baton = parser_ctx;
-
merge_ctx->handler = handler;
- svn_ra_serf__request_create(handler);
+ SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool));
- *ret_ctx = merge_ctx;
+ *commit_info = merge_ctx->commit_info;
+ *response_code = handler->sline.code;
return SVN_NO_ERROR;
}
-
-svn_boolean_t*
-svn_ra_serf__merge_get_done_ptr(svn_ra_serf__merge_context_t *ctx)
-{
- return &ctx->done;
-}
-
-svn_commit_info_t*
-svn_ra_serf__merge_get_commit_info(svn_ra_serf__merge_context_t *ctx)
-{
- return ctx->commit_info;
-}
-
-int
-svn_ra_serf__merge_get_status(svn_ra_serf__merge_context_t *ctx)
-{
- return ctx->handler->sline.code;
-}
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/mergeinfo.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/mergeinfo.c Mon Jun 11 08:06:26 2012
@@ -40,7 +40,7 @@
/* The current state of our XML parsing. */
typedef enum mergeinfo_state_e {
- NONE = 0,
+ INITIAL = 0,
MERGEINFO_REPORT,
MERGEINFO_ITEM,
MERGEINFO_PATH,
@@ -49,135 +49,88 @@ typedef enum mergeinfo_state_e {
/* Baton for accumulating mergeinfo. RESULT_CATALOG stores the final
mergeinfo catalog result we are going to hand back to the caller of
- get_mergeinfo. curr_path and curr_info contain the value of the
- CDATA from the mergeinfo items as we get them from the server. */
-
+ get_mergeinfo. */
typedef struct mergeinfo_context_t {
apr_pool_t *pool;
- svn_stringbuf_t *curr_path;
- svn_stringbuf_t *curr_info;
svn_mergeinfo_t result_catalog;
- svn_boolean_t done;
const apr_array_header_t *paths;
svn_revnum_t revision;
svn_mergeinfo_inheritance_t inherit;
svn_boolean_t include_descendants;
} mergeinfo_context_t;
-static svn_error_t *
-start_element(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__dav_props_t name,
- const char **attrs,
- apr_pool_t *scratch_pool)
-{
- mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
- mergeinfo_state_e state;
- state = parser->state->current_state;
- if (state == NONE && strcmp(name.name, SVN_DAV__MERGEINFO_REPORT) == 0)
- {
- svn_ra_serf__xml_push_state(parser, MERGEINFO_REPORT);
- }
- else if (state == MERGEINFO_REPORT &&
- strcmp(name.name, SVN_DAV__MERGEINFO_ITEM) == 0)
- {
- svn_ra_serf__xml_push_state(parser, MERGEINFO_ITEM);
- svn_stringbuf_setempty(mergeinfo_ctx->curr_path);
- svn_stringbuf_setempty(mergeinfo_ctx->curr_info);
- }
- else if (state == MERGEINFO_ITEM &&
- strcmp(name.name, SVN_DAV__MERGEINFO_PATH) == 0)
- {
- svn_ra_serf__xml_push_state(parser, MERGEINFO_PATH);
- }
- else if (state == MERGEINFO_ITEM &&
- strcmp(name.name, SVN_DAV__MERGEINFO_INFO) == 0)
- {
- svn_ra_serf__xml_push_state(parser, MERGEINFO_INFO);
- }
- return SVN_NO_ERROR;
-}
+#define D_ "DAV:"
+#define S_ SVN_XML_NAMESPACE
+static const svn_ra_serf__xml_transition_t mergeinfo_ttable[] = {
+ { INITIAL, S_, SVN_DAV__MERGEINFO_REPORT, MERGEINFO_REPORT,
+ FALSE, { NULL }, FALSE },
+
+ { MERGEINFO_REPORT, S_, SVN_DAV__MERGEINFO_ITEM, MERGEINFO_ITEM,
+ FALSE, { NULL }, TRUE },
+
+ { MERGEINFO_ITEM, S_, SVN_DAV__MERGEINFO_PATH, MERGEINFO_PATH,
+ TRUE, { NULL }, TRUE },
+
+ { MERGEINFO_ITEM, S_, SVN_DAV__MERGEINFO_INFO, MERGEINFO_INFO,
+ TRUE, { NULL }, TRUE },
+
+ { 0 }
+};
+
+/* Conforms to svn_ra_serf__xml_closed_t */
static svn_error_t *
-end_element(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__dav_props_t name,
- apr_pool_t *scratch_pool)
+mergeinfo_closed(svn_ra_serf__xml_estate_t *xes,
+ void *baton,
+ int leaving_state,
+ const svn_string_t *cdata,
+ apr_hash_t *attrs,
+ apr_pool_t *scratch_pool)
{
- mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
- mergeinfo_state_e state;
-
- state = parser->state->current_state;
+ mergeinfo_context_t *mergeinfo_ctx = baton;
- if (state == MERGEINFO_REPORT &&
- strcmp(name.name, SVN_DAV__MERGEINFO_REPORT) == 0)
- {
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == MERGEINFO_ITEM
- && strcmp(name.name, SVN_DAV__MERGEINFO_ITEM) == 0)
+ if (leaving_state == MERGEINFO_ITEM)
{
- if (mergeinfo_ctx->curr_info && mergeinfo_ctx->curr_path)
+ /* Placed here from the child elements. */
+ const char *path = apr_hash_get(attrs, "path", APR_HASH_KEY_STRING);
+ const char *info = apr_hash_get(attrs, "info", APR_HASH_KEY_STRING);
+
+ if (path != NULL && info != NULL)
{
svn_mergeinfo_t path_mergeinfo;
- const char *path;
- SVN_ERR_ASSERT(mergeinfo_ctx->curr_path->data);
- path = apr_pstrdup(mergeinfo_ctx->pool,
- mergeinfo_ctx->curr_path->data);
- SVN_ERR(svn_mergeinfo_parse(&path_mergeinfo,
- mergeinfo_ctx->curr_info->data,
- mergeinfo_ctx->pool));
/* Correct for naughty servers that send "relative" paths
with leading slashes! */
+ if (path[0] == '/')
+ ++path;
+
+ SVN_ERR(svn_mergeinfo_parse(&path_mergeinfo, info,
+ mergeinfo_ctx->pool));
+
apr_hash_set(mergeinfo_ctx->result_catalog,
- path[0] == '/' ? path + 1 : path,
- APR_HASH_KEY_STRING, path_mergeinfo);
+ apr_pstrdup(mergeinfo_ctx->pool, path),
+ APR_HASH_KEY_STRING,
+ path_mergeinfo);
}
- svn_ra_serf__xml_pop_state(parser);
}
- else if (state == MERGEINFO_PATH
- && strcmp(name.name, SVN_DAV__MERGEINFO_PATH) == 0)
+ else
{
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == MERGEINFO_INFO
- && strcmp(name.name, SVN_DAV__MERGEINFO_INFO) == 0)
- {
- svn_ra_serf__xml_pop_state(parser);
- }
- return SVN_NO_ERROR;
-}
-
+ SVN_ERR_ASSERT(leaving_state == MERGEINFO_PATH
+ || leaving_state == MERGEINFO_INFO);
-static svn_error_t *
-cdata_handler(svn_ra_serf__xml_parser_t *parser,
- const char *data,
- apr_size_t len,
- apr_pool_t *scratch_pool)
-{
- mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
- mergeinfo_state_e state;
-
- state = parser->state->current_state;
- switch (state)
- {
- case MERGEINFO_PATH:
- if (mergeinfo_ctx->curr_path)
- svn_stringbuf_appendbytes(mergeinfo_ctx->curr_path, data, len);
- break;
-
- case MERGEINFO_INFO:
- if (mergeinfo_ctx->curr_info)
- svn_stringbuf_appendbytes(mergeinfo_ctx->curr_info, data, len);
- break;
-
- default:
- break;
+ /* Stash the value onto the parent MERGEINFO_ITEM. */
+ svn_ra_serf__xml_note(xes, MERGEINFO_ITEM,
+ leaving_state == MERGEINFO_PATH
+ ? "path"
+ : "info",
+ cdata->data);
}
return SVN_NO_ERROR;
}
+
static svn_error_t *
create_mergeinfo_body(serf_bucket_t **bkt,
void *baton,
@@ -242,7 +195,7 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
mergeinfo_context_t *mergeinfo_ctx;
svn_ra_serf__session_t *session = ra_session->priv;
svn_ra_serf__handler_t *handler;
- svn_ra_serf__xml_parser_t *parser_ctx;
+ svn_ra_serf__xml_context_t *xmlctx;
const char *path;
*catalog = NULL;
@@ -254,18 +207,18 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
mergeinfo_ctx = apr_pcalloc(pool, sizeof(*mergeinfo_ctx));
mergeinfo_ctx->pool = pool;
- mergeinfo_ctx->curr_path = svn_stringbuf_create_empty(pool);
- mergeinfo_ctx->curr_info = svn_stringbuf_create_empty(pool);
- mergeinfo_ctx->done = FALSE;
mergeinfo_ctx->result_catalog = apr_hash_make(pool);
mergeinfo_ctx->paths = paths;
mergeinfo_ctx->revision = revision;
mergeinfo_ctx->inherit = inherit;
mergeinfo_ctx->include_descendants = include_descendants;
- handler = apr_pcalloc(pool, sizeof(*handler));
+ xmlctx = svn_ra_serf__xml_context_create(mergeinfo_ttable,
+ NULL, mergeinfo_closed, NULL,
+ mergeinfo_ctx,
+ pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
- handler->handler_pool = pool;
handler->method = "REPORT";
handler->path = path;
handler->conn = session->conns[0];
@@ -274,21 +227,7 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
handler->body_delegate_baton = mergeinfo_ctx;
handler->body_type = "text/xml";
- parser_ctx = apr_pcalloc(pool, sizeof(*parser_ctx));
-
- parser_ctx->pool = pool;
- parser_ctx->user_data = mergeinfo_ctx;
- parser_ctx->start = start_element;
- parser_ctx->end = end_element;
- parser_ctx->cdata = cdata_handler;
- parser_ctx->done = &mergeinfo_ctx->done;
-
- handler->response_handler = svn_ra_serf__handle_xml_parser;
- handler->response_baton = parser_ctx;
-
- svn_ra_serf__request_create(handler);
-
- err = svn_ra_serf__context_run_wait(&mergeinfo_ctx->done, session, pool);
+ err = svn_ra_serf__context_run_one(handler, pool);
err2 = svn_ra_serf__error_on_status(handler->sline.code, handler->path,
handler->location);
@@ -300,7 +239,7 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
SVN_ERR(err);
- if (mergeinfo_ctx->done && apr_hash_count(mergeinfo_ctx->result_catalog))
+ if (handler->done && apr_hash_count(mergeinfo_ctx->result_catalog))
*catalog = mergeinfo_ctx->result_catalog;
return SVN_NO_ERROR;
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/options.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/options.c Mon Jun 11 08:06:26 2012
@@ -78,13 +78,13 @@ typedef struct options_context_t {
#define S_ SVN_XML_NAMESPACE
static const svn_ra_serf__xml_transition_t options_ttable[] = {
{ INITIAL, D_, "options-response", OPTIONS,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ OPTIONS, D_, "activity-collection-set", ACTIVITY_COLLECTION,
- FALSE, { NULL }, FALSE, FALSE },
+ FALSE, { NULL }, FALSE },
{ ACTIVITY_COLLECTION, D_, "href", HREF,
- TRUE, { NULL }, FALSE, TRUE },
+ TRUE, { NULL }, TRUE },
{ 0 }
};
@@ -264,7 +264,7 @@ capabilities_headers_iterator_callback(v
/* A custom serf_response_handler_t which is mostly a wrapper around
- svn_ra_serf__handle_xml_parser -- it just notices OPTIONS response
+ the expat-based response handler -- it just notices OPTIONS response
headers first, before handing off to the xml parser.
Implements svn_ra_serf__response_handler_t */
static svn_error_t *
@@ -322,7 +322,8 @@ create_options_req(options_context_t **o
new_ctx->youngest_rev = SVN_INVALID_REVNUM;
xmlctx = svn_ra_serf__xml_context_create(options_ttable,
- NULL, options_closed, new_ctx,
+ NULL, options_closed, NULL,
+ new_ctx,
pool);
handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h Mon Jun 11 08:06:26 2012
@@ -618,11 +618,21 @@ typedef struct svn_ra_serf__xml_context_
/* An opaque structure for the XML parse element/state. */
typedef struct svn_ra_serf__xml_estate_t svn_ra_serf__xml_estate_t;
-/* Called just after the parser moves into ENTERED_STATE. */
+/* Called just after the parser moves into ENTERED_STATE. The tag causing
+ the transition is passed in TAG.
+
+ This callback is applied to a parsing context by using the
+ svn_ra_serf__xml_context_customize() function.
+
+ NOTE: this callback, when set, will be invoked on *every* transition.
+ The callback must examine ENTERED_STATE to determine if any action
+ must be taken. The original state is not provided, but must be derived
+ from ENTERED_STATE and/or the TAG causing the transition (if needed). */
typedef svn_error_t *
(*svn_ra_serf__xml_opened_t)(svn_ra_serf__xml_estate_t *xes,
void *baton,
int entered_state,
+ const svn_ra_serf__dav_props_t *tag,
apr_pool_t *scratch_pool);
@@ -632,8 +642,11 @@ typedef svn_error_t *
non-NULL and contain the collected cdata.
If attribute collection was enabled for this state, then ATTRS will
- contain the attributes collected for this element only. Use
- svn_ra_serf__xml_gather_since() to gather up data from outer states.
+ contain the attributes collected for this element only, along with
+ any values stored via svn_ra_serf__xml_note().
+
+ Use svn_ra_serf__xml_gather_since() to gather up data from outer states.
+
ATTRS is char* -> char*.
Temporary allocations may be made in SCRATCH_POOL. */
@@ -646,6 +659,16 @@ typedef svn_error_t *
apr_pool_t *scratch_pool);
+/* ### TBD */
+typedef svn_error_t *
+(*svn_ra_serf__xml_cdata_t)(svn_ra_serf__xml_estate_t *xes,
+ void *baton,
+ int current_state,
+ const char *data,
+ apr_size_t *len,
+ apr_pool_t *scratch_pool);
+
+
/* State transition table.
When the XML Context is constructed, it is in state 0. User states are
@@ -667,7 +690,8 @@ typedef struct svn_ra_serf__xml_transiti
/* Moving to this state */
int to_state;
- /* Should the cdata of NAME be collected? */
+ /* Should the cdata of NAME be collected? Note that CUSTOM_CLOSE should
+ be TRUE in order to capture this cdata. */
svn_boolean_t collect_cdata;
/* Which attributes of NAME should be collected? Terminate with NULL.
@@ -678,20 +702,19 @@ typedef struct svn_ra_serf__xml_transiti
exist on the element, or SVN_ERR_XML_ATTRIB_NOT_FOUND will be raised. */
const char *collect_attrs[11];
- /* When NAME is opened, should the callback be invoked? */
- svn_boolean_t custom_open;
-
/* When NAME is closed, should the callback be invoked? */
svn_boolean_t custom_close;
} svn_ra_serf__xml_transition_t;
+/* ### docco */
svn_ra_serf__xml_context_t *
svn_ra_serf__xml_context_create(
const svn_ra_serf__xml_transition_t *ttable,
svn_ra_serf__xml_opened_t opened_cb,
svn_ra_serf__xml_closed_t closed_cb,
+ svn_ra_serf__xml_cdata_t cdata_cb,
void *baton,
apr_pool_t *result_pool);
@@ -1221,17 +1244,6 @@ svn_ra_serf__get_resource_type(svn_kind_
/** MERGE-related functions **/
-typedef struct svn_ra_serf__merge_context_t svn_ra_serf__merge_context_t;
-
-svn_boolean_t*
-svn_ra_serf__merge_get_done_ptr(svn_ra_serf__merge_context_t *ctx);
-
-svn_commit_info_t*
-svn_ra_serf__merge_get_commit_info(svn_ra_serf__merge_context_t *ctx);
-
-int
-svn_ra_serf__merge_get_status(svn_ra_serf__merge_context_t *ctx);
-
void
svn_ra_serf__merge_lock_token_list(apr_hash_t *lock_tokens,
const char *parent,
@@ -1245,13 +1257,16 @@ svn_ra_serf__merge_lock_token_list(apr_h
client. If KEEP_LOCKS is set, instruct the server to not release
locks set on the paths included in this commit. */
svn_error_t *
-svn_ra_serf__merge_create_req(svn_ra_serf__merge_context_t **merge_ctx,
- svn_ra_serf__session_t *session,
- svn_ra_serf__connection_t *conn,
- const char *merge_resource_url,
- apr_hash_t *lock_tokens,
- svn_boolean_t keep_locks,
- apr_pool_t *pool);
+svn_ra_serf__run_merge(const svn_commit_info_t **commit_info,
+ int *response_code,
+ svn_ra_serf__session_t *session,
+ svn_ra_serf__connection_t *conn,
+ const char *merge_resource_url,
+ apr_hash_t *lock_tokens,
+ svn_boolean_t keep_locks,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/** OPTIONS-related functions **/
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/update.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/update.c Mon Jun 11 08:06:26 2012
@@ -1166,13 +1166,12 @@ handle_stream(serf_request_t *request,
/* not reached */
}
+/* Open the file associated with INFO for editing, pass along any
+ propchanges we've recorded for it, and then close the file. */
static svn_error_t *
handle_propchange_only(report_info_t *info,
apr_pool_t *scratch_pool)
{
- /* Open the file for editing (without forcing an apply_textdelta),
- pass along any propchanges we've recorded for it, and then close
- the file. */
SVN_ERR(open_updated_file(info, FALSE, scratch_pool));
SVN_ERR(close_updated_file(info, scratch_pool));
@@ -1187,13 +1186,13 @@ handle_propchange_only(report_info_t *in
/* "Fetch" a file whose contents were made available via the
get_wc_contents() callback (as opposed to requiring a GET to the
server), and feed the information through the associated update
- editor. */
+ editor. In editor-speak, this will add/open the file, transmit any
+ property changes, handle the contents, and then close the file. */
static svn_error_t *
-local_fetch(report_info_t *info,
- apr_pool_t *scratch_pool)
+handle_local_content(report_info_t *info,
+ apr_pool_t *scratch_pool)
{
SVN_ERR(open_updated_file(info, TRUE, scratch_pool));
-
SVN_ERR(svn_txdelta_send_stream(info->cached_contents, info->textdelta,
info->textdelta_baton, NULL, scratch_pool));
SVN_ERR(svn_stream_close(info->cached_contents));
@@ -1203,63 +1202,9 @@ local_fetch(report_info_t *info,
/* We're done with our pool. */
svn_pool_destroy(info->pool);
- return SVN_NO_ERROR;
-}
-
-/* Implements svn_ra_serf__response_handler_t */
-static svn_error_t *
-handle_local_fetch(serf_request_t *request,
- serf_bucket_t *response,
- void *handler_baton,
- apr_pool_t *pool)
-{
- report_fetch_t *fetch_ctx = handler_baton;
- apr_status_t status;
- svn_error_t *err;
- const char *data;
- apr_size_t len;
-
- /* ### new field. make sure we didn't miss some initialization. */
- SVN_ERR_ASSERT(fetch_ctx->handler != NULL);
-
- /* If the error code wasn't 200, something went wrong. Don't use the returned
- data as its probably an error message. Just bail out instead. */
- if (fetch_ctx->handler->sline.code != 200)
- {
- err = svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
- _("HEAD request failed: %d %s"),
- fetch_ctx->handler->sline.code,
- fetch_ctx->handler->sline.reason);
- return error_fetch(request, fetch_ctx, err);
- }
-
- while (1)
- {
- status = serf_bucket_read(response, 8000, &data, &len);
- if (SERF_BUCKET_READ_ERROR(status))
- {
- return svn_error_wrap_apr(status, NULL);
- }
- if (APR_STATUS_IS_EOF(status))
- {
- err = local_fetch(fetch_ctx->info, fetch_ctx->info->pool);
- if (err)
- {
- return error_fetch(request, fetch_ctx, err);
- }
+ info->dir->ref_count--;
- fetch_ctx->done = TRUE;
- fetch_ctx->done_item.data = fetch_ctx;
- fetch_ctx->done_item.next = *fetch_ctx->done_list;
- *fetch_ctx->done_list = &fetch_ctx->done_item;
- return svn_error_wrap_apr(status, NULL);
- }
- if (APR_STATUS_IS_EAGAIN(status))
- {
- return svn_error_wrap_apr(status, NULL);
- }
- }
- /* not reached */
+ return SVN_NO_ERROR;
}
/* --------------------------------------------------------- */
@@ -1332,43 +1277,35 @@ fetch_file(report_context_t *ctx, report
}
}
- /* If the working copy can provided cached contents for this
- file, we'll send a simple HEAD request (which I'll claim is
- to verify readability, but really is just so I can provide a
- Serf-queued-request-compliant way of processing the contents
- after the PROPFIND for the file's properties ... ugh).
-
- Otherwise, we use a GET request for the file's contents. */
+ /* If the working copy can provide cached contents for this
+ file, we don't have to fetch them from the server. */
if (info->cached_contents)
{
- report_fetch_t *fetch_ctx;
-
- fetch_ctx = apr_pcalloc(info->dir->pool, sizeof(*fetch_ctx));
- fetch_ctx->info = info;
- fetch_ctx->done_list = &ctx->done_fetches;
- fetch_ctx->sess = ctx->sess;
- fetch_ctx->conn = conn;
-
- handler = apr_pcalloc(info->dir->pool, sizeof(*handler));
-
- handler->handler_pool = info->dir->pool;
- handler->method = "HEAD";
- handler->path = fetch_ctx->info->url;
-
- handler->conn = conn;
- handler->session = ctx->sess;
-
- handler->response_handler = handle_local_fetch;
- handler->response_baton = fetch_ctx;
-
- fetch_ctx->handler = handler;
-
- svn_ra_serf__request_create(handler);
-
- ctx->active_fetches++;
+ /* If we'll be doing a PROPFIND for this file... */
+ if (info->propfind)
+ {
+ /* ... then we'll just leave ourselves a little "todo"
+ about that fact (and we'll deal with the file content
+ stuff later, after we've handled that PROPFIND
+ response. */
+ svn_ra_serf__list_t *list_item;
+
+ list_item = apr_pcalloc(info->dir->pool, sizeof(*list_item));
+ list_item->data = info;
+ list_item->next = ctx->file_propchanges_only;
+ ctx->file_propchanges_only = list_item;
+ }
+ else
+ {
+ /* Otherwise, if we've no PROPFIND to do, we might as
+ well take care of those locally accessible file
+ contents now. */
+ SVN_ERR(handle_local_content(info, info->pool));
+ }
}
else
{
+ /* Otherwise, we use a GET request for the file's contents. */
report_fetch_t *fetch_ctx;
fetch_ctx = apr_pcalloc(info->dir->pool, sizeof(*fetch_ctx));
@@ -2545,7 +2482,20 @@ finish_report(void *report_baton,
*/
if (cur)
{
- SVN_ERR(handle_propchange_only(cur->data, iterpool_inner));
+ report_info_t *info = cur->data;
+
+ /* If we've got cached file content for this file,
+ take care of the locally collected properties and
+ file content at once. Otherwise, just deal with
+ the collected properties. */
+ if (info->cached_contents)
+ {
+ SVN_ERR(handle_local_content(info, iterpool_inner));
+ }
+ else
+ {
+ SVN_ERR(handle_propchange_only(info, iterpool_inner));
+ }
if (!prev)
{
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/util.c Mon Jun 11 08:06:26 2012
@@ -1200,6 +1200,7 @@ start_xml(void *userData, const char *ra
svn_ra_serf__xml_parser_t *parser = userData;
svn_ra_serf__dav_props_t name;
apr_pool_t *scratch_pool;
+ svn_error_t *err;
if (parser->error)
return;
@@ -1214,7 +1215,11 @@ start_xml(void *userData, const char *ra
svn_ra_serf__expand_ns(&name, parser->state->ns_list, raw_name);
- parser->error = parser->start(parser, name, attrs, scratch_pool);
+ err = parser->start(parser, name, attrs, scratch_pool);
+ if (err && APR_STATUS_IS_EOF(err->apr_err))
+ err = svn_error_create(SVN_ERR_RA_SERF_WRAPPED_ERROR, err, NULL);
+
+ parser->error = err;
}
@@ -1224,6 +1229,7 @@ end_xml(void *userData, const char *raw_
{
svn_ra_serf__xml_parser_t *parser = userData;
svn_ra_serf__dav_props_t name;
+ svn_error_t *err;
apr_pool_t *scratch_pool;
if (parser->error)
@@ -1234,7 +1240,11 @@ end_xml(void *userData, const char *raw_
svn_ra_serf__expand_ns(&name, parser->state->ns_list, raw_name);
- parser->error = parser->end(parser, name, scratch_pool);
+ err = parser->end(parser, name, scratch_pool);
+ if (err && APR_STATUS_IS_EOF(err->apr_err))
+ err = svn_error_create(SVN_ERR_RA_SERF_WRAPPED_ERROR, err, NULL);
+
+ parser->error = err;
}
@@ -1243,6 +1253,7 @@ static void
cdata_xml(void *userData, const char *data, int len)
{
svn_ra_serf__xml_parser_t *parser = userData;
+ svn_error_t *err;
apr_pool_t *scratch_pool;
if (parser->error)
@@ -1254,7 +1265,11 @@ cdata_xml(void *userData, const char *da
/* ### get a real scratch_pool */
scratch_pool = parser->state->pool;
- parser->error = parser->cdata(parser, data, len, scratch_pool);
+ err = parser->cdata(parser, data, len, scratch_pool);
+ if (err && APR_STATUS_IS_EOF(err->apr_err))
+ err = svn_error_create(SVN_ERR_RA_SERF_WRAPPED_ERROR, err, NULL);
+
+ parser->error = err;
}
/* Flip the requisite bits in CTX to indicate that processing of the
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/xml.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/xml.c Mon Jun 11 08:06:26 2012
@@ -55,6 +55,7 @@ struct svn_ra_serf__xml_context_t {
/* The callback information. */
svn_ra_serf__xml_opened_t opened_cb;
svn_ra_serf__xml_closed_t closed_cb;
+ svn_ra_serf__xml_cdata_t cdata_cb;
void *baton;
/* Linked list of free states. */
@@ -448,6 +449,7 @@ svn_ra_serf__xml_context_create(
const svn_ra_serf__xml_transition_t *ttable,
svn_ra_serf__xml_opened_t opened_cb,
svn_ra_serf__xml_closed_t closed_cb,
+ svn_ra_serf__xml_cdata_t cdata_cb,
void *baton,
apr_pool_t *result_pool)
{
@@ -458,6 +460,7 @@ svn_ra_serf__xml_context_create(
xmlctx->ttable = ttable;
xmlctx->opened_cb = opened_cb;
xmlctx->closed_cb = closed_cb;
+ xmlctx->cdata_cb = cdata_cb;
xmlctx->baton = baton;
xmlctx->scratch_pool = svn_pool_create(result_pool);
@@ -557,6 +560,11 @@ svn_ra_serf__xml_cb_start(svn_ra_serf__x
if (scan->from_state != current->state)
continue;
+ /* Wildcard tag match. */
+ if (*scan->name == '*')
+ break;
+
+ /* Found a specific transition. */
if (strcmp(elemname.name, scan->name) == 0
&& strcmp(elemname.namespace, scan->ns) == 0)
break;
@@ -648,11 +656,12 @@ svn_ra_serf__xml_cb_start(svn_ra_serf__x
new_xes->prev = current;
xmlctx->current = new_xes;
- if (scan->custom_open)
+ if (xmlctx->opened_cb)
{
START_CALLBACK(xmlctx);
SVN_ERR(xmlctx->opened_cb(new_xes, xmlctx->baton,
- new_xes->state, xmlctx->scratch_pool));
+ new_xes->state, &new_xes->tag,
+ xmlctx->scratch_pool));
END_CALLBACK(xmlctx);
svn_pool_clear(xmlctx->scratch_pool);
}
Modified: subversion/branches/ev2-export/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_svn/marshal.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_ra_svn/marshal.c Mon Jun 11 08:06:26 2012
@@ -1150,7 +1150,7 @@ svn_error_t *svn_ra_svn_write_cmd(svn_ra
va_start(ap, fmt);
err = vwrite_tuple(conn, pool, fmt, ap);
va_end(ap);
- return err ? err : svn_ra_svn_end_list(conn, pool);
+ return err ? svn_error_trace(err) : svn_ra_svn_end_list(conn, pool);
}
svn_error_t *svn_ra_svn_write_cmd_response(svn_ra_svn_conn_t *conn,
@@ -1164,7 +1164,7 @@ svn_error_t *svn_ra_svn_write_cmd_respon
va_start(ap, fmt);
err = vwrite_tuple(conn, pool, fmt, ap);
va_end(ap);
- return err ? err : svn_ra_svn_end_list(conn, pool);
+ return err ? svn_error_trace(err) : svn_ra_svn_end_list(conn, pool);
}
svn_error_t *svn_ra_svn_write_cmd_failure(svn_ra_svn_conn_t *conn,
Modified: subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/sqlite.c Mon Jun 11 08:06:26 2012
@@ -50,8 +50,8 @@
#include <sqlite3.h>
#endif
-#if !SQLITE_VERSION_AT_LEAST(3,6,18)
-#error SQLite is too old -- version 3.6.18 is the minimum required version
+#if !SQLITE_VERSION_AT_LEAST(3,7,12)
+#error SQLite is too old -- version 3.7.12 is the minimum required version
#endif
INTERNAL_STATEMENTS_SQL_DECLARE_STATEMENTS(internal_statements);
@@ -685,16 +685,14 @@ internal_open(sqlite3 **db3, const char
else
SVN_ERR_MALFUNCTION();
- /* If this flag is defined (3.6.x), then let's turn off SQLite's mutexes.
- All svn objects are single-threaded, so we can already guarantee that
- our use of the SQLite handle will be serialized properly.
+ /* Turn off SQLite's mutexes. All svn objects are single-threaded,
+ so we can already guarantee that our use of the SQLite handle
+ will be serialized properly.
Note: in 3.6.x, we've already config'd SQLite into MULTITHREAD mode,
so this is probably redundant, but if we are running in a process where
somebody initialized SQLite before us it is needed anyway. */
-#ifdef SQLITE_OPEN_NOMUTEX
flags |= SQLITE_OPEN_NOMUTEX;
-#endif
/* Open the database. Note that a handle is returned, even when an error
occurs (except for out-of-memory); thus, we can safely use it to
@@ -813,23 +811,9 @@ svn_sqlite__open(svn_sqlite__db_t **db,
sqlite3_profile((*db)->db3, sqlite_profiler, (*db)->db3);
#endif
- /* Work around a bug in SQLite 3.7.7. The bug was fixed in SQLite 3.7.7.1.
-
- See:
-
- Date: Sun, 26 Jun 2011 18:52:14 -0400
- From: Richard Hipp <dr...@sqlite.org>
- To: General Discussion of SQLite Database <sq...@sqlite.org>
- Cc: dev@subversion.apache.org
- Subject: Re: [sqlite] PRAGMA bug in 3.7.7 (but fine in 3.7.6.3)
- Message-ID: <BA...@mail.gmail.com>
- */
+ /* ### simplify this. remnants of some old SQLite compat code. */
{
int ignored_err = SQLITE_OK;
-#if !SQLITE_VERSION_AT_LEAST(3,7,8) && defined(SQLITE_SCHEMA)
- if (!strcmp(sqlite3_libversion(), "3.7.7"))
- ignored_err = SQLITE_SCHEMA;
-#endif
SVN_ERR(exec_sql2(*db, "PRAGMA case_sensitive_like=1;", ignored_err));
}
@@ -853,7 +837,7 @@ svn_sqlite__open(svn_sqlite__db_t **db,
Requires SQLite >= 3.6.18 */
"PRAGMA recursive_triggers=ON;"));
-#if SQLITE_VERSION_AT_LEAST(3,6,19) && defined(SVN_DEBUG)
+#if defined(SVN_DEBUG)
/* When running in debug mode, enable the checking of foreign key
constraints. This has possible performance implications, so we don't
bother to do it for production...for now. */
Modified: subversion/branches/ev2-export/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/copy.c?rev=1348743&r1=1348742&r2=1348743&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_wc/copy.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_wc/copy.c Mon Jun 11 08:06:26 2012
@@ -466,7 +466,6 @@ copy_versioned_dir(svn_wc__db_t *db,
any conflict-marker files. */
if (disk_children && apr_hash_count(disk_children))
{
- apr_hash_index_t *hi;
apr_hash_t *marker_files;
SVN_ERR(svn_wc__db_get_conflict_marker_files(&marker_files, db,
@@ -551,7 +550,6 @@ copy_or_move(svn_wc_context_t *wc_ctx,
svn_wc__db_status_t src_status, dstdir_status;
const char *src_repos_root_url, *dst_repos_root_url;
const char *src_repos_uuid, *dst_repos_uuid;
- svn_error_t *err;
err = svn_wc__db_read_info(&src_status, &src_db_kind, NULL, NULL,
&src_repos_root_url, &src_repos_uuid, NULL,
@@ -664,7 +662,6 @@ copy_or_move(svn_wc_context_t *wc_ctx,
disk, before actually doing the file copy. */
{
svn_wc__db_status_t dst_status;
- svn_error_t *err;
err = svn_wc__db_read_info(&dst_status, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,