You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/09/17 17:09:17 UTC

svn commit: r1703645 [2/3] - in /subversion/branches/reuse-ra-session: ./ build/generator/ build/generator/templates/ subversion/ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_delta/ subversion/libsvn_diff/...

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/repos.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/repos.c Thu Sep 17 15:09:12 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/reuse-ra-session/subversion/libsvn_repos/rev_hunt.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_repos/rev_hunt.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_repos/rev_hunt.c Thu Sep 17 15:09:12 2015
@@ -44,7 +44,7 @@
 
 /* Note:  this binary search assumes that the datestamp properties on
    each revision are in chronological order.  That is if revision A >
-   revision B, then A's datestamp is younger then B's datestamp.
+   revision B, then A's datestamp is younger than B's datestamp.
 
    If someone comes along and sets a bogus datestamp, this routine
    might not work right.

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-membuffer.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/cache-membuffer.c Thu Sep 17 15:09:12 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;
     }
 
@@ -1963,7 +1963,7 @@ svn_cache__membuffer_cache_create(svn_me
                  : data_size / 8;
 
   /* to keep the entries small, we use 32 bit indexes only
-   * -> we need to ensure that no more then 4G entries exist.
+   * -> we need to ensure that no more than 4G entries exist.
    *
    * Note, that this limit could only be exceeded in a very
    * theoretical setup with about 1EB of cache.

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/checksum.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/checksum.c Thu Sep 17 15:09:12 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/reuse-ra-session/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/deprecated.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/deprecated.c Thu Sep 17 15:09:12 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/reuse-ra-session/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/io.c Thu Sep 17 15:09:12 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)
     {
@@ -5112,7 +5114,7 @@ temp_file_create(apr_file_t **new_file,
 
       /* Generate a number that should be unique for this application and
          usually for the entire computer to reduce the number of cycles
-         through this loop. (A bit of calculation is much cheaper then
+         through this loop. (A bit of calculation is much cheaper than
          disk io) */
       unique_nr = baseNr + 3 * i;
 

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/stream.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/stream.c Thu Sep 17 15:09:12 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/reuse-ra-session/subversion/libsvn_subr/sysinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c Thu Sep 17 15:09:12 2015
@@ -46,6 +46,7 @@
 
 #include "private/svn_sqlite.h"
 #include "private/svn_subr_private.h"
+#include "private/svn_utf_private.h"
 
 #include "sysinfo.h"
 #include "svn_private_config.h"
