You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/09/21 17:27:08 UTC
svn commit: r1704320 [2/4] - in /subversion/branches/move-tracking-2: ./
build/ build/generator/ build/generator/templates/ subversion/
subversion/bindings/javahl/native/jniwrapper/ subversion/include/
subversion/include/private/ subversion/libsvn_clie...
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/temp_serializer.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/temp_serializer.c Mon Sep 21 15:26:27 2015
@@ -599,7 +599,7 @@ svn_fs_fs__serialize_properties(void **d
/* create our auxiliary data structure */
properties.count = apr_hash_count(hash);
properties.keys = apr_palloc(pool, sizeof(const char*) * (properties.count + 1));
- properties.values = apr_palloc(pool, sizeof(const char*) * properties.count);
+ properties.values = apr_palloc(pool, sizeof(const svn_string_t *) * properties.count);
/* populate it with the hash entries */
for (hi = apr_hash_first(pool, hash), i=0; hi; hi = apr_hash_next(hi), ++i)
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/transaction.c Mon Sep 21 15:26:27 2015
@@ -968,10 +968,10 @@ get_and_increment_txn_key_body(void *bat
/* Increment the key and add a trailing \n to the string so the
txn-current file has a newline in it. */
- SVN_ERR(svn_io_write_atomic(txn_current_filename, new_id_str,
- line_length + 1,
- txn_current_filename /* copy_perms path */,
- pool));
+ SVN_ERR(svn_io_write_atomic2(txn_current_filename, new_id_str,
+ line_length + 1,
+ txn_current_filename /* copy_perms path */,
+ TRUE, pool));
return SVN_NO_ERROR;
}
@@ -1485,6 +1485,7 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
= svn_fs_fs__path_txn_node_children(fs, parent_noderev->id, pool);
apr_file_t *file;
svn_stream_t *out;
+ svn_filesize_t filesize;
fs_fs_data_t *ffd = fs->fsap_data;
apr_pool_t *subpool = svn_pool_create(pool);
@@ -1515,8 +1516,6 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
}
else
{
- const svn_io_dirent2_t *dirent;
-
/* The directory rep is already mutable, so just open it for append. */
SVN_ERR(svn_io_file_open(&file, filename, APR_WRITE | APR_APPEND,
APR_OS_DEFAULT, subpool));
@@ -1531,11 +1530,11 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
const char *key
= svn_fs_fs__id_unparse(parent_noderev->id, subpool)->data;
svn_boolean_t found;
- svn_filesize_t filesize;
+ svn_filesize_t cached_filesize;
/* Get the file size that corresponds to the cached contents
* (if any). */
- SVN_ERR(svn_cache__get_partial((void **)&filesize, &found,
+ SVN_ERR(svn_cache__get_partial((void **)&cached_filesize, &found,
ffd->txn_dir_cache, key,
svn_fs_fs__extract_dir_filesize,
NULL, subpool));
@@ -1544,10 +1543,9 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
* If not, we need to drop the cache entry. */
if (found)
{
- SVN_ERR(svn_io_stat_dirent2(&dirent, filename, FALSE, FALSE,
- subpool, subpool));
+ SVN_ERR(svn_io_file_size_get(&filesize, file, subpool));
- if (filesize != dirent->filesize)
+ if (cached_filesize != filesize)
SVN_ERR(svn_cache__set(ffd->txn_dir_cache, key, NULL,
subpool));
}
@@ -1571,6 +1569,12 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
}
/* Flush APR buffers. */
+ SVN_ERR(svn_io_file_flush(file, subpool));
+
+ /* Obtain final file size to update txn_dir_cache. */
+ SVN_ERR(svn_io_file_size_get(&filesize, file, subpool));
+
+ /* Close file. */
SVN_ERR(svn_io_file_close(file, subpool));
svn_pool_clear(subpool);
@@ -1582,13 +1586,9 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
svn_fs_fs__id_unparse(parent_noderev->id, subpool)->data;
replace_baton_t baton;
- const svn_io_dirent2_t *dirent;
- SVN_ERR(svn_io_stat_dirent2(&dirent, filename, FALSE, FALSE,
- subpool, subpool));
-
baton.name = name;
baton.new_entry = NULL;
- baton.txn_filesize = dirent->filesize;
+ baton.txn_filesize = filesize;
if (id)
{
@@ -1715,7 +1715,7 @@ allocate_item_index(apr_uint64_t *item_i
char buffer[SVN_INT64_BUFFER_SIZE] = { 0 };
svn_boolean_t eof = FALSE;
apr_size_t to_write;
- apr_size_t read;
+ apr_size_t bytes_read;
apr_off_t offset = 0;
/* read number, increment it and write it back to disk */
@@ -1724,8 +1724,8 @@ allocate_item_index(apr_uint64_t *item_i
APR_READ | APR_WRITE | APR_CREATE | APR_BUFFERED,
APR_OS_DEFAULT, pool));
SVN_ERR(svn_io_file_read_full2(file, buffer, sizeof(buffer)-1,
- &read, &eof, pool));
- if (read)
+ &bytes_read, &eof, pool));
+ if (bytes_read)
SVN_ERR(svn_cstring_atoui64(item_index, buffer));
else
*item_index = SVN_FS_FS__ITEM_INDEX_FIRST_USER;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c Mon Sep 21 15:26:27 2015
@@ -3273,6 +3273,14 @@ typedef struct fs_history_data_t
/* FALSE until the first call to svn_fs_history_prev(). */
svn_boolean_t is_interesting;
+
+ /* If not SVN_INVALID_REVISION, we know that the next copy operation
+ is at this revision. */
+ svn_revnum_t next_copy;
+
+ /* If not NULL, this is the noderev ID of PATH@REVISION. */
+ const svn_fs_id_t *current_id;
+
} fs_history_data_t;
static svn_fs_history_t *
@@ -3282,6 +3290,8 @@ assemble_history(svn_fs_t *fs,
svn_boolean_t is_interesting,
const char *path_hint,
svn_revnum_t rev_hint,
+ svn_revnum_t next_copy,
+ const svn_fs_id_t *current_id,
apr_pool_t *pool);
@@ -3308,7 +3318,8 @@ fs_node_history(svn_fs_history_t **histo
/* Okay, all seems well. Build our history object and return it. */
*history_p = assemble_history(root->fs, path, root->rev, FALSE, NULL,
- SVN_INVALID_REVNUM, result_pool);
+ SVN_INVALID_REVNUM, SVN_INVALID_REVNUM,
+ NULL, result_pool);
return SVN_NO_ERROR;
}
@@ -3609,10 +3620,50 @@ history_prev(svn_fs_history_t **prev_his
svn_boolean_t reported = fhd->is_interesting;
svn_revnum_t copyroot_rev;
const char *copyroot_path;
+ const svn_fs_id_t *pred_id = NULL;
/* Initialize our return value. */
*prev_history = NULL;
+ /* When following history, there tend to be long sections of linear
+ history where there are no copies at PATH or its parents. Within
+ these sections, we only need to follow the node history. */
+ if ( SVN_IS_VALID_REVNUM(fhd->next_copy)
+ && revision > fhd->next_copy
+ && fhd->current_id)
+ {
+ /* We know the last reported node (CURRENT_ID) and the NEXT_COPY
+ revision is somewhat further in the past. */
+ node_revision_t *noderev;
+ assert(reported);
+
+ /* Get the previous node change. If there is none, then we already
+ reported the initial addition and this history traversal is done. */
+ SVN_ERR(svn_fs_fs__get_node_revision(&noderev, fs, fhd->current_id,
+ scratch_pool, scratch_pool));
+ if (! noderev->predecessor_id)
+ return SVN_NO_ERROR;
+
+ /* If the previous node change is younger than the next copy, it is
+ part of the linear history section. */
+ commit_rev = svn_fs_fs__id_rev(noderev->predecessor_id);
+ if (commit_rev > fhd->next_copy)
+ {
+ /* Within the linear history, simply report all node changes and
+ continue with the respective predecessor. */
+ *prev_history = assemble_history(fs, noderev->created_path,
+ commit_rev, TRUE, NULL,
+ SVN_INVALID_REVNUM,
+ fhd->next_copy,
+ noderev->predecessor_id,
+ result_pool);
+
+ return SVN_NO_ERROR;
+ }
+
+ /* We hit a copy. Fall back to the standard code path. */
+ }
+
/* If our last history report left us hints about where to pickup
the chase, then our last report was on the destination of a
copy. If we are crossing copies, start from those locations,
@@ -3651,7 +3702,9 @@ history_prev(svn_fs_history_t **prev_his
need now to do so) ... */
*prev_history = assemble_history(fs, commit_path,
commit_rev, TRUE, NULL,
- SVN_INVALID_REVNUM, result_pool);
+ SVN_INVALID_REVNUM,
+ SVN_INVALID_REVNUM, NULL,
+ result_pool);
return SVN_NO_ERROR;
}
else
@@ -3659,8 +3712,6 @@ history_prev(svn_fs_history_t **prev_his
/* ... or we *have* reported on this revision, and must now
progress toward this node's predecessor (unless there is
no predecessor, in which case we're all done!). */
- const svn_fs_id_t *pred_id;
-
SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, node));
if (! pred_id)
return SVN_NO_ERROR;
@@ -3731,12 +3782,18 @@ history_prev(svn_fs_history_t **prev_his
retry = TRUE;
*prev_history = assemble_history(fs, path, dst_rev, ! retry,
- src_path, src_rev, result_pool);
+ src_path, src_rev,
+ SVN_INVALID_REVNUM, NULL,
+ result_pool);
}
else
{
+ /* We know the next copy revision. If we are not at the copy rev
+ itself, we will also know the predecessor node ID and the next
+ invocation will use the optimized "linear history" code path. */
*prev_history = assemble_history(fs, commit_path, commit_rev, TRUE,
- NULL, SVN_INVALID_REVNUM, result_pool);
+ NULL, SVN_INVALID_REVNUM,
+ copyroot_rev, pred_id, result_pool);
}
return SVN_NO_ERROR;
@@ -3767,10 +3824,12 @@ fs_history_prev(svn_fs_history_t **prev_
if (! fhd->is_interesting)
prev_history = assemble_history(fs, "/", fhd->revision,
1, NULL, SVN_INVALID_REVNUM,
+ SVN_INVALID_REVNUM, NULL,
result_pool);
else if (fhd->revision > 0)
prev_history = assemble_history(fs, "/", fhd->revision - 1,
1, NULL, SVN_INVALID_REVNUM,
+ SVN_INVALID_REVNUM, NULL,
result_pool);
}
else
@@ -3830,6 +3889,8 @@ assemble_history(svn_fs_t *fs,
svn_boolean_t is_interesting,
const char *path_hint,
svn_revnum_t rev_hint,
+ svn_revnum_t next_copy,
+ const svn_fs_id_t *current_id,
apr_pool_t *pool)
{
svn_fs_history_t *history = apr_pcalloc(pool, sizeof(*history));
@@ -3840,6 +3901,8 @@ assemble_history(svn_fs_t *fs,
fhd->path_hint = path_hint ? svn_fs__canonicalize_abspath(path_hint, pool)
: NULL;
fhd->rev_hint = rev_hint;
+ fhd->next_copy = next_copy;
+ fhd->current_id = current_id ? svn_fs_fs__id_copy(current_id, pool) : NULL;
fhd->fs = fs;
history->vtable = &history_vtable;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/util.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/util.c Mon Sep 21 15:26:27 2015
@@ -435,8 +435,9 @@ svn_fs_fs__write_min_unpacked_rev(svn_fs
final_path = svn_fs_fs__path_min_unpacked_rev(fs, scratch_pool);
- SVN_ERR(svn_io_write_atomic(final_path, buf, len + 1,
- final_path /* copy_perms */, scratch_pool));
+ SVN_ERR(svn_io_write_atomic2(final_path, buf, len + 1,
+ final_path /* copy_perms */, TRUE,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -517,8 +518,8 @@ svn_fs_fs__write_current(svn_fs_t *fs,
}
name = svn_fs_fs__path_current(fs, pool);
- SVN_ERR(svn_io_write_atomic(name, buf, strlen(buf),
- name /* copy_perms_path */, pool));
+ SVN_ERR(svn_io_write_atomic2(name, buf, strlen(buf),
+ name /* copy_perms_path */, TRUE, pool));
return SVN_NO_ERROR;
}
Propchange: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 21 15:26:27 2015
@@ -93,4 +93,4 @@
/subversion/branches/verify-keep-going/subversion/libsvn_fs_x:1439280-1492639,1546002-1546110
/subversion/branches/wc-collate-path/subversion/libsvn_fs_x:1402685-1480384
/subversion/trunk/subversion/libsvn_fs_fs:1415133-1596500,1596567,1597414,1597989,1598273,1599140,1600872,1601633,1603485-1603487,1603499,1603605,1604128,1604188,1604413-1604414,1604416-1604417,1604421,1604442,1604700,1604717,1604720,1604726,1604755,1604794,1604802,1604824,1604836,1604844,1604902-1604903,1604911,1604925,1604933,1604947,1605059-1605060,1605064-1605065,1605068,1605071-1605073,1605075,1605123,1605188-1605189,1605191,1605197,1605444,1605633,1606132,1606142,1606144,1606514,1606526,1606528,1606551,1606554,1606564,1606598-1606599,1606656,1606658,1606662,1606744,1606840,1607085,1607572,1612407,1612810,1613339,1613872,1614611,1615348,1615351-1615352,1615356,1616338-1616339,1616613,1617586,1617688,1618138,1618151,1618153,1618226,1618641,1618653,1618662,1619068,1619358,1619413,1619769,1619774,1620602,1620909,1620912,1620928,1620930,1621275,1621635,1622931,1622937,1622942,1622946,1622959-1622960,1622963,1622987,1623007,1623368,1623373,1623377,1623379,1623381,1623398,1623402,162
4011,1624265,1624512,1626246,1626871,1626873,1626886,1627497-1627498,1627502,1627947-1627949,1627966,1628083,1628093,1628158-1628159,1628161,1628392-1628393,1628415,1628427,1628676,1628738,1628762,1628764,1629854-1629855,1629857,1629865,1629873,1629875,1629879,1630067,1630070,1631049-1631051,1631075,1631115,1631171,1631180,1631185-1631186,1631196-1631197,1631239-1631240,1631548,1631550,1631563,1631567,1631588,1631598,1632646,1632776,1632849,1632851-1632853,1632856-1632857,1632868,1632908,1632926,1633232,1633617-1633618,1634872,1634875,1634879-1634880,1634920,1636478,1636483,1636629,1636644,1637184,1637186,1637330,1637358,1637363,1637393,1639319,1639322,1639335,1639348,1639352,1639355,1639358,1639414,1639419,1639426,1639430,1639436,1639440,1639549,1640061-1640062,1640197,1640915,1640966,1641013,1643139,1643233,1645567,1646021,1646712,1646716,1647537,1647540-1647541,1647820,1647905,1648230,1648238,1648241-1648243,1648253,1648272,1648532,1648537-1648539,1648542,1648591,1648612,1653608,
1658482
-/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1606692-1702602
+/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1606692-1704317
Propchange: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/dag_cache.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c Mon Sep 21 15:26:27 2015
@@ -198,8 +198,9 @@ svn_fs_x__write_format(svn_fs_t *fs,
}
else
{
- SVN_ERR(svn_io_write_atomic(path, sb->data, sb->len,
- NULL /* copy_perms_path */, scratch_pool));
+ SVN_ERR(svn_io_write_atomic2(path, sb->data, sb->len,
+ NULL /* copy_perms_path */,
+ TRUE, scratch_pool));
}
/* And set the perms to make it read only */
@@ -1070,10 +1071,10 @@ svn_fs_x__set_uuid(svn_fs_t *fs,
/* We use the permissions of the 'current' file, because the 'uuid'
file does not exist during repository creation. */
- SVN_ERR(svn_io_write_atomic(uuid_path, contents->data, contents->len,
- /* perms */
- svn_fs_x__path_current(fs, scratch_pool),
- scratch_pool));
+ SVN_ERR(svn_io_write_atomic2(uuid_path, contents->data, contents->len,
+ /* perms */
+ svn_fs_x__path_current(fs, scratch_pool),
+ TRUE, scratch_pool));
fs->uuid = apr_pstrdup(fs->pool, uuid);
ffd->instance_id = apr_pstrdup(fs->pool, instance_id);
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/index.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/index.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/index.c Mon Sep 21 15:26:27 2015
@@ -251,7 +251,7 @@ static svn_error_t *
packed_stream_read(svn_fs_x__packed_number_stream_t *stream)
{
unsigned char buffer[MAX_NUMBER_PREFETCH];
- apr_size_t read = 0;
+ apr_size_t bytes_read = 0;
apr_size_t i;
value_position_pair_t *target;
apr_off_t block_start = 0;
@@ -273,33 +273,34 @@ packed_stream_read(svn_fs_x__packed_numb
* boundaries. This shall prevent jumping back and forth between two
* blocks because the extra data was not actually request _now_.
*/
- read = sizeof(buffer);
+ bytes_read = sizeof(buffer);
block_left = stream->block_size - (stream->next_offset - block_start);
- if (block_left >= 10 && block_left < read)
- read = (apr_size_t)block_left;
+ if (block_left >= 10 && block_left < bytes_read)
+ bytes_read = (apr_size_t)block_left;
/* Don't read beyond the end of the file section that belongs to this
* index / stream. */
- read = (apr_size_t)MIN(read, stream->stream_end - stream->next_offset);
+ bytes_read = (apr_size_t)MIN(bytes_read,
+ stream->stream_end - stream->next_offset);
- err = apr_file_read(stream->file, buffer, &read);
+ err = apr_file_read(stream->file, buffer, &bytes_read);
if (err && !APR_STATUS_IS_EOF(err))
return stream_error_create(stream, err,
_("Can't read index file '%s' at offset 0x%"));
/* if the last number is incomplete, trim it from the buffer */
- while (read > 0 && buffer[read-1] >= 0x80)
- --read;
+ while (bytes_read > 0 && buffer[bytes_read-1] >= 0x80)
+ --bytes_read;
/* we call read() only if get() requires more data. So, there must be
* at least *one* further number. */
- if SVN__PREDICT_FALSE(read == 0)
+ if SVN__PREDICT_FALSE(bytes_read == 0)
return stream_error_create(stream, err,
_("Unexpected end of index file %s at offset 0x%"));
/* parse file buffer and expand into stream buffer */
target = stream->buffer;
- for (i = 0; i < read;)
+ for (i = 0; i < bytes_read;)
{
if (buffer[i] < 0x80)
{
@@ -505,13 +506,13 @@ read_uint64_from_proto_index(apr_file_t
apr_pool_t *scratch_pool)
{
apr_byte_t buffer[sizeof(*value_p)];
- apr_size_t read;
+ apr_size_t bytes_read;
/* Read the full 8 bytes or our 64 bit value, unless we hit EOF.
* Assert that we never read partial values. */
SVN_ERR(svn_io_file_read_full2(proto_index, buffer, sizeof(buffer),
- &read, eof, scratch_pool));
- SVN_ERR_ASSERT((eof && *eof) || read == sizeof(buffer));
+ &bytes_read, eof, scratch_pool));
+ SVN_ERR_ASSERT((eof && *eof) || bytes_read == sizeof(buffer));
/* If we did not hit EOF, reconstruct the uint64 value and return it. */
if (!eof || !*eof)
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c Mon Sep 21 15:26:27 2015
@@ -305,8 +305,8 @@ svn_fs_x__reset_revprop_generation_file(
* the current format. This ensures consistent on-disk state for new
* format repositories. */
SVN_ERR(checkedsummed_number(&buffer, 0, scratch_pool, scratch_pool));
- SVN_ERR(svn_io_write_atomic(path, buffer->data, buffer->len, NULL,
- scratch_pool));
+ SVN_ERR(svn_io_write_atomic2(path, buffer->data, buffer->len, NULL,
+ TRUE, scratch_pool));
/* ffd->revprop_generation_file will be re-opened on demand. */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c Mon Sep 21 15:26:27 2015
@@ -1557,7 +1557,7 @@ allocate_item_index(apr_uint64_t *item_i
char buffer[SVN_INT64_BUFFER_SIZE] = { 0 };
svn_boolean_t eof = FALSE;
apr_size_t to_write;
- apr_size_t read;
+ apr_size_t bytes_read;
apr_off_t offset = 0;
/* read number */
@@ -1568,8 +1568,8 @@ allocate_item_index(apr_uint64_t *item_i
| APR_CREATE | APR_BUFFERED,
APR_OS_DEFAULT, scratch_pool));
SVN_ERR(svn_io_file_read_full2(file, buffer, sizeof(buffer)-1,
- &read, &eof, scratch_pool));
- if (read)
+ &bytes_read, &eof, scratch_pool));
+ if (bytes_read)
SVN_ERR(svn_cstring_atoui64(item_index, buffer));
else
*item_index = SVN_FS_X__ITEM_INDEX_FIRST_USER;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c Mon Sep 21 15:26:27 2015
@@ -549,8 +549,9 @@ svn_fs_x__write_min_unpacked_rev(svn_fs_
final_path = svn_fs_x__path_min_unpacked_rev(fs, scratch_pool);
- SVN_ERR(svn_io_write_atomic(final_path, buf, len + 1,
- final_path /* copy_perms */, scratch_pool));
+ SVN_ERR(svn_io_write_atomic2(final_path, buf, len + 1,
+ final_path /* copy_perms */, TRUE,
+ scratch_pool));
return SVN_NO_ERROR;
}
Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/commit.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/commit.c Mon Sep 21 15:26:27 2015
@@ -1901,6 +1901,8 @@ apply_textdelta(void *file_baton,
void **handler_baton)
{
file_context_t *ctx = file_baton;
+ int svndiff_version;
+ int compression_level;
/* Store the stream in a temporary file; we'll give it to serf when we
* close this file.
@@ -1914,8 +1916,31 @@ apply_textdelta(void *file_baton,
ctx->stream = svn_stream_lazyopen_create(delayed_commit_stream_open,
ctx, FALSE, ctx->pool);
- svn_txdelta_to_svndiff3(handler, handler_baton, ctx->stream, 0,
- SVN_DELTA_COMPRESSION_LEVEL_DEFAULT, pool);
+ if (ctx->commit_ctx->session->supports_svndiff1 &&
+ ctx->commit_ctx->session->using_compression)
+ {
+ /* Use compressed svndiff1 format, if possible. */
+ svndiff_version = 1;
+ compression_level = SVN_DELTA_COMPRESSION_LEVEL_DEFAULT;
+ }
+ else
+ {
+ /* Difference between svndiff formats 0 and 1 that format 1 allows
+ * compression. Uncompressed svndiff0 should also be slightly more
+ * effective if the compression is not required at all.
+ *
+ * If the server cannot handle svndiff1, or compression is disabled
+ * with the 'http-compression = no' client configuration option, fall
+ * back to uncompressed svndiff0 format. As a bonus, users can force
+ * the usage of the uncompressed format by setting the corresponding
+ * client configuration option, if they want to.
+ */
+ svndiff_version = 0;
+ compression_level = SVN_DELTA_COMPRESSION_LEVEL_NONE;
+ }
+
+ svn_txdelta_to_svndiff3(handler, handler_baton, ctx->stream,
+ svndiff_version, compression_level, pool);
if (base_checksum)
ctx->base_checksum = apr_pstrdup(ctx->pool, base_checksum);
Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/options.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/options.c Mon Sep 21 15:26:27 2015
@@ -243,6 +243,20 @@ capabilities_headers_iterator_callback(v
apr_hash_set(session->supported_posts, "create-txn", 10, (void *)1);
}
+ /* Use compressed svndiff1 format for servers that speak HTTPv2.
+
+ Apache HTTPd + mod_dav_svn servers support svndiff1, beginning
+ from Subversion 1.4, but they do not advertise this capability.
+ Compressing data can have a noticeable impact if the connection
+ is slow, and we want to use it even for existing servers, so we
+ send svndiff1 data to every HTTPv2 server (Subversion 1.7 and
+ greater).
+
+ The reasoning behind enabling it with HTTPv2 is that if the user
+ is stuck with the old Subversion's HTTPv1 protocol, she probably
+ doesn't really care about performance. */
+ session->supports_svndiff1 = TRUE;
+
if (svn_cstring_casecmp(key, SVN_DAV_ROOT_URI_HEADER) == 0)
{
session->repos_root = session->session_url;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/ra_serf.h?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/ra_serf.h Mon Sep 21 15:26:27 2015
@@ -114,7 +114,7 @@ struct svn_ra_serf__session_t {
/* Are we using ssl */
svn_boolean_t using_ssl;
- /* Should we ask for compressed responses? */
+ /* Should we use compression for network transmissions? */
svn_boolean_t using_compression;
/* The user agent string */
@@ -255,6 +255,9 @@ struct svn_ra_serf__session_t {
/* Indicates whether the server supports issuing replay REPORTs
against rev resources (children of `rev_stub', elsestruct). */
svn_boolean_t supports_rev_rsrc_replay;
+
+ /* Indicates whether the server can understand svndiff version 1. */
+ svn_boolean_t supports_svndiff1;
};
#define SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(sess) ((sess)->me_resource != NULL)
Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/serf.c Mon Sep 21 15:26:27 2015
@@ -755,6 +755,7 @@ ra_serf_dup_session(svn_ra_session_t *ne
/* svn_boolean_t supports_inline_props */
/* supports_rev_rsrc_replay */
+ /* supports_svndiff1 */
new_sess->context = serf_context_create(result_pool);
Modified: subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c Mon Sep 21 15:26:27 2015
@@ -393,15 +393,15 @@ create_hooks(svn_repos_t *repos, apr_poo
"# e.g.: \"" SVN_RA_CAPABILITY_MERGEINFO ":some-other-capability\" " \
"(the order is undefined)." NL
"#" NL
+"# The list is self-reported by the client. Therefore, you should not" NL
+"# make security assumptions based on the capabilities list, nor should" NL
+"# you assume that clients reliably report every capability they have." NL
+"#" NL
"# Note: The TXN-NAME parameter is new in Subversion 1.8. Prior to version" NL
"# 1.8, the start-commit hook was invoked before the commit txn was even" NL
"# created, so the ability to inspect the commit txn and its metadata from" NL
"# within the start-commit hook was not possible." NL
"# " NL
-"# The list is self-reported by the client. Therefore, you should not" NL
-"# make security assumptions based on the capabilities list, nor should" NL
-"# you assume that clients reliably report every capability they have." NL
-"#" NL
"# If the hook program exits with success, the commit continues; but" NL
"# if it exits with failure (non-zero), the commit is stopped before" NL
"# a Subversion txn is created, and STDERR is returned to the client." NL;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/cache-membuffer.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/cache-membuffer.c Mon Sep 21 15:26:27 2015
@@ -339,9 +339,9 @@ prefix_pool_get_internal(apr_uint32_t *p
value = apr_hash_get(prefix_pool->map, prefix, prefix_len);
if (value != NULL)
{
- const apr_size_t index = value - prefix_pool->values;
- SVN_ERR_ASSERT(index < prefix_pool->values_used);
- *prefix_idx = (apr_uint32_t) index;
+ const apr_size_t idx = value - prefix_pool->values;
+ SVN_ERR_ASSERT(idx < prefix_pool->values_used);
+ *prefix_idx = (apr_uint32_t) idx;
return SVN_NO_ERROR;
}
Propchange: subversion/branches/move-tracking-2/subversion/libsvn_subr/cache-null.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/checksum.c Mon Sep 21 15:26:27 2015
@@ -373,26 +373,42 @@ svn_checksum_parse_hex(svn_checksum_t **
apr_pool_t *pool)
{
apr_size_t i, len;
- char is_nonzero = '\0';
- char *digest;
- static const char xdigitval[256] =
+ unsigned char is_nonzero = 0;
+ unsigned char *digest;
+ static const unsigned char xdigitval[256] =
{
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, /* 0-9 */
- -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A-F */
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* a-f */
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, /* 0-7 */
+ 0x08,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 8-9 */
+ 0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFF, /* A-F */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFF, /* a-f */
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
};
if (hex == NULL)
@@ -404,18 +420,18 @@ svn_checksum_parse_hex(svn_checksum_t **
SVN_ERR(validate_kind(kind));
*checksum = svn_checksum_create(kind, pool);
- digest = (char *)(*checksum)->digest;
+ digest = (unsigned char *)(*checksum)->digest;
len = DIGESTSIZE(kind);
for (i = 0; i < len; i++)
{
- char x1 = xdigitval[(unsigned char)hex[i * 2]];
- char x2 = xdigitval[(unsigned char)hex[i * 2 + 1]];
- if (x1 == (char)-1 || x2 == (char)-1)
+ unsigned char x1 = xdigitval[(unsigned char)hex[i * 2]];
+ unsigned char x2 = xdigitval[(unsigned char)hex[i * 2 + 1]];
+ if (x1 == 0xFF || x2 == 0xFF)
return svn_error_create(SVN_ERR_BAD_CHECKSUM_PARSE, NULL, NULL);
- digest[i] = (char)((x1 << 4) | x2);
- is_nonzero |= (char)((x1 << 4) | x2);
+ digest[i] = (x1 << 4) | x2;
+ is_nonzero |= digest[i];
}
if (!is_nonzero)
Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/deprecated.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/deprecated.c Mon Sep 21 15:26:27 2015
@@ -897,6 +897,18 @@ svn_io_file_rename(const char *from_path
FALSE, pool));
}
+svn_error_t *
+svn_io_write_atomic(const char *final_path,
+ const void *buf,
+ apr_size_t nbytes,
+ const char *copy_perms_path,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_trace(svn_io_write_atomic2(final_path, buf, nbytes,
+ copy_perms_path, TRUE,
+ scratch_pool));
+}
+
/*** From constructors.c ***/
svn_log_changed_path_t *
svn_log_changed_path_dup(const svn_log_changed_path_t *changed_path,
@@ -1066,6 +1078,12 @@ svn_stream_from_aprfile(apr_file_t *file
}
svn_error_t *
+svn_stream_for_stdin(svn_stream_t **in, apr_pool_t *pool)
+{
+ return svn_error_trace(svn_stream_for_stdin2(in, FALSE, pool));
+}
+
+svn_error_t *
svn_stream_contents_same(svn_boolean_t *same,
svn_stream_t *stream1,
svn_stream_t *stream2,
Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/io.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/io.c Mon Sep 21 15:26:27 2015
@@ -3994,11 +3994,12 @@ svn_io_write_unique(const char **tmp_pat
}
svn_error_t *
-svn_io_write_atomic(const char *final_path,
- const void *buf,
- apr_size_t nbytes,
- const char *copy_perms_path,
- apr_pool_t *scratch_pool)
+svn_io_write_atomic2(const char *final_path,
+ const void *buf,
+ apr_size_t nbytes,
+ const char *copy_perms_path,
+ svn_boolean_t flush_to_disk,
+ apr_pool_t *scratch_pool)
{
apr_file_t *tmp_file;
const char *tmp_path;
@@ -4011,7 +4012,7 @@ svn_io_write_atomic(const char *final_pa
err = svn_io_file_write_full(tmp_file, buf, nbytes, NULL, scratch_pool);
- if (!err)
+ if (!err && flush_to_disk)
err = svn_io_file_flush_to_disk(tmp_file, scratch_pool);
err = svn_error_compose_create(err,
@@ -4021,7 +4022,8 @@ svn_io_write_atomic(const char *final_pa
err = svn_io_copy_perms(copy_perms_path, tmp_path, scratch_pool);
if (!err)
- err = svn_io_file_rename2(tmp_path, final_path, TRUE, scratch_pool);
+ err = svn_io_file_rename2(tmp_path, final_path, flush_to_disk,
+ scratch_pool);
if (err)
{
Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/stream.c Mon Sep 21 15:26:27 2015
@@ -1728,122 +1728,17 @@ svn_stream_from_string(const svn_string_
return stream;
}
-/* Baton structure for buffering read stream wrappers.
- *
- * We read from INNER and append the data to BUFFER. From BUFFER, we serve
- * read requests. Old buffer contents gets discarded once it is no longer
- * needed.
- */
-struct buffering_stream_wrapper_baton
-{
- /* Our data source. */
- svn_stream_t *inner;
-
- /* Contains the data pre-read from INNER. Some of this may already have
- * been delivered. */
- svn_stringbuf_t *buffer;
-
- /* Current read position relative to the start of BUFFER->DATA. */
- apr_size_t buffer_pos;
-};
-
-/* Implements svn_stream_t.read_fn for buffering read stream wrappers. */
-static svn_error_t *
-read_handler_buffering_wrapper(void *baton,
- char *buffer,
- apr_size_t *len)
-{
- struct buffering_stream_wrapper_baton *btn = baton;
- apr_size_t left_to_read = btn->buffer->len - btn->buffer_pos;
-
- /* This is the "normal" and potential incomplete read function.
- * So, we only need to replenish our buffers if we ran completely dry. */
- if (left_to_read == 0)
- {
- apr_size_t count = btn->buffer->blocksize;
-
- /* Read from the INNER stream. */
- SVN_ERR(svn_stream_read2(btn->inner, btn->buffer->data, &count));
- btn->buffer->len = count;
- btn->buffer_pos = 0;
-
- /* We may now have more data that we could return. */
- left_to_read = btn->buffer->len;
- }
-
- /* Cap the read request to what we can deliver from the buffer. */
- if (left_to_read < *len)
- *len = left_to_read;
-
- /* Copy the data from the buffer and move the read pointer accordingly. */
- memcpy(buffer, btn->buffer->data + btn->buffer_pos, *len);
- btn->buffer_pos += *len;
-
- return SVN_NO_ERROR;
-}
-
-/* Implements svn_stream_t.data_available_fn for buffering read stream
- * wrappers. */
-static svn_error_t *
-data_available_handler_buffering_wrapper(void *baton,
- svn_boolean_t *data_available)
-{
- /* If we still have some unread data, this becomes easy to answer. */
- struct buffering_stream_wrapper_baton *btn = baton;
- if (btn->buffer->len > btn->buffer_pos)
- {
- *data_available = TRUE;
- return SVN_NO_ERROR;
- }
-
- /* Otherwise, because we would always read from the inner streams' current
- * position to fill the buffer, asking the inner stream when the buffer is
- * exhausted gives the correct answer. */
- return svn_error_trace(svn_stream_data_available(btn->inner,
- data_available));
-}
-
-/* Implements svn_stream_t.is_buffered_fn for buffering read stream wrappers.
- */
-static svn_boolean_t
-is_buffered_handler_buffering_wrapper(void *baton)
-{
- return TRUE;
-}
-
-svn_stream_t *
-svn_stream_wrap_buffered_read(svn_stream_t *inner,
- apr_pool_t *result_pool)
-{
- svn_stream_t *stream;
- struct buffering_stream_wrapper_baton *baton;
-
- /* Create the wrapper stream state.
- * The buffer is empty and we are at position 0. */
- baton = apr_pcalloc(result_pool, sizeof(*baton));
- baton->inner = inner;
- baton->buffer = svn_stringbuf_create_ensure(SVN__STREAM_CHUNK_SIZE,
- result_pool);
- baton->buffer_pos = 0;
-
- /* Create the wrapper stream object and set up the vtable. */
- stream = svn_stream_create(baton, result_pool);
- svn_stream_set_read2(stream, read_handler_buffering_wrapper, NULL);
- svn_stream_set_data_available(stream,
- data_available_handler_buffering_wrapper);
- svn_stream__set_is_buffered(stream, is_buffered_handler_buffering_wrapper);
-
- return stream;
-}
-
svn_error_t *
-svn_stream_for_stdin(svn_stream_t **in, apr_pool_t *pool)
+svn_stream_for_stdin2(svn_stream_t **in,
+ svn_boolean_t buffered,
+ apr_pool_t *pool)
{
apr_file_t *stdin_file;
apr_status_t apr_err;
- apr_err = apr_file_open_stdin(&stdin_file, pool);
+ apr_uint32_t flags = buffered ? APR_BUFFERED : 0;
+ apr_err = apr_file_open_flags_stdin(&stdin_file, flags, pool);
if (apr_err)
return svn_error_wrap_apr(apr_err, "Can't open stdin");
Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/utf.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/utf.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/utf.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/utf.c Mon Sep 21 15:26:27 2015
@@ -860,7 +860,6 @@ svn_utf_string_from_utf8(const svn_strin
const svn_string_t *src,
apr_pool_t *pool)
{
- svn_stringbuf_t *dbuf;
xlate_handle_node_t *node;
svn_error_t *err;
@@ -870,10 +869,15 @@ svn_utf_string_from_utf8(const svn_strin
{
err = check_utf8(src->data, src->len, pool);
if (! err)
- err = convert_to_stringbuf(node, src->data, src->len,
- &dbuf, pool);
- if (! err)
- *dest = svn_stringbuf__morph_into_string(dbuf);
+ {
+ svn_stringbuf_t *dbuf;
+
+ err = convert_to_stringbuf(node, src->data, src->len,
+ &dbuf, pool);
+
+ if (! err)
+ *dest = svn_stringbuf__morph_into_string(dbuf);
+ }
}
else
{
@@ -991,7 +995,6 @@ svn_utf_cstring_from_utf8_string(const c
const svn_string_t *src,
apr_pool_t *pool)
{
- svn_stringbuf_t *dbuf;
xlate_handle_node_t *node;
svn_error_t *err;
@@ -1001,10 +1004,14 @@ svn_utf_cstring_from_utf8_string(const c
{
err = check_utf8(src->data, src->len, pool);
if (! err)
- err = convert_to_stringbuf(node, src->data, src->len,
- &dbuf, pool);
- if (! err)
- *dest = dbuf->data;
+ {
+ svn_stringbuf_t *dbuf;
+
+ err = convert_to_stringbuf(node, src->data, src->len,
+ &dbuf, pool);
+ if (! err)
+ *dest = dbuf->data;
+ }
}
else
{
Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/utf8proc/utf8proc.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/utf8proc/utf8proc.h?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/utf8proc/utf8proc.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/utf8proc/utf8proc.h Mon Sep 21 15:26:27 2015
@@ -91,34 +91,34 @@
#include <stdlib.h>
#include <sys/types.h>
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
+#include <apr.h>
+#ifdef _MSC_VER
+typedef apr_int8_t int8_t;
+typedef apr_uint8_t uint8_t;
+typedef apr_int16_t int16_t;
+typedef apr_uint16_t uint16_t;
+typedef apr_int32_t int32_t;
+typedef apr_uint32_t uint32_t;
+#endif
+#endif
+
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#elif !defined(__cplusplus)
+typedef uint8_t bool;
+enum { false, true };
+#endif
+
#ifdef _MSC_VER
-# if _MSC_VER >= 1600
-# include <stdint.h>
-# else
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-# endif
-# if _MSC_VER >= 1800
-# include <stdbool.h>
-# else
-typedef unsigned char bool;
-enum {false, true};
-# endif
# ifdef _WIN64
# define ssize_t __int64
# else
# define ssize_t int
# endif
-#elif defined(HAVE_STDBOOL_H) && defined(HAVE_INTTYPES_H)
-#include <stdbool.h>
-#include <inttypes.h>
-#else
-#include <apr.h>
-typedef uint8_t bool;
-enum {false, true};
#endif
#include <limits.h>
Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c Mon Sep 21 15:26:27 2015
@@ -8764,6 +8764,45 @@ svn_wc__db_op_delete_many(svn_wc__db_t *
scratch_pool));
}
+/* Helper function for read_info() to provide better diagnostics than just
+ asserting.
+
+ ### BH: Yes this code is ugly, and that is why I only introduce it in
+ ### read_info(). But we really need something to determine the root cause
+ ### of this problem to diagnose why TortoiseSVN users were seeing all those
+ ### assertions.
+
+ Adds an error to the *err chain if invalid values are encountered. In that
+ case the value is set to the first value in the map, assuming that caller
+ will just return the combined error.
+ */
+static int
+column_token_err(svn_error_t **err,
+ svn_sqlite__stmt_t *stmt,
+ int column,
+ const svn_token_map_t *map)
+{
+ svn_error_t *err2;
+ const char *word = svn_sqlite__column_text(stmt, column, NULL);
+ int value;
+
+ /* svn_token__from_word_err() handles NULL for us */
+ err2 = svn_token__from_word_err(&value, map, word);
+
+ if (err2)
+ {
+ *err = svn_error_compose_create(
+ *err,
+ svn_error_createf(
+ SVN_ERR_WC_CORRUPT, err2,
+ _("Encountered invalid node state in column %d of "
+ "info query to working copy database"),
+ column));
+ value = map[0].val;
+ }
+
+ return value;
+}
/* Like svn_wc__db_read_info(), but taking WCROOT+LOCAL_RELPATH instead of
DB+LOCAL_ABSPATH, and outputting repos ids instead of URL+UUID. */
@@ -8831,11 +8870,11 @@ read_info(svn_wc__db_status_t *status,
svn_node_kind_t node_kind;
op_depth = svn_sqlite__column_int(stmt_info, 0);
- node_kind = svn_sqlite__column_token(stmt_info, 4, kind_map);
+ node_kind = column_token_err(&err, stmt_info, 4, kind_map);
if (status)
{
- *status = svn_sqlite__column_token(stmt_info, 3, presence_map);
+ *status = column_token_err(&err, stmt_info, 3, presence_map);
if (op_depth != 0) /* WORKING */
err = svn_error_compose_create(err,
@@ -8887,14 +8926,11 @@ read_info(svn_wc__db_status_t *status,
if (depth)
{
if (node_kind != svn_node_dir)
- {
- *depth = svn_depth_unknown;
- }
+ *depth = svn_depth_unknown;
+ else if (svn_sqlite__column_is_null(stmt_info, 11))
+ *depth = svn_depth_unknown;
else
- {
- *depth = svn_sqlite__column_token_null(stmt_info, 11, depth_map,
- svn_depth_unknown);
- }
+ *depth = column_token_err(&err, stmt_info, 11, depth_map);
}
if (checksum)
{
Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/workqueue.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/workqueue.c Mon Sep 21 15:26:27 2015
@@ -419,13 +419,13 @@ run_postupgrade(work_item_baton_t *wqb,
### The order may matter for some sufficiently old clients.. but
### this code only runs during upgrade after the files had been
### removed earlier during the upgrade. */
- SVN_ERR(svn_io_write_atomic(format_path, SVN_WC__NON_ENTRIES_STRING,
- sizeof(SVN_WC__NON_ENTRIES_STRING) - 1,
- NULL, scratch_pool));
+ SVN_ERR(svn_io_write_atomic2(format_path, SVN_WC__NON_ENTRIES_STRING,
+ sizeof(SVN_WC__NON_ENTRIES_STRING) - 1,
+ NULL, TRUE, scratch_pool));
- SVN_ERR(svn_io_write_atomic(entries_path, SVN_WC__NON_ENTRIES_STRING,
- sizeof(SVN_WC__NON_ENTRIES_STRING) - 1,
- NULL, scratch_pool));
+ SVN_ERR(svn_io_write_atomic2(entries_path, SVN_WC__NON_ENTRIES_STRING,
+ sizeof(SVN_WC__NON_ENTRIES_STRING) - 1,
+ NULL, TRUE, scratch_pool));
return SVN_NO_ERROR;
}
Modified: subversion/branches/move-tracking-2/subversion/mod_dav_svn/activity.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/mod_dav_svn/activity.c?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/mod_dav_svn/activity.c (original)
+++ subversion/branches/move-tracking-2/subversion/mod_dav_svn/activity.c Mon Sep 21 15:26:27 2015
@@ -208,9 +208,9 @@ dav_svn__store_activity(const dav_svn_re
activity_contents = apr_psprintf(repos->pool, "%s\n%s\n",
txn_name, activity_id);
- err = svn_io_write_atomic(final_path,
- activity_contents, strlen(activity_contents),
- NULL /* copy_perms path */, repos->pool);
+ err = svn_io_write_atomic2(final_path,
+ activity_contents, strlen(activity_contents),
+ NULL /* copy_perms path */, TRUE, repos->pool);
if (err)
{
svn_error_t *serr = svn_error_quick_wrap(err,
Modified: subversion/branches/move-tracking-2/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svn/cl.h?rev=1704320&r1=1704319&r2=1704320&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svn/cl.h (original)
+++ subversion/branches/move-tracking-2/subversion/svn/cl.h Mon Sep 21 15:26:27 2015
@@ -251,10 +251,13 @@ typedef struct svn_cl__opt_state_t
const char *show_item; /* print only the given item */
} svn_cl__opt_state_t;
+/* Conflict stats for operations such as update and merge. */
+typedef struct svn_cl__conflict_stats_t svn_cl__conflict_stats_t;
typedef struct svn_cl__cmd_baton_t
{
svn_cl__opt_state_t *opt_state;
+ svn_cl__conflict_stats_t *conflict_stats;
svn_client_ctx_t *ctx;
} svn_cl__cmd_baton_t;
@@ -346,9 +349,6 @@ svn_cl__check_cancel(void *baton);
typedef struct svn_cl__interactive_conflict_baton_t
svn_cl__interactive_conflict_baton_t;
-/* Conflict stats for operations such as update and merge. */
-typedef struct svn_cl__conflict_stats_t svn_cl__conflict_stats_t;
-
/* Return a new, initialized, conflict stats structure, allocated in
* POOL. */
svn_cl__conflict_stats_t *
@@ -402,6 +402,23 @@ svn_cl__conflict_func_interactive(svn_wc
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+
+svn_error_t *
+svn_cl__resolve_conflict(svn_boolean_t *resolved,
+ svn_cl__accept_t *accept_which,
+ svn_boolean_t *quit,
+ svn_boolean_t *external_failed,
+ svn_boolean_t *printed_summary,
+ svn_client_conflict_t *conflict,
+ const char *editor_cmd,
+ apr_hash_t *config,
+ const char *path_prefix,
+ svn_cmdline_prompt_baton_t *pb,
+ svn_cl__conflict_stats_t *conflict_stats,
+ svn_client_conflict_option_id_t option_id,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool);
+
/*** Command-line output functions -- printing to the user. ***/