You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/05/24 14:20:06 UTC
svn commit: r1486034 - in /subversion/branches/fsfs-format7: ./
subversion/include/ subversion/include/private/ subversion/libsvn_ra_svn/
subversion/libsvn_subr/ subversion/svnserve/ tools/dist/
Author: stefan2
Date: Fri May 24 12:20:05 2013
New Revision: 1486034
URL: http://svn.apache.org/r1486034
Log:
On the fsfs-format7 branch: sync with /trunk up to and including r1486033.
Modified:
subversion/branches/fsfs-format7/ (props changed)
subversion/branches/fsfs-format7/subversion/include/private/svn_ra_svn_private.h
subversion/branches/fsfs-format7/subversion/include/svn_compat.h
subversion/branches/fsfs-format7/subversion/libsvn_ra_svn/marshal.c
subversion/branches/fsfs-format7/subversion/libsvn_subr/compat.c
subversion/branches/fsfs-format7/subversion/svnserve/serve.c
subversion/branches/fsfs-format7/tools/dist/make-deps-tarball.sh (contents, props changed)
Propchange: subversion/branches/fsfs-format7/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1485853-1486033
Modified: subversion/branches/fsfs-format7/subversion/include/private/svn_ra_svn_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/include/private/svn_ra_svn_private.h?rev=1486034&r1=1486033&r2=1486034&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/include/private/svn_ra_svn_private.h (original)
+++ subversion/branches/fsfs-format7/subversion/include/private/svn_ra_svn_private.h Fri May 24 12:20:05 2013
@@ -83,6 +83,15 @@ svn_ra_svn__write_word(svn_ra_svn_conn_t
apr_pool_t *pool,
const char *word);
+/** Write a boolean over the net.
+ *
+ * Writes will be buffered until the next read or flush.
+ */
+svn_error_t *
+svn_ra_svn__write_boolean(svn_ra_svn_conn_t *conn,
+ apr_pool_t *pool,
+ svn_boolean_t value);
+
/** Write a list of properties over the net. @a props is allowed to be NULL,
* in which case an empty list will be written out.
*
@@ -824,6 +833,53 @@ svn_ra_svn__write_cmd_finish_replay(svn_
/**
* @}
*/
+
+/**
+ * @defgroup svn_data sending data structures over ra_svn
+ * @{
+ */
+
+/** Send a changed path (as part of transmitting a log entry) over connection
+ * @a conn. Use @a pool for allocations.
+ *
+ * @see svn_log_changed_path2_t for a description of the other parameters.
+ */
+svn_error_t *
+svn_ra_svn__write_data_log_changed_path(svn_ra_svn_conn_t *conn,
+ apr_pool_t *pool,
+ const char *path,
+ char action,
+ const char *copyfrom_path,
+ svn_revnum_t copyfrom_rev,
+ svn_node_kind_t node_kind,
+ svn_boolean_t text_modified,
+ svn_boolean_t props_modified);
+
+/** Send a the details of a log entry (as part of transmitting a log entry
+ * and without revprops and changed paths) over connection @a conn.
+ * Use @a pool for allocations.
+ *
+ * @a author, @a date and @a message have been extracted and removed from
+ * the revprops to follow. @a has_children is taken directly from the
+ * #svn_log_entry_t struct. @a revision is too, except when it equals
+ * #SVN_INVALID_REVNUM. In that case, @a revision must be 0 and
+ * @a invalid_revnum be set to TRUE. @a revprop_count is the number of
+ * revprops that will follow in the revprops list.
+ */
+svn_error_t *
+svn_ra_svn__write_data_log_entry(svn_ra_svn_conn_t *conn,
+ apr_pool_t *pool,
+ svn_revnum_t revision,
+ const svn_string_t *author,
+ const svn_string_t *date,
+ const svn_string_t *message,
+ svn_boolean_t has_children,
+ svn_boolean_t invalid_revnum,
+ int revprop_count);
+
+/**
+ * @}
+ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/branches/fsfs-format7/subversion/include/svn_compat.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/include/svn_compat.h?rev=1486034&r1=1486033&r2=1486034&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/include/svn_compat.h (original)
+++ subversion/branches/fsfs-format7/subversion/include/svn_compat.h Fri May 24 12:20:05 2013
@@ -32,6 +32,7 @@
#include <apr_tables.h>
#include "svn_types.h"
+#include "svn_string.h"
#ifdef __cplusplus
extern "C" {
@@ -75,6 +76,17 @@ svn_compat_log_revprops_in(apr_pool_t *p
* revprops is NULL, all return values are NULL. Any return value may be
* NULL if the corresponding property is not set in @a revprops.
*
+ * @since New in 1.9.
+ */
+void
+svn_compat_log_revprops_out_string(const svn_string_t **author,
+ const svn_string_t **date,
+ const svn_string_t **message,
+ apr_hash_t *revprops);
+
+/** Simiar to #svn_compat_log_revprops_out2 but returns C-style strings
+ * instead of #svn_string_t.
+ *
* @since New in 1.5.
*/
void
Modified: subversion/branches/fsfs-format7/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_ra_svn/marshal.c?rev=1486034&r1=1486033&r2=1486034&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_ra_svn/marshal.c Fri May 24 12:20:05 2013
@@ -47,6 +47,7 @@
#include "private/svn_string_private.h"
#include "private/svn_dep_compat.h"
#include "private/svn_error_private.h"
+#include "private/svn_subr_private.h"
#define svn_iswhitespace(c) ((c) == ' ' || (c) == '\n')
@@ -62,6 +63,13 @@
*/
#define MAX_WORD_LENGTH 31
+/* The generic parsers will use the following value to limit the recursion
+ * depth to some reasonable value. The current protocol implementation
+ * actually uses only maximum item nesting level of around 5. So, there is
+ * plenty of headroom here.
+ */
+#define ITEM_NESTING_LIMIT 64
+
/* Return the APR socket timeout to be used for the connection depending
* on whether there is a blockage handler or zero copy has been activated. */
static apr_interval_time_t
@@ -517,21 +525,32 @@ svn_ra_svn__write_number(svn_ra_svn_conn
return write_number(conn, pool, number, ' ');
}
-svn_error_t *
-svn_ra_svn__write_string(svn_ra_svn_conn_t *conn,
- apr_pool_t *pool,
- const svn_string_t *str)
+static svn_error_t *
+svn_ra_svn__write_ncstring(svn_ra_svn_conn_t *conn,
+ apr_pool_t *pool,
+ const char *s,
+ apr_size_t len)
{
- if (str->len < 10)
+ if (len < 10)
{
- SVN_ERR(writebuf_writechar(conn, pool, (char)(str->len + '0')));
+ SVN_ERR(writebuf_writechar(conn, pool, (char)(len + '0')));
SVN_ERR(writebuf_writechar(conn, pool, ':'));
}
else
- SVN_ERR(write_number(conn, pool, str->len, ':'));
+ SVN_ERR(write_number(conn, pool, len, ':'));
- SVN_ERR(writebuf_write(conn, pool, str->data, str->len));
+ SVN_ERR(writebuf_write(conn, pool, s, len));
SVN_ERR(writebuf_writechar(conn, pool, ' '));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_ra_svn__write_string(svn_ra_svn_conn_t *conn,
+ apr_pool_t *pool,
+ const svn_string_t *str)
+{
+ svn_ra_svn__write_ncstring(conn, pool, str->data, str->len);
return SVN_NO_ERROR;
}
@@ -540,19 +559,7 @@ svn_ra_svn__write_cstring(svn_ra_svn_con
apr_pool_t *pool,
const char *s)
{
- apr_size_t len = strlen(s);
-
- if (len < 10)
- {
- SVN_ERR(writebuf_writechar(conn, pool, (char)(len + '0')));
- SVN_ERR(writebuf_writechar(conn, pool, ':'));
- }
- else
- SVN_ERR(write_number(conn, pool, len, ':'));
-
- SVN_ERR(writebuf_write(conn, pool, s, len));
- SVN_ERR(writebuf_writechar(conn, pool, ' '));
-
+ svn_ra_svn__write_ncstring(conn, pool, s, strlen(s));
return SVN_NO_ERROR;
}
@@ -568,31 +575,45 @@ svn_ra_svn__write_word(svn_ra_svn_conn_t
}
svn_error_t *
+svn_ra_svn__write_boolean(svn_ra_svn_conn_t *conn,
+ apr_pool_t *pool,
+ svn_boolean_t value)
+{
+ if (value)
+ SVN_ERR(writebuf_write_short_string(conn, pool, "true ", 5));
+ else
+ SVN_ERR(writebuf_write_short_string(conn, pool, "false ", 6));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
svn_ra_svn__write_proplist(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
apr_hash_t *props)
{
- apr_pool_t *iterpool;
apr_hash_index_t *hi;
- const void *key;
- void *val;
const char *propname;
svn_string_t *propval;
+ apr_size_t len;
+ /* One might use an iterpool here but that would only be used when the
+ send buffer gets flushed and only by the CONN's progress callback.
+ That should happen at most once for typical prop lists and even then
+ use only a few bytes at best.
+ */
if (props)
- {
- iterpool = svn_pool_create(pool);
- for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
- {
- svn_pool_clear(iterpool);
- apr_hash_this(hi, &key, NULL, &val);
- propname = key;
- propval = val;
- SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "cs",
- propname, propval));
- }
- svn_pool_destroy(iterpool);
- }
+ for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
+ {
+ apr_hash_this(hi, (const void **)&propname,
+ (apr_ssize_t *)&len,
+ (void **)&propval);
+
+ SVN_ERR(svn_ra_svn__start_list(conn, pool));
+ SVN_ERR(svn_ra_svn__write_ncstring(conn, pool, propname, len));
+ SVN_ERR(svn_ra_svn__write_string(conn, pool, propval));
+ SVN_ERR(svn_ra_svn__end_list(conn, pool));
+ }
return SVN_NO_ERROR;
}
@@ -710,8 +731,7 @@ vwrite_tuple_number(svn_ra_svn_conn_t *c
static svn_error_t *
vwrite_tuple_boolean(svn_ra_svn_conn_t *conn, apr_pool_t *pool, va_list *ap)
{
- const char *cstr = va_arg(*ap, svn_boolean_t) ? "true" : "false";
- return svn_ra_svn__write_word(conn, pool, cstr);
+ return svn_ra_svn__write_boolean(conn, pool, va_arg(*ap, svn_boolean_t));
}
static svn_error_t *
@@ -786,8 +806,7 @@ write_tuple_boolean(svn_ra_svn_conn_t *c
apr_pool_t *pool,
svn_boolean_t value)
{
- const char *cstr = value ? "true" : "false";
- return svn_ra_svn__write_word(conn, pool, cstr);
+ return svn_ra_svn__write_boolean(conn, pool, value);
}
static svn_error_t *
@@ -1009,9 +1028,9 @@ static svn_error_t *read_item(svn_ra_svn
svn_stringbuf_t *str;
svn_ra_svn_item_t *listitem;
- if (++level >= 64)
+ if (++level >= ITEM_NESTING_LIMIT)
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
- _("Too many nested items"));
+ _("Items are nested too deeply"));
/* Determine the item type and read it in. Make sure that c is the
@@ -1403,7 +1422,7 @@ svn_ra_svn__parse_proplist(const apr_arr
svn_ra_svn_item_t *elt;
int i;
- *props = apr_hash_make(pool);
+ *props = svn_hash__make(pool);
for (i = 0; i < list->nelts; i++)
{
elt = &APR_ARRAY_IDX(list, i, svn_ra_svn_item_t);
@@ -2348,3 +2367,59 @@ svn_error_t *svn_ra_svn__write_cmd_failu
}
return writebuf_write_short_string(conn, pool, ") ) ", 4);
}
+
+svn_error_t *
+svn_ra_svn__write_data_log_changed_path(svn_ra_svn_conn_t *conn,
+ apr_pool_t *pool,
+ const char *path,
+ char action,
+ const char *copyfrom_path,
+ svn_revnum_t copyfrom_rev,
+ svn_node_kind_t node_kind,
+ svn_boolean_t text_modified,
+ svn_boolean_t props_modified)
+{
+ SVN_ERR(write_tuple_start_list(conn, pool));
+
+ SVN_ERR(write_tuple_cstring(conn, pool, path));
+ SVN_ERR(writebuf_writechar(conn, pool, action));
+ SVN_ERR(writebuf_writechar(conn, pool, ' '));
+ SVN_ERR(write_tuple_start_list(conn, pool));
+ SVN_ERR(write_tuple_cstring_opt(conn, pool, copyfrom_path));
+ SVN_ERR(write_tuple_revision_opt(conn, pool, copyfrom_rev));
+ SVN_ERR(write_tuple_end_list(conn, pool));
+ SVN_ERR(write_tuple_start_list(conn, pool));
+ SVN_ERR(write_tuple_cstring(conn, pool, svn_node_kind_to_word(node_kind)));
+ SVN_ERR(write_tuple_boolean(conn, pool, text_modified));
+ SVN_ERR(write_tuple_boolean(conn, pool, props_modified));
+
+ return writebuf_write_short_string(conn, pool, ") ) ", 4);
+}
+
+svn_error_t *
+svn_ra_svn__write_data_log_entry(svn_ra_svn_conn_t *conn,
+ apr_pool_t *pool,
+ svn_revnum_t revision,
+ const svn_string_t *author,
+ const svn_string_t *date,
+ const svn_string_t *message,
+ svn_boolean_t has_children,
+ svn_boolean_t invalid_revnum,
+ int revprop_count)
+{
+ SVN_ERR(write_tuple_revision(conn, pool, revision));
+ SVN_ERR(write_tuple_start_list(conn, pool));
+ SVN_ERR(write_tuple_string_opt(conn, pool, author));
+ SVN_ERR(write_tuple_end_list(conn, pool));
+ SVN_ERR(write_tuple_start_list(conn, pool));
+ SVN_ERR(write_tuple_string_opt(conn, pool, date));
+ SVN_ERR(write_tuple_end_list(conn, pool));
+ SVN_ERR(write_tuple_start_list(conn, pool));
+ SVN_ERR(write_tuple_string_opt(conn, pool, message));
+ SVN_ERR(write_tuple_end_list(conn, pool));
+ SVN_ERR(write_tuple_boolean(conn, pool, has_children));
+ SVN_ERR(write_tuple_boolean(conn, pool, invalid_revnum));
+ SVN_ERR(svn_ra_svn__write_number(conn, pool, revprop_count));
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/fsfs-format7/subversion/libsvn_subr/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_subr/compat.c?rev=1486034&r1=1486033&r2=1486034&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_subr/compat.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_subr/compat.c Fri May 24 12:20:05 2013
@@ -95,23 +95,33 @@ svn_compat_log_revprops_in(apr_pool_t *p
}
void
-svn_compat_log_revprops_out(const char **author, const char **date,
- const char **message, apr_hash_t *revprops)
+svn_compat_log_revprops_out_string(const svn_string_t **author,
+ const svn_string_t **date,
+ const svn_string_t **message,
+ apr_hash_t *revprops)
{
- svn_string_t *author_s, *date_s, *message_s;
-
*author = *date = *message = NULL;
if (revprops)
{
- if ((author_s = svn_hash_gets(revprops, SVN_PROP_REVISION_AUTHOR)))
- *author = author_s->data;
- if ((date_s = svn_hash_gets(revprops, SVN_PROP_REVISION_DATE)))
- *date = date_s->data;
- if ((message_s = svn_hash_gets(revprops, SVN_PROP_REVISION_LOG)))
- *message = message_s->data;
+ *author = svn_hash_gets(revprops, SVN_PROP_REVISION_AUTHOR);
+ *date = svn_hash_gets(revprops, SVN_PROP_REVISION_DATE);
+ *message = svn_hash_gets(revprops, SVN_PROP_REVISION_LOG);
}
}
+void
+svn_compat_log_revprops_out(const char **author, const char **date,
+ const char **message, apr_hash_t *revprops)
+{
+ const svn_string_t *author_s, *date_s, *message_s;
+ svn_compat_log_revprops_out_string(&author_s, &date_s, &message_s,
+ revprops);
+
+ *author = author_s ? author_s->data : NULL;
+ *date = date_s ? date_s->data : NULL;
+ *message = message_s ? message_s->data : NULL;
+}
+
/* Baton for use with svn_compat_wrap_log_receiver */
struct log_wrapper_baton {
void *baton;
Modified: subversion/branches/fsfs-format7/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/svnserve/serve.c?rev=1486034&r1=1486033&r2=1486034&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/svnserve/serve.c (original)
+++ subversion/branches/fsfs-format7/subversion/svnserve/serve.c Fri May 24 12:20:05 2013
@@ -2091,7 +2091,7 @@ static svn_error_t *log_receiver(void *b
apr_hash_index_t *h;
svn_boolean_t invalid_revnum = FALSE;
char action[2];
- const char *author, *date, *message;
+ const svn_string_t *author, *date, *message;
apr_uint64_t revprop_count;
if (log_entry->revision == SVN_INVALID_REVNUM)
@@ -2108,7 +2108,19 @@ static svn_error_t *log_receiver(void *b
b->stack_depth--;
}
- SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "(!"));
+ svn_compat_log_revprops_out_string(&author, &date, &message,
+ log_entry->revprops);
+ svn_compat_log_revprops_clear(log_entry->revprops);
+ if (log_entry->revprops)
+ revprop_count = apr_hash_count(log_entry->revprops);
+ else
+ revprop_count = 0;
+
+ /* send LOG_ENTRY */
+ SVN_ERR(svn_ra_svn__start_list(conn, pool));
+
+ /* send LOG_ENTRY->CHANGED_PATHS2 */
+ SVN_ERR(svn_ra_svn__start_list(conn, pool));
if (log_entry->changed_paths2)
{
for (h = apr_hash_first(pool, log_entry->changed_paths2); h;
@@ -2117,34 +2129,36 @@ static svn_error_t *log_receiver(void *b
const char *path = svn__apr_hash_index_key(h);
svn_log_changed_path2_t *change = svn__apr_hash_index_val(h);
- action[0] = change->action;
- action[1] = '\0';
- SVN_ERR(svn_ra_svn__write_tuple(
- conn, pool, "cw(?cr)(cbb)",
+ SVN_ERR(svn_ra_svn__write_data_log_changed_path(
+ conn, pool,
path,
- action,
+ change->action,
change->copyfrom_path,
change->copyfrom_rev,
- svn_node_kind_to_word(change->node_kind),
+ change->node_kind,
/* text_modified and props_modified are never unknown */
change->text_modified == svn_tristate_true,
change->props_modified == svn_tristate_true));
}
}
- svn_compat_log_revprops_out(&author, &date, &message, log_entry->revprops);
- svn_compat_log_revprops_clear(log_entry->revprops);
- if (log_entry->revprops)
- revprop_count = apr_hash_count(log_entry->revprops);
- else
- revprop_count = 0;
- SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)r(?c)(?c)(?c)bbn(!",
- log_entry->revision,
- author, date, message,
- log_entry->has_children,
- invalid_revnum, revprop_count));
- SVN_ERR(svn_ra_svn__write_proplist(conn, pool, log_entry->revprops));
- SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)b",
- log_entry->subtractive_merge));
+ SVN_ERR(svn_ra_svn__end_list(conn, pool));
+
+ /* send LOG_ENTRY main members */
+ SVN_ERR(svn_ra_svn__write_data_log_entry(conn, pool,
+ log_entry->revision,
+ author, date, message,
+ log_entry->has_children,
+ invalid_revnum, revprop_count));
+
+ /* send LOG_ENTRY->REVPROPS */
+ SVN_ERR(svn_ra_svn__start_list(conn, pool));
+ if (revprop_count)
+ SVN_ERR(svn_ra_svn__write_proplist(conn, pool, log_entry->revprops));
+ SVN_ERR(svn_ra_svn__end_list(conn, pool));
+
+ /* send LOG_ENTRY members that were added in later SVN releases */
+ SVN_ERR(svn_ra_svn__write_boolean(conn, pool, log_entry->subtractive_merge));
+ SVN_ERR(svn_ra_svn__end_list(conn, pool));
if (log_entry->has_children)
b->stack_depth++;
Modified: subversion/branches/fsfs-format7/tools/dist/make-deps-tarball.sh
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/tools/dist/make-deps-tarball.sh?rev=1486034&r1=1486033&r2=1486034&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/tools/dist/make-deps-tarball.sh (original)
+++ subversion/branches/fsfs-format7/tools/dist/make-deps-tarball.sh Fri May 24 12:20:05 2013
@@ -25,7 +25,7 @@ APR=apr-1.4.6
APR_UTIL=apr-util-1.4.1
NEON=neon-0.29.6
SERF=serf-0.3.1
-ZLIB=zlib-1.2.7
+ZLIB=zlib-1.2.8
SQLITE_VERSION=3071400
SQLITE=sqlite-amalgamation-$SQLITE_VERSION
@@ -58,13 +58,13 @@ create_deps() {
fi
wget -qnc http://webdav.org/neon/$NEON.tar.gz
wget -qnc http://serf.googlecode.com/files/$SERF.tar.bz2
- wget -qnc http://www.zlib.net/$ZLIB.tar.bz2
+ wget -qnc http://www.zlib.net/$ZLIB.tar.gz
wget -qnc http://www.sqlite.org/$SQLITE.zip
mkdir $BASEDIR/unix-dependencies
cd $BASEDIR/unix-dependencies
tar zxf $TEMPDIR/$NEON.tar.gz
- tar jxf $TEMPDIR/$ZLIB.tar.bz2
+ tar zxf $TEMPDIR/$ZLIB.tar.gz
tar jxf $TEMPDIR/$SERF.tar.bz2
unzip -q $TEMPDIR/$SQLITE.zip
mv $NEON neon
@@ -80,7 +80,7 @@ create_deps() {
mkdir $BASEDIR/win32-dependencies
cd $BASEDIR/win32-dependencies
tar zxf $TEMPDIR/$NEON.tar.gz
- tar jxf $TEMPDIR/$ZLIB.tar.bz2
+ tar zxf $TEMPDIR/$ZLIB.tar.gz
tar jxf $TEMPDIR/$SERF.tar.bz2
unzip -q $TEMPDIR/$SQLITE.zip
mv $NEON neon
Propchange: subversion/branches/fsfs-format7/tools/dist/make-deps-tarball.sh
------------------------------------------------------------------------------
Merged /subversion/trunk/tools/dist/make-deps-tarball.sh:r1462840-1486033