@@ -126,7 +127,7 @@ const apr_array_header_t *
 svn_sysinfo__linked_libs(apr_pool_t *pool)
 {
   svn_version_ext_linked_lib_t *lib;
-  apr_array_header_t *array = apr_array_make(pool, 5, sizeof(*lib));
+  apr_array_header_t *array = apr_array_make(pool, 6, sizeof(*lib));
 
   lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
   lib->name = "APR";
@@ -157,6 +158,11 @@ svn_sysinfo__linked_libs(apr_pool_t *poo
 #endif
 
   lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
+  lib->name = "Utf8proc";
+  lib->compiled_version = apr_pstrdup(pool, svn_utf__utf8proc_compiled_version());
+  lib->runtime_version = apr_pstrdup(pool, svn_utf__utf8proc_runtime_version());
+
+  lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
   lib->name = "ZLib";
   lib->compiled_version = apr_pstrdup(pool, svn_zlib__compiled_version());
   lib->runtime_version = apr_pstrdup(pool, svn_zlib__runtime_version());

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf.c Thu Sep 17 15:09:12 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/reuse-ra-session/subversion/libsvn_subr/utf8proc.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf8proc.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf8proc.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf8proc.c Thu Sep 17 15:09:12 2015
@@ -37,7 +37,19 @@
 #undef strlen
 
 
-const char *svn_utf__utf8proc_version(void)
+
+const char *
+svn_utf__utf8proc_compiled_version(void)
+{
+  static const char utf8proc_version[] =
+                                  APR_STRINGIFY(UTF8PROC_VERSION_MAJOR) "."
+                                  APR_STRINGIFY(UTF8PROC_VERSION_MINOR) "."
+                                  APR_STRINGIFY(UTF8PROC_VERSION_PATCH);
+  return utf8proc_version;
+}
+
+const char *
+svn_utf__utf8proc_runtime_version(void)
 {
   /* Unused static function warning removal hack. */
   SVN_UNUSED(utf8proc_NFD);

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf8proc/utf8proc.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf8proc/utf8proc.h?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf8proc/utf8proc.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/utf8proc/utf8proc.h Thu Sep 17 15:09:12 2015
@@ -51,6 +51,27 @@
 #ifndef UTF8PROC_H
 #define UTF8PROC_H
 
+/** @name API version
+ *  
+ * The utf8proc API version MAJOR.MINOR.PATCH, following
+ * semantic-versioning rules (http://semver.org) based on API
+ * compatibility.
+ *
+ * This is also returned at runtime by @ref utf8proc_version; however, the
+ * runtime version may append a string like "-dev" to the version number
+ * for prerelease versions.
+ *
+ * @note The shared-library version number in the Makefile may be different,
+ *       being based on ABI compatibility rather than API compatibility.
+ */
+/** @{ */
+/** The MAJOR version number (increased when backwards API compatibility is broken). */
+#define UTF8PROC_VERSION_MAJOR 1
+/** The MINOR version number (increased when new functionality is added in a backwards-compatible manner). */
+#define UTF8PROC_VERSION_MINOR 1
+/** The PATCH version (increased for fixes that do not change the API). */
+#define UTF8PROC_VERSION_PATCH 5
+/** @} */
 
 /*
  * Define UTF8PROC_INLINE and include utf8proc.c to embed a static
@@ -70,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/reuse-ra-session/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/entries.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/entries.c Thu Sep 17 15:09:12 2015
@@ -1800,7 +1800,7 @@ write_entry(struct write_baton **entry_n
      normal         replace+copied        base       base+work
      add+copied     replace+copied        work       work+work
 
-     although obviously the node is a directory rather then a file.
+     although obviously the node is a directory rather than a file.
      There are then more conversion states where the parent is
      replaced.
 

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.c Thu Sep 17 15:09:12 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/reuse-ra-session/subversion/libsvn_wc/wc_db_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db_util.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db_util.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db_util.c Thu Sep 17 15:09:12 2015
@@ -127,7 +127,7 @@ svn_wc__db_util_open_db(svn_sqlite__db_t
     {
       svn_node_kind_t kind;
 
-      /* A file stat is much cheaper then a failed database open handled
+      /* A file stat is much cheaper than a failed database open handled
          by SQLite. */
       SVN_ERR(svn_io_check_path(sdb_abspath, &kind, scratch_pool));
 

Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/workqueue.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/workqueue.c Thu Sep 17 15:09:12 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/reuse-ra-session/subversion/mod_dav_svn/activity.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/activity.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/activity.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/activity.c Thu Sep 17 15:09:12 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/reuse-ra-session/subversion/po/it.po
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/po/it.po?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/po/it.po (original)
+++ subversion/branches/reuse-ra-session/subversion/po/it.po Thu Sep 17 15:09:12 2015
@@ -10134,7 +10134,7 @@ msgstr ""
 #: ../svn/propedit-cmd.c:158
 #, c-format
 msgid "Set new value for property '%s' on revision %ld\n"
-msgstr "Impostazione di un nuovo volore per la proprietà '%s' nella revisione %ld\n"
+msgstr "Impostazione di un nuovo valore per la proprietà '%s' nella revisione %ld\n"
 
 #: ../svn/propedit-cmd.c:164
 #, c-format

Modified: subversion/branches/reuse-ra-session/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svn/cl.h?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svn/cl.h (original)
+++ subversion/branches/reuse-ra-session/subversion/svn/cl.h Thu Sep 17 15:09:12 2015
@@ -402,6 +402,14 @@ 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_client_conflict_t *conflict,
+                         svn_client_ctx_t *ctx,
+                         svn_wc_conflict_choice_t conflict_choice,
+                         apr_pool_t *scratch_pool);
+
 
 /*** Command-line output functions -- printing to the user. ***/
 

Modified: subversion/branches/reuse-ra-session/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svn/conflict-callbacks.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svn/conflict-callbacks.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svn/conflict-callbacks.c Thu Sep 17 15:09:12 2015
@@ -40,6 +40,7 @@
 #include "cl-conflicts.h"
 
 #include "private/svn_cmdline_private.h"
+#include "private/svn_wc_private.h"
 
 #include "svn_private_config.h"
 
@@ -397,15 +398,13 @@ edit_prop_conflict(const svn_string_t **
   SVN_ERR(svn_stream_close(merged_prop));
   SVN_ERR(svn_io_file_flush(file, scratch_pool));
   SVN_ERR(open_editor(&performed_edit, file_path, b, scratch_pool));
-  if (performed_edit)
+  if (performed_edit && merged_propval)
     {
       svn_stringbuf_t *buf;
 
       SVN_ERR(svn_stringbuf_from_file2(&buf, file_path, scratch_pool));
       *merged_propval = svn_string_create_from_buf(buf, result_pool); 
     }
-  else
-    *merged_propval = NULL;
 
   return SVN_NO_ERROR;
 }
@@ -419,7 +418,7 @@ typedef struct resolver_option_t
   const char *code;        /* one or two characters */
   const char *short_desc;  /* label in prompt (localized) */
   const char *long_desc;   /* longer description (localized) */
-  svn_wc_conflict_choice_t choice;
+  svn_client_conflict_option_id_t choice;
                            /* or ..._undefined if not a simple choice */
 } resolver_option_t;
 
@@ -432,45 +431,45 @@ static const resolver_option_t text_conf
      brackets. */
   { "e",  N_("edit file"),        N_("change merged file in an editor"
                                      "  [edit]"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "df", N_("show diff"),        N_("show all changes made to merged file"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "r",  N_("mark resolved"),   N_("accept merged version of file  [working]"),
-                                  svn_wc_conflict_choose_merged },
-  { "",   "",                     "", svn_wc_conflict_choose_unspecified },
+                                  svn_client_conflict_option_merged_text },
+  { "",   "",                     "", svn_client_conflict_option_unspecified },
   { "dc", N_("display conflict"), N_("show all conflicts "
                                      "(ignoring merged version)"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "mc", N_("my side of conflict"), N_("accept my version for all conflicts "
                                         "(same)  [mine-conflict]"),
-                                  svn_wc_conflict_choose_mine_conflict },
+                                  svn_client_conflict_option_working_text_where_conflicted },
   { "tc", N_("their side of conflict"), N_("accept their version for all "
                                            "conflicts (same)"
                                            "  [theirs-conflict]"),
-                                  svn_wc_conflict_choose_theirs_conflict },
-  { "",   "",                     "", svn_wc_conflict_choose_unspecified },
+                                  svn_client_conflict_option_incoming_text_where_conflicted },
+  { "",   "",                     "", svn_client_conflict_option_unspecified },
   { "mf", N_("my version"),       N_("accept my version of entire file (even "
                                      "non-conflicts)  [mine-full]"),
-                                  svn_wc_conflict_choose_mine_full },
+                                  svn_client_conflict_option_working_text },
   { "tf", N_("their version"),    N_("accept their version of entire file "
                                      "(same)  [theirs-full]"),
-                                  svn_wc_conflict_choose_theirs_full },
-  { "",   "",                     "", svn_wc_conflict_choose_unspecified },
+                                  svn_client_conflict_option_incoming_text },
+  { "",   "",                     "", svn_client_conflict_option_unspecified },
   { "m",  N_("merge"),            N_("use merge tool to resolve conflict"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "l",  N_("launch tool"),      N_("launch external merge tool to resolve "
                                      "conflict  [launch]"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "i",  N_("internal merge tool"), N_("use built-in merge tool to "
                                      "resolve conflict"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "p",  N_("postpone"),         N_("mark the conflict to be resolved later"
                                      "  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "s",  N_("show all options"), N_("show this list (also 'h', '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -482,17 +481,17 @@ static const resolver_option_t binary_co
      brackets. */
   { "r",  N_("mark resolved"),   N_("accept the working copy version of file "
                                     " [working]"),
-                                  svn_wc_conflict_choose_merged },
+                                  svn_client_conflict_option_merged_text },
   { "tf", N_("their version"),    N_("accept the incoming version of file "
                                      " [theirs-full]"),
-                                  svn_wc_conflict_choose_theirs_full },
+                                  svn_client_conflict_option_incoming_text },
   { "p",  N_("postpone"),         N_("mark the conflict to be resolved later "
                                      " [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "s",  N_("show all options"), N_("show this list (also 'h', '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -501,24 +500,24 @@ static const resolver_option_t prop_conf
 {
   { "mf", N_("my version"),       N_("accept my version of entire property (even "
                                      "non-conflicts)  [mine-full]"),
-                                  svn_wc_conflict_choose_mine_full },
+                                  svn_client_conflict_option_working_text },
   { "tf", N_("their version"),    N_("accept their version of entire property "
                                      "(same)  [theirs-full]"),
-                                  svn_wc_conflict_choose_theirs_full },
+                                  svn_client_conflict_option_incoming_text },
   { "dc", N_("display conflict"), N_("show conflicts in this property"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "e",  N_("edit property"),    N_("change merged property value in an editor"
                                      "  [edit]"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { "r",  N_("mark resolved"),    N_("accept edited version of property"),
-                                  svn_wc_conflict_choose_merged },
+                                  svn_client_conflict_option_merged_text },
   { "p",  N_("postpone"),         N_("mark the conflict to be resolved later"
                                      "  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "h",  N_("help"),             N_("show this help (also '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -526,13 +525,13 @@ static const resolver_option_t prop_conf
 static const resolver_option_t tree_conflict_options[] =
 {
   { "r",  N_("mark resolved"),    N_("accept current working copy state"),
-                                  svn_wc_conflict_choose_merged },
+                                  svn_client_conflict_option_merged_text },
   { "p",  N_("postpone"),         N_("resolve the conflict later  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "h",  N_("help"),             N_("show this help (also '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -541,13 +540,13 @@ static const resolver_option_t tree_conf
   { "mc", N_("apply update to move destination (recommended)"),
                                   N_("apply incoming update to move destination"
                                      "  [mine-conflict]"),
-                                  svn_wc_conflict_choose_mine_conflict },
+                                  svn_client_conflict_option_working_text_where_conflicted },
   { "p",  N_("postpone"),         N_("resolve the conflict later  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "h",  N_("help"),             N_("show this help (also '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -556,13 +555,13 @@ static const resolver_option_t tree_conf
   { "mc", N_("prepare for updating moved-away children, if any (recommended)"),
                                   N_("allow updating moved-away children "
                                      "with 'svn resolve' [mine-conflict]"),
-                                  svn_wc_conflict_choose_mine_conflict },
+                                  svn_client_conflict_option_working_text_where_conflicted },
   { "p",  N_("postpone"),         N_("resolve the conflict later  [postpone]"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "q",  N_("quit resolution"),  N_("postpone all remaining conflicts"),
-                                  svn_wc_conflict_choose_postpone },
+                                  svn_client_conflict_option_postpone },
   { "h",  N_("help"),             N_("show this help (also '?')"),
-                                  svn_wc_conflict_choose_undefined },
+                                  svn_client_conflict_option_undefined },
   { NULL }
 };
 
@@ -707,7 +706,8 @@ prompt_user(const resolver_option_t **op
  * conflict resolution session.
  * SCRATCH_POOL is used for temporary allocations. */
 static svn_error_t *
-handle_text_conflict(svn_wc_conflict_result_t *result,
+handle_text_conflict(svn_client_conflict_option_id_t *option_id,
+                     svn_boolean_t *save_merged,
                      const svn_client_conflict_t *conflict,
                      svn_cl__interactive_conflict_baton_t *b,
                      apr_pool_t *scratch_pool)
@@ -716,7 +716,7 @@ handle_text_conflict(svn_wc_conflict_res
   svn_boolean_t diff_allowed = FALSE;
   /* Have they done something that might have affected the merged
      file (so that we need to save a .edited copy by setting the
-     result->save_merge flag)? */
+     *save_merge flag)? */
   svn_boolean_t performed_edit = FALSE;
   /* Have they done *something* (edit, look at diff, etc) to
      give them a rational basis for choosing (r)esolved? */
@@ -796,7 +796,7 @@ handle_text_conflict(svn_wc_conflict_res
         }
       else
         {
-          if (knows_something)
+          if (knows_something || is_binary)
             *next_option++ = "r";
 
           /* The 'mine-full' option selects the ".mine" file so only offer
@@ -816,7 +816,7 @@ handle_text_conflict(svn_wc_conflict_res
 
       if (strcmp(opt->code, "q") == 0)
         {
-          result->choice = opt->choice;
+          *option_id = opt->choice;
           b->accept_which = svn_cl__accept_postpone;
           b->quit = TRUE;
           break;
@@ -996,10 +996,10 @@ handle_text_conflict(svn_wc_conflict_res
           if (!remains_in_conflict)
             knows_something = TRUE;
         }
-      else if (opt->choice != svn_wc_conflict_choose_undefined)
+      else if (opt->choice != svn_client_conflict_option_undefined)
         {
-          if ((opt->choice == svn_wc_conflict_choose_mine_conflict
-               || opt->choice == svn_wc_conflict_choose_theirs_conflict)
+          if ((opt->choice == svn_client_conflict_option_working_text_where_conflicted
+               || opt->choice == svn_client_conflict_option_incoming_text_where_conflicted)
               && is_binary)
             {
               SVN_ERR(svn_cmdline_fprintf(stderr, iterpool,
@@ -1012,8 +1012,8 @@ handle_text_conflict(svn_wc_conflict_res
           /* We only allow the user accept the merged version of
              the file if they've edited it, or at least looked at
              the diff. */
-          if (opt->choice == svn_wc_conflict_choose_merged
-              && ! knows_something)
+          if (opt->choice == svn_client_conflict_option_merged_text
+              && ! knows_something && diff_allowed)
             {
               SVN_ERR(svn_cmdline_fprintf(
                         stderr, iterpool,
@@ -1022,9 +1022,9 @@ handle_text_conflict(svn_wc_conflict_res
               continue;
             }
 
-          result->choice = opt->choice;
-          if (performed_edit)
-            result->save_merged = TRUE;
+          *option_id = opt->choice;
+          if (performed_edit && save_merged)
+            *save_merged = TRUE;
           break;
         }
     }
@@ -1038,7 +1038,8 @@ handle_text_conflict(svn_wc_conflict_res
  * conflict resolution session.
  * SCRATCH_POOL is used for temporary allocations. */
 static svn_error_t *
-handle_prop_conflict(svn_wc_conflict_result_t *result,
+handle_prop_conflict(svn_client_conflict_option_id_t *option_id,
+                     const svn_string_t **merged_value,
                      const svn_client_conflict_t *conflict,
                      svn_cl__interactive_conflict_baton_t *b,
                      apr_pool_t *result_pool,
@@ -1097,7 +1098,7 @@ handle_prop_conflict(svn_wc_conflict_res
 
       if (strcmp(opt->code, "q") == 0)
         {
-          result->choice = opt->choice;
+          *option_id = opt->choice;
           b->accept_which = svn_cl__accept_postpone;
           b->quit = TRUE;
           break;
@@ -1126,13 +1127,13 @@ handle_prop_conflict(svn_wc_conflict_res
               continue;
             }
 
-          result->merged_value = merged_propval;
-          result->choice = svn_wc_conflict_choose_merged;
+          *merged_value = merged_propval;
+          *option_id = svn_client_conflict_option_merged_text;
           break;
         }
-      else if (opt->choice != svn_wc_conflict_choose_undefined)
+      else if (opt->choice != svn_client_conflict_option_undefined)
         {
-          result->choice = opt->choice;
+          *option_id = opt->choice;
           break;
         }
     }
@@ -1146,7 +1147,7 @@ handle_prop_conflict(svn_wc_conflict_res
  * conflict resolution session.
  * SCRATCH_POOL is used for temporary allocations. */
 static svn_error_t *
-handle_tree_conflict(svn_wc_conflict_result_t *result,
+handle_tree_conflict(svn_client_conflict_option_id_t *option_id,
                      const svn_client_conflict_t *conflict,
                      svn_cl__interactive_conflict_baton_t *b,
                      apr_pool_t *scratch_pool)
@@ -1236,14 +1237,14 @@ handle_tree_conflict(svn_wc_conflict_res
 
       if (strcmp(opt->code, "q") == 0)
         {
-          result->choice = opt->choice;
+          *option_id = opt->choice;
           b->accept_which = svn_cl__accept_postpone;
           b->quit = TRUE;
           break;
         }
-      else if (opt->choice != svn_wc_conflict_choose_undefined)
+      else if (opt->choice != svn_client_conflict_option_undefined)
         {
-          result->choice = opt->choice;
+          *option_id = opt->choice;
           break;
         }
     }
@@ -1254,7 +1255,9 @@ handle_tree_conflict(svn_wc_conflict_res
 
 /* The body of svn_cl__conflict_func_interactive(). */
 static svn_error_t *
-conflict_func_interactive(svn_wc_conflict_result_t **result,
+conflict_func_interactive(svn_client_conflict_option_id_t *option_id,
+                          svn_boolean_t *save_merged,
+                          const svn_string_t **merged_propval,
                           const svn_client_conflict_t *conflict,
                           void *baton,
                           apr_pool_t *result_pool,
@@ -1275,8 +1278,7 @@ conflict_func_interactive(svn_wc_conflic
                                                   scratch_pool));
 
   /* Start out assuming we're going to postpone the conflict. */
-  *result = svn_wc_create_conflict_result(svn_wc_conflict_choose_postpone,
-                                          NULL, result_pool);
+  *option_id = svn_client_conflict_option_postpone;
 
   switch (b->accept_which)
     {
@@ -1285,32 +1287,32 @@ conflict_func_interactive(svn_wc_conflic
       /* No (or no valid) --accept option, fall through to prompting. */
       break;
     case svn_cl__accept_postpone:
-      (*result)->choice = svn_wc_conflict_choose_postpone;
+      *option_id = svn_client_conflict_option_postpone;
       return SVN_NO_ERROR;
     case svn_cl__accept_base:
-      (*result)->choice = svn_wc_conflict_choose_base;
+      *option_id = svn_client_conflict_option_base_text;
       return SVN_NO_ERROR;
     case svn_cl__accept_working:
-      (*result)->choice = svn_wc_conflict_choose_merged;
+      *option_id = svn_client_conflict_option_merged_text;
       return SVN_NO_ERROR;
     case svn_cl__accept_mine_conflict:
-      (*result)->choice = svn_wc_conflict_choose_mine_conflict;
+      *option_id = svn_client_conflict_option_working_text_where_conflicted;
       return SVN_NO_ERROR;
     case svn_cl__accept_theirs_conflict:
-      (*result)->choice = svn_wc_conflict_choose_theirs_conflict;
+      *option_id = svn_client_conflict_option_incoming_text_where_conflicted;
       return SVN_NO_ERROR;
     case svn_cl__accept_mine_full:
-      (*result)->choice = svn_wc_conflict_choose_mine_full;
+      *option_id = svn_client_conflict_option_working_text;
       return SVN_NO_ERROR;
     case svn_cl__accept_theirs_full:
-      (*result)->choice = svn_wc_conflict_choose_theirs_full;
+      *option_id = svn_client_conflict_option_incoming_text;
       return SVN_NO_ERROR;
     case svn_cl__accept_edit:
       if (merged_abspath)
         {
           if (b->external_failed)
             {
-              (*result)->choice = svn_wc_conflict_choose_postpone;
+              *option_id = svn_client_conflict_option_postpone;
               return SVN_NO_ERROR;
             }
 
@@ -1331,7 +1333,7 @@ conflict_func_interactive(svn_wc_conflic
             }
           else if (err)
             return svn_error_trace(err);
-          (*result)->choice = svn_wc_conflict_choose_merged;
+          *option_id = svn_client_conflict_option_merged_text;
           return SVN_NO_ERROR;
         }
       /* else, fall through to prompting. */
@@ -1344,7 +1346,7 @@ conflict_func_interactive(svn_wc_conflic
 
           if (b->external_failed)
             {
-              (*result)->choice = svn_wc_conflict_choose_postpone;
+              *option_id = svn_client_conflict_option_postpone;
               return SVN_NO_ERROR;
             }
 
@@ -1373,9 +1375,9 @@ conflict_func_interactive(svn_wc_conflic
             return svn_error_trace(err);
 
           if (remains_in_conflict)
-            (*result)->choice = svn_wc_conflict_choose_postpone;
+            *option_id = svn_client_conflict_option_postpone;
           else
-            (*result)->choice = svn_wc_conflict_choose_merged;
+            *option_id = svn_client_conflict_option_merged_text;
           return SVN_NO_ERROR;
         }
       /* else, fall through to prompting. */
@@ -1402,22 +1404,69 @@ conflict_func_interactive(svn_wc_conflic
            svn_wc_conflict_action_edit)
        && (svn_client_conflict_get_local_change(conflict) ==
            svn_wc_conflict_reason_edited)))
-    SVN_ERR(handle_text_conflict(*result, conflict, b, scratch_pool));
+    SVN_ERR(handle_text_conflict(option_id, save_merged, conflict, b,
+                                 scratch_pool));
   else if (svn_client_conflict_get_kind(conflict) ==
            svn_wc_conflict_kind_property)
-    SVN_ERR(handle_prop_conflict(*result, conflict, b, result_pool,
-                                 scratch_pool));
+    SVN_ERR(handle_prop_conflict(option_id, merged_propval, conflict, b,
+                                 result_pool, scratch_pool));
   else if (svn_client_conflict_get_kind(conflict) == svn_wc_conflict_kind_tree)
-    SVN_ERR(handle_tree_conflict(*result, conflict, b, scratch_pool));
+    SVN_ERR(handle_tree_conflict(option_id, conflict, b, scratch_pool));
 
   else /* other types of conflicts -- do nothing about them. */
     {
-      (*result)->choice = svn_wc_conflict_choose_postpone;
+      *option_id = svn_client_conflict_option_postpone;
     }
 
   return SVN_NO_ERROR;
 }
 
+/*
+ * Return a legacy conflict choice corresponding to OPTION_ID.
+ * Return svn_wc_conflict_choose_undefined if no corresponding
+ * legacy conflict choice exists.
+ */
+static svn_wc_conflict_choice_t
+conflict_option_id_to_wc_conflict_choice(
+  svn_client_conflict_option_id_t option_id)
+{
+
+  switch (option_id)
+    {
+      case svn_client_conflict_option_undefined:
+        return svn_wc_conflict_choose_undefined;
+
+      case svn_client_conflict_option_postpone:
+        return svn_wc_conflict_choose_postpone;
+
+      case svn_client_conflict_option_base_text:
+        return svn_wc_conflict_choose_base;
+
+      case svn_client_conflict_option_incoming_text:
+        return svn_wc_conflict_choose_theirs_full;
+
+      case svn_client_conflict_option_working_text:
+        return svn_wc_conflict_choose_mine_full;
+
+      case svn_client_conflict_option_incoming_text_where_conflicted:
+        return svn_wc_conflict_choose_theirs_conflict;
+
+      case svn_client_conflict_option_working_text_where_conflicted:
+        return svn_wc_conflict_choose_mine_conflict;
+
+      case svn_client_conflict_option_merged_text:
+        return svn_wc_conflict_choose_merged;
+
+      case svn_client_conflict_option_unspecified:
+        return svn_wc_conflict_choose_unspecified;
+
+      default:
+        break;
+    }
+
+  return svn_wc_conflict_choose_undefined;
+}
+
 svn_error_t *
 svn_cl__conflict_func_interactive(svn_wc_conflict_result_t **result,
                                   const svn_wc_conflict_description2_t *desc,
@@ -1427,15 +1476,24 @@ svn_cl__conflict_func_interactive(svn_wc
 {
   svn_cl__interactive_conflict_baton_t *b = baton;
   svn_client_conflict_t *conflict;
+  svn_client_conflict_option_id_t option_id;
+  svn_boolean_t save_merged = FALSE;
+  const svn_string_t *merged_propval = NULL;
 
   SVN_ERR(svn_client_conflict_from_wc_description2_t(&conflict, desc,
                                                      scratch_pool,
                                                      scratch_pool));
-  SVN_ERR(conflict_func_interactive(result, conflict, baton,
+  *result = svn_wc_create_conflict_result(svn_client_conflict_option_postpone,
+                                          NULL, result_pool);
+  SVN_ERR(conflict_func_interactive(&option_id, &save_merged, &merged_propval,
+                                    conflict, baton,
                                     result_pool, scratch_pool));
+  (*result)->choice = conflict_option_id_to_wc_conflict_choice(option_id);
+  (*result)->save_merged = save_merged;
+  (*result)->merged_value = merged_propval;
 
   /* If we are resolving a conflict, adjust the summary of conflicts. */
-  if ((*result)->choice != svn_wc_conflict_choose_postpone)
+  if ((*result)->choice != svn_client_conflict_option_postpone)
     {
       const char *local_path
         = svn_cl__local_style_skip_ancestor(
@@ -1447,3 +1505,73 @@ svn_cl__conflict_func_interactive(svn_wc
     }
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_cl__resolve_conflict(svn_boolean_t *resolved,
+                          svn_client_conflict_t *conflict,
+                          svn_client_ctx_t *ctx,
+                          svn_wc_conflict_choice_t conflict_choice,
+                          apr_pool_t *scratch_pool)
+{
+  svn_cl__interactive_conflict_baton_t *b = ctx->conflict_baton2;
+
+  if (conflict_choice == svn_wc_conflict_choose_unspecified)
+    {
+      svn_client_conflict_option_id_t option_id;
+
+      SVN_ERR(conflict_func_interactive(&option_id, NULL, NULL, conflict, b,
+                                        scratch_pool, scratch_pool));
+
+      conflict_choice = conflict_option_id_to_wc_conflict_choice(option_id);
+    }
+
+  /* If we are resolving a conflict, adjust the summary of conflicts. */
+  if (conflict_choice != svn_wc_conflict_choose_postpone)
+    {
+      const char *local_relpath
+        = svn_cl__local_style_skip_ancestor(
+            b->path_prefix, svn_client_conflict_get_local_abspath(conflict),
+            scratch_pool);
+      svn_wc_conflict_kind_t conflict_kind;
+      const char *local_abspath;
+      const char *lock_abspath;
+      svn_error_t *err;
+
+      local_abspath = svn_client_conflict_get_local_abspath(conflict);
+
+      /* ### for now, resolve conflict using legacy API */
+      SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath,
+                                                     ctx->wc_ctx,
+                                                     local_abspath,
+                                                     scratch_pool,
+                                                     scratch_pool));
+      conflict_kind = svn_client_conflict_get_kind(conflict);
+
+      err = svn_wc_resolved_conflict5(
+              ctx->wc_ctx, local_abspath, svn_depth_empty, /* ??? */
+              conflict_kind == svn_wc_conflict_kind_text,
+              conflict_kind == svn_wc_conflict_kind_property ? "" : NULL,
+              conflict_kind == svn_wc_conflict_kind_tree,
+              conflict_choice,
+              ctx->cancel_func, ctx->cancel_baton,
+              ctx->notify_func2, ctx->notify_baton2,
+              scratch_pool);
+
+      err = svn_error_compose_create(err, svn_wc__release_write_lock(ctx->wc_ctx,
+                                                                     lock_abspath,
+                                                                     scratch_pool));
+      svn_io_sleep_for_timestamps(local_abspath, scratch_pool);
+
+      SVN_ERR(err);
+    
+      svn_cl__conflict_stats_resolved(b->conflict_stats, local_relpath,
+                                      svn_client_conflict_get_kind(conflict));
+      *resolved = TRUE;
+    }
+  else
+    {
+      *resolved = FALSE;
+    }
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/reuse-ra-session/subversion/svn/resolve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svn/resolve-cmd.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svn/resolve-cmd.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svn/resolve-cmd.c Thu Sep 17 15:09:12 2015
@@ -30,6 +30,7 @@
 #include "svn_client.h"
 #include "svn_error.h"
 #include "svn_pools.h"
+#include "svn_hash.h"
 #include "cl.h"
 
 #include "svn_private_config.h"
@@ -38,6 +39,225 @@
 
 /*** Code. ***/
 
+/* Baton for conflict_status_walker */
+struct conflict_status_walker_baton
+{
+  svn_client_ctx_t *ctx;
+  svn_wc_conflict_choice_t conflict_choice;
+  svn_wc_notify_func2_t notify_func;
+  void *notify_baton;
+  svn_boolean_t resolved_one;
+  apr_hash_t *resolve_later;
+};
+
+/* Implements svn_wc_notify_func2_t to collect new conflicts caused by
+   resolving a tree conflict. */
+static void
+tree_conflict_collector(void *baton,
+                        const svn_wc_notify_t *notify,
+                        apr_pool_t *pool)
+{
+  struct conflict_status_walker_baton *cswb = baton;
+
+  if (cswb->notify_func)
+    cswb->notify_func(cswb->notify_baton, notify, pool);
+
+  if (cswb->resolve_later
+      && (notify->action == svn_wc_notify_tree_conflict
+          || notify->prop_state == svn_wc_notify_state_conflicted
+          || notify->content_state == svn_wc_notify_state_conflicted))
+    {
+      if (!svn_hash_gets(cswb->resolve_later, notify->path))
+        {
+          const char *dup_path;
+
+          dup_path = apr_pstrdup(apr_hash_pool_get(cswb->resolve_later),
+                                 notify->path);
+
+          svn_hash_sets(cswb->resolve_later, dup_path, dup_path);
+        }
+    }
+}
+
+/* Implements svn_wc_status4_t to walk all conflicts to resolve.
+ */
+static svn_error_t *
+conflict_status_walker(void *baton,
+                       const char *local_abspath,
+                       const svn_wc_status3_t *status,
+                       apr_pool_t *scratch_pool)
+{
+  struct conflict_status_walker_baton *cswb = baton;
+  apr_pool_t *iterpool;
+  svn_boolean_t resolved = FALSE;
+  svn_client_conflict_t *conflict;
+
+  if (!status->conflicted)
+    return SVN_NO_ERROR;
+
+  iterpool = svn_pool_create(scratch_pool);
+
+  SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, cswb->ctx,
+                                  iterpool, iterpool));
+  SVN_ERR(svn_cl__resolve_conflict(&resolved, conflict, cswb->ctx,
+                                   cswb->conflict_choice,
+                                   scratch_pool));
+  if (resolved)
+    cswb->resolved_one = TRUE;
+
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+walk_conflicts(svn_client_ctx_t *ctx,
+               const char *local_abspath,
+               svn_depth_t depth,
+               svn_wc_conflict_choice_t conflict_choice,
+               apr_pool_t *scratch_pool)
+{
+  struct conflict_status_walker_baton cswb;
+  apr_pool_t *iterpool = NULL;
+  svn_error_t *err;
+
+  if (depth == svn_depth_unknown)
+    depth = svn_depth_infinity;
+
+  cswb.ctx = ctx;
+  cswb.conflict_choice = conflict_choice;
+
+  cswb.resolved_one = FALSE;
+  cswb.resolve_later = (depth != svn_depth_empty)
+                          ? apr_hash_make(scratch_pool)
+                          : NULL;
+
+  /* ### call notify.c code */
+  if (ctx->notify_func2)
+    ctx->notify_func2(ctx->notify_baton2,
+                      svn_wc_create_notify(
+                        local_abspath,
+                        svn_wc_notify_conflict_resolver_starting,
+                        scratch_pool),
+                      scratch_pool);
+
+  cswb.notify_func = ctx->notify_func2;
+  cswb.notify_baton = ctx->notify_baton2;
+  ctx->notify_func2 = tree_conflict_collector;
+  ctx->notify_baton2 = &cswb;
+
+  err = svn_wc_walk_status(ctx->wc_ctx,
+                           local_abspath,
+                           depth,
+                           FALSE /* get_all */,
+                           FALSE /* no_ignore */,
+                           TRUE /* ignore_text_mods */,
+                           NULL /* ignore_patterns */,
+                           conflict_status_walker, &cswb,
+                           ctx->cancel_func, ctx->cancel_baton,
+                           scratch_pool);
+
+  /* If we got new tree conflicts (or delayed conflicts) during the initial
+     walk, we now walk them one by one as closure. */
+  while (!err && cswb.resolve_later && apr_hash_count(cswb.resolve_later))
+    {
+      apr_hash_index_t *hi;
+      svn_wc_status3_t *status = NULL;
+      const char *tc_abspath = NULL;
+
+      if (iterpool)
+        svn_pool_clear(iterpool);
+      else
+        iterpool = svn_pool_create(scratch_pool);
+
+      hi = apr_hash_first(scratch_pool, cswb.resolve_later);
+      cswb.resolve_later = apr_hash_make(scratch_pool);
+      cswb.resolved_one = FALSE;
+
+      for (; hi && !err; hi = apr_hash_next(hi))
+        {
+          const char *relpath;
+          svn_pool_clear(iterpool);
+
+          tc_abspath = apr_hash_this_key(hi);
+
+          if (ctx->cancel_func)
+            SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
+
+          relpath = svn_dirent_skip_ancestor(local_abspath,
+                                             tc_abspath);
+
+          if (!relpath
+              || (depth >= svn_depth_empty
+                  && depth < svn_depth_infinity
+                  && strchr(relpath, '/')))
+            {
+              continue;
+            }
+
+          SVN_ERR(svn_wc_status3(&status, ctx->wc_ctx, tc_abspath,
+                                 iterpool, iterpool));
+
+          if (depth == svn_depth_files
+              && status->kind == svn_node_dir)
+            continue;
+
+          err = svn_error_trace(conflict_status_walker(&cswb, tc_abspath,
+                                                       status, scratch_pool));
+        }
+
+      /* None of the remaining conflicts got resolved, and non did provide
+         an error...
+
+         We can fix that if we disable the 'resolve_later' option...
+       */
+      if (!cswb.resolved_one && !err && tc_abspath
+          && apr_hash_count(cswb.resolve_later))
+        {
+          /* Run the last resolve operation again. We still have status
+             and tc_abspath for that one. */
+
+          cswb.resolve_later = NULL; /* Produce proper error! */
+
+          /* Recreate the error */
+          err = svn_error_trace(conflict_status_walker(&cswb, tc_abspath,
+                                                       status, scratch_pool));
+
+          SVN_ERR_ASSERT(err != NULL);
+
+          err = svn_error_createf(
+                    SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, err,
+                    _("Unable to resolve pending conflict on '%s'"),
+                    svn_dirent_local_style(tc_abspath, scratch_pool));
+          break;
+        }
+    }
+
+  if (iterpool)
+    svn_pool_destroy(iterpool);
+
+  if (err && err->apr_err != SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE)
+    err = svn_error_createf(
+                SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, err,
+                _("Unable to resolve conflicts on '%s'"),
+                svn_dirent_local_style(local_abspath, scratch_pool));
+
+  ctx->notify_func2 = cswb.notify_func;
+  ctx->notify_baton2 = cswb.notify_baton;
+
+  SVN_ERR(err);
+
+  /* ### call notify.c code */
+  if (ctx->notify_func2)
+    ctx->notify_func2(ctx->notify_baton2,
+                      svn_wc_create_notify(local_abspath,
+                                          svn_wc_notify_conflict_resolver_done,
+                                          scratch_pool),
+                      scratch_pool);
+
+  return SVN_NO_ERROR;
+}
+
 /* This implements the `svn_opt_subcommand_t' interface. */
 svn_error_t *
 svn_cl__resolve(apr_getopt_t *os,
@@ -107,12 +327,30 @@ svn_cl__resolve(apr_getopt_t *os,
   for (i = 0; i < targets->nelts; i++)
     {
       const char *target = APR_ARRAY_IDX(targets, i, const char *);
+      const char *local_abspath;
+      svn_client_conflict_t *conflict;
+
       svn_pool_clear(iterpool);
+ 
       SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
-      err = svn_client_resolve(target,
-                               opt_state->depth, conflict_choice,
-                               ctx,
-                               iterpool);
+
+      SVN_ERR(svn_dirent_get_absolute(&local_abspath, target, iterpool));
+
+      if (opt_state->depth == svn_depth_empty)
+        {
+          svn_boolean_t resolved;
+
+          SVN_ERR(svn_client_conflict_get(&conflict, local_abspath, ctx,
+                                          iterpool, iterpool));
+          err = svn_cl__resolve_conflict(&resolved, conflict, ctx,
+                                         conflict_choice, iterpool);
+        }
+      else
+        {
+          err = walk_conflicts(ctx, local_abspath, opt_state->depth,
+                               conflict_choice, iterpool);
+        }
+
       if (err)
         {
           svn_handle_warning2(stderr, err, "svn: ");

Modified: subversion/branches/reuse-ra-session/subversion/svn_private_config.hw
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svn_private_config.hw?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svn_private_config.hw (original)
+++ subversion/branches/reuse-ra-session/subversion/svn_private_config.hw Thu Sep 17 15:09:12 2015
@@ -122,6 +122,14 @@
    Supresses compiler warnings about the variable being unused.  */
 #define SVN_UNUSED(v) ( (void)(v) )
 
+#if defined(_MSC_VER) && _MSC_VER >= 1600
+#define HAVE_STDINT_H
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#define HAVE_STDBOOL_H
+#endif
+
 #endif /* SVN_PRIVATE_CONFIG_HW */
 
 /* Inclusion of Berkeley DB header */

Modified: subversion/branches/reuse-ra-session/subversion/svnadmin/svnadmin.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svnadmin/svnadmin.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svnadmin/svnadmin.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svnadmin/svnadmin.c Thu Sep 17 15:09:12 2015
@@ -1503,7 +1503,7 @@ subcommand_load(apr_getopt_t *os, void *
   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
 
   /* Read the stream from STDIN.  Users can redirect a file. */
-  SVN_ERR(svn_stream_for_stdin(&stdin_stream, pool));
+  SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
 
   /* Progress feedback goes to STDOUT, unless they asked to suppress it. */
   if (! opt_state->quiet)
@@ -1547,8 +1547,7 @@ subcommand_load_revprops(apr_getopt_t *o
   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
 
   /* Read the stream from STDIN.  Users can redirect a file. */
-  SVN_ERR(svn_stream_for_stdin(&stdin_stream, pool));
-  stdin_stream = svn_stream_wrap_buffered_read(stdin_stream, pool);
+  SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
 
   /* Progress feedback goes to STDOUT, unless they asked to suppress it. */
   if (! opt_state->quiet)

Modified: subversion/branches/reuse-ra-session/subversion/svnbench/svnbench.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svnbench/svnbench.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svnbench/svnbench.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svnbench/svnbench.c Thu Sep 17 15:09:12 2015
@@ -371,6 +371,7 @@ sub_main(int *exit_code, int argc, const
   svn_config_t *cfg_config;
   svn_boolean_t descend = TRUE;
   svn_boolean_t use_notifier = TRUE;
+  apr_time_t start_time, time_taken;
 
   received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
 
@@ -939,7 +940,10 @@ sub_main(int *exit_code, int argc, const
   ctx->conflict_baton2 = NULL;
 
   /* And now we finally run the subcommand. */
+  start_time = apr_time_now();
   err = (*subcommand->cmd_func)(os, &command_baton, pool);
+  time_taken = apr_time_now() - start_time;
+
   if (err)
     {
       /* For argument-related problems, suggest using the 'help'
@@ -968,6 +972,14 @@ sub_main(int *exit_code, int argc, const
 
       return err;
     }
+  else if ((subcommand->cmd_func != svn_cl__help) && !opt_state.quiet)
+    {
+      /* This formatting lines up nicely with the output of our sub-commands
+       * and gives musec resolution while not overflowing for 30 years. */
+      SVN_ERR(svn_cmdline_printf(pool,
+                                _("%15.6f seconds taken\n"),
+                                time_taken / 1.0e6));
+    }
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/reuse-ra-session/subversion/svndumpfilter/svndumpfilter.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svndumpfilter/svndumpfilter.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svndumpfilter/svndumpfilter.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svndumpfilter/svndumpfilter.c Thu Sep 17 15:09:12 2015
@@ -48,42 +48,8 @@
 #include "private/svn_cmdline_private.h"
 #include "private/svn_sorts_private.h"
 
-#ifdef _WIN32
-typedef apr_status_t (__stdcall *open_fn_t)(apr_file_t **, apr_pool_t *);
-#else
-typedef apr_status_t (*open_fn_t)(apr_file_t **, apr_pool_t *);
-#endif
-
 /*** Code. ***/
 
-/* Helper to open stdio streams */
-
-/* NOTE: we used to call svn_stream_from_stdio(), which wraps a stream
-   around a standard stdio.h FILE pointer.  The problem is that these
-   pointers operate through C Run Time (CRT) on Win32, which does all
-   sorts of translation on them: LF's become CRLF's, and ctrl-Z's
-   embedded in Word documents are interpreted as premature EOF's.
-
-   So instead, we use apr_file_open_std*, which bypass the CRT and
-   directly wrap the OS's file-handles, which don't know or care about
-   translation.  Thus dump/load works correctly on Win32.
-*/
-static svn_error_t *
-create_stdio_stream(svn_stream_t **stream,
-                    open_fn_t open_fn,
-                    apr_pool_t *pool)
-{
-  apr_file_t *stdio_file;
-  apr_status_t apr_err = open_fn(&stdio_file, pool);
-
-  if (apr_err)
-    return svn_error_wrap_apr(apr_err, _("Can't open stdio file"));
-
-  *stream = svn_stream_from_aprfile2(stdio_file, TRUE, pool);
-  return SVN_NO_ERROR;
-}
-
-
 /* Writes a property in dumpfile format to given stringbuf. */
 static void
 write_prop_to_stringbuf(svn_stringbuf_t *strbuf,
@@ -1065,12 +1031,10 @@ parse_baton_initialize(struct parse_bato
   struct parse_baton_t *baton = apr_palloc(pool, sizeof(*baton));
 
   /* Read the stream from STDIN.  Users can redirect a file. */
-  SVN_ERR(create_stdio_stream(&(baton->in_stream),
-                              apr_file_open_stdin, pool));
+  SVN_ERR(svn_stream_for_stdin2(&baton->in_stream, TRUE, pool));
 
   /* Have the parser dump results to STDOUT. Users can redirect a file. */
-  SVN_ERR(create_stdio_stream(&(baton->out_stream),
-                              apr_file_open_stdout, pool));
+  SVN_ERR(svn_stream_for_stdout(&baton->out_stream, pool));
 
   baton->do_exclude = do_exclude;
 

Modified: subversion/branches/reuse-ra-session/subversion/svnfsfs/load-index-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svnfsfs/load-index-cmd.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svnfsfs/load-index-cmd.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svnfsfs/load-index-cmd.c Thu Sep 17 15:09:12 2015
@@ -186,8 +186,7 @@ subcommand__load_index(apr_getopt_t *os,
   svnfsfs__opt_state *opt_state = baton;
   svn_stream_t *input;
 
-  SVN_ERR(svn_stream_for_stdin(&input, pool));
-  input = svn_stream_wrap_buffered_read(input, pool);
+  SVN_ERR(svn_stream_for_stdin2(&input, TRUE, pool));
   SVN_ERR(load_index(opt_state->repository_path, input, pool));
 
   return SVN_NO_ERROR;

Modified: subversion/branches/reuse-ra-session/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svnmucc/svnmucc.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svnmucc/svnmucc.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svnmucc/svnmucc.c Thu Sep 17 15:09:12 2015
@@ -193,7 +193,7 @@ execute(const apr_array_header_t *action
               SVN_ERR(svn_stream_open_readonly(&src, action->path[1],
                                                pool, iterpool));
             else
-              SVN_ERR(svn_stream_for_stdin(&src, pool));
+              SVN_ERR(svn_stream_for_stdin2(&src, TRUE, pool));
 
 
             if (kind == svn_node_file)

Modified: subversion/branches/reuse-ra-session/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svnrdump/svnrdump.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svnrdump/svnrdump.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svnrdump/svnrdump.c Thu Sep 17 15:09:12 2015
@@ -546,7 +546,6 @@ replay_revisions(svn_ra_session_t *sessi
 #endif
     }
 
-  SVN_ERR(svn_stream_close(stdout_stream));
   return SVN_NO_ERROR;
 }
 
@@ -564,18 +563,14 @@ load_revisions(svn_ra_session_t *session
                apr_hash_t *skip_revprops,
                apr_pool_t *pool)
 {
-  apr_file_t *stdin_file;
   svn_stream_t *stdin_stream;
 
-  apr_file_open_stdin(&stdin_file, pool);
-  stdin_stream = svn_stream_from_aprfile2(stdin_file, FALSE, pool);
+  SVN_ERR(svn_stream_for_stdin2(&stdin_stream, TRUE, pool));
 
   SVN_ERR(svn_rdump__load_dumpstream(stdin_stream, session, aux_session,
                                      quiet, skip_revprops,
                                      check_cancel, NULL, pool));
 
-  SVN_ERR(svn_stream_close(stdin_stream));
-
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/reuse-ra-session/subversion/svnserve/svnserve.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/svnserve/svnserve.c?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/svnserve/svnserve.c (original)
+++ subversion/branches/reuse-ra-session/subversion/svnserve/svnserve.c Thu Sep 17 15:09:12 2015
@@ -1030,7 +1030,9 @@ sub_main(int *exit_code, int argc, const
       apr_pool_cleanup_register(pool, pool, apr_pool_cleanup_null,
                                 redirect_stdout);
 
-      SVN_ERR(svn_stream_for_stdin(&stdin_stream, pool));
+      /* We are an interactive server, i.e. can't use APR buffering on
+       * stdin. */
+      SVN_ERR(svn_stream_for_stdin2(&stdin_stream, FALSE, pool));
       SVN_ERR(svn_stream_for_stdout(&stdout_stream, pool));
 
       /* Use a subpool for the connection to ensure that if SASL is used

Modified: subversion/branches/reuse-ra-session/subversion/tests/cmdline/merge_automatic_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/cmdline/merge_automatic_tests.py?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/tests/cmdline/merge_automatic_tests.py (original)
+++ subversion/branches/reuse-ra-session/subversion/tests/cmdline/merge_automatic_tests.py Thu Sep 17 15:09:12 2015
@@ -1346,6 +1346,11 @@ def merge_to_copy_and_add(sbox):
   expected_err = ".*svn: E195012: Can't perform .*A3'.*added.*"
   svntest.actions.run_and_verify_svn(None, expected_err,
                                      'merge', '^/A', sbox.ospath('A3'))
+  # Try the same merge with --reintegrate, for completeness' sake.
+  expected_err = ".*svn: E195012: Can't reintegrate into .*A3'.*added.*"
+  svntest.actions.run_and_verify_svn(None, expected_err,
+                                     'merge', '--reintegrate', '^/A',
+                                     sbox.ospath('A3'))
 
 ########################################################################
 # Run the tests

Modified: subversion/branches/reuse-ra-session/subversion/tests/cmdline/svnmucc_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/cmdline/svnmucc_tests.py?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/tests/cmdline/svnmucc_tests.py (original)
+++ subversion/branches/reuse-ra-session/subversion/tests/cmdline/svnmucc_tests.py Thu Sep 17 15:09:12 2015
@@ -471,7 +471,7 @@ def prohibited_deletes_and_moves(sbox):
   # See dev@, 2015-05-11, "Re: Issue 4579 / svnmucc fails to process certain
   # deletes", <http://svn.haxx.se/dev/archive-2015-05/0038.shtml>
 
-  sbox.build()
+  sbox.build(read_only = True)
   svntest.main.file_write(sbox.ospath('file'), "New contents")
 
   xtest_svnmucc(sbox.repo_url,
@@ -512,6 +512,82 @@ def prohibited_deletes_and_moves(sbox):
                 'rm', 'A/B',
                 'mv', 'A', 'A1')
 
+def svnmucc_type_errors(sbox):
+  "test type errors"
+
+  sbox.build(read_only=True)
+
+  sbox.simple_append('file', 'New contents')
+
+  xtest_svnmucc(sbox.repo_url,
+                ["svnmucc: E160016: Can't operate on 'B' "
+                "because 'A' is not a directory"],
+                '-m', '',
+                'put', sbox.ospath('file'), 'A',
+                'mkdir', 'A/B',
+                'propset', 'iota', 'iota', 'iota')
+
+  xtest_svnmucc(sbox.repo_url,
+                ["svnmucc: E200009: Can't delete node at 'A'"],
+                '-m', '',
+                'mkdir', 'A/Z',
+                'put', sbox.ospath('file'), 'A')
+
+  xtest_svnmucc(sbox.repo_url,
+                ["svnmucc: E160020: Path 'Z' already exists"],
+                '-m', '',
+                'mkdir', 'A/Z',
+                'put', sbox.ospath('file'), 'A/Z')
+
+def svnmucc_propset_and_put(sbox):
+  "propset and put"
+
+  sbox.build()
+
+  sbox.simple_append('file', 'New contents')
+
+  # First in the sane order: put, then propset
+  xtest_svnmucc(sbox.repo_url,
+                [],
+                '-m', '',
+                'put', sbox.ospath('file'), 't1',
+                'propset', 't1', 't1', 't1')
+
+  # And now in an impossible order: propset, then put
+  xtest_svnmucc(sbox.repo_url,
+                ["svnmucc: E200009: Can't set properties at not existing 't2'"],
+                '-m', '',
+                'propset', 't2', 't2', 't2',
+                'put', sbox.ospath('file'), 't2')
+
+  # And if the target already exists (dir)
+  xtest_svnmucc(sbox.repo_url,
+                ["svnmucc: E200009: Can't delete node at 'A'"],
+                '-m', '',
+                'propset', 'A', 'A', 'A',
+                'put', sbox.ospath('file'), 'A')
+
+  # And if the target already exists (file) # fixed in r1702467
+  xtest_svnmucc(sbox.repo_url,
+                [],
+                '-m', '',
+                'propset', 'iota', 'iota', 'iota',
+                'put', sbox.ospath('file'), 'iota')
+
+  # Put same file twice (non existing)
+  xtest_svnmucc(sbox.repo_url,
+                ["svnmucc: E160020: Path 't3' already exists"],
+                '-m', '',
+                'put', sbox.ospath('file'), 't3',
+                'put', sbox.ospath('file'), 't3')
+
+  # Put same file twice (existing)
+  xtest_svnmucc(sbox.repo_url,
+                ["svnmucc: E200009: Can't update file at 't1'"],
+                '-m', '',
+                'put', sbox.ospath('file'), 't1',
+                'put', sbox.ospath('file'), 't1')
+
 
 ######################################################################
 
@@ -523,6 +599,8 @@ test_list = [ None,
               no_log_msg_non_interactive,
               nested_replaces,
               prohibited_deletes_and_moves,
+              svnmucc_type_errors,
+              svnmucc_propset_and_put,
             ]
 
 if __name__ == '__main__':

Modified: subversion/branches/reuse-ra-session/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/cmdline/svntest/actions.py?rev=1703645&r1=1703644&r2=1703645&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/branches/reuse-ra-session/subversion/tests/cmdline/svntest/actions.py Thu Sep 17 15:09:12 2015
@@ -1668,7 +1668,7 @@ def run_and_verify_diff_summarize_xml(er
   for path in paths:
     modified_path = path.childNodes[0].data
 
-    if (expected_prefix is not None
+    if (expected_prefix
         and modified_path.find(expected_prefix) == 0):
       modified_path = modified_path.replace(expected_prefix, '')[1:].strip()