Modified: 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/hashdump-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/hashdump-test.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/hashdump-test.c
 (original)
+++ 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/hashdump-test.c
 Thu Aug  1 14:55:32 2013
@@ -31,6 +31,7 @@
 
 #include "../svn_test.h"
 
+#include "svn_private_config.h"
 #include "svn_types.h"
 #include "svn_string.h"
 #include "svn_error.h"

Modified: 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/mergeinfo-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/mergeinfo-test.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/mergeinfo-test.c
 (original)
+++ 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/mergeinfo-test.c
 Thu Aug  1 14:55:32 2013
@@ -28,6 +28,7 @@
 
 #define SVN_DEPRECATED
 
+#include "svn_private_config.h"
 #include "svn_hash.h"
 #include "svn_pools.h"
 #include "svn_types.h"

Modified: 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/spillbuf-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/spillbuf-test.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/spillbuf-test.c
 (original)
+++ 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/spillbuf-test.c
 Thu Aug  1 14:55:32 2013
@@ -57,10 +57,8 @@ check_read(svn_spillbuf_t *buf,
 
 
 static svn_error_t *
-test_spillbuf_basic(apr_pool_t *pool)
+test_spillbuf__basic(apr_pool_t *pool, apr_size_t len, svn_spillbuf_t *buf)
 {
-  apr_size_t len = strlen(basic_data);  /* Don't include basic_data's NUL  */
-  svn_spillbuf_t *buf = svn_spillbuf__create(len, 10 * len, pool);
   int i;
   const char *readptr;
   apr_size_t readlen;
@@ -87,6 +85,22 @@ test_spillbuf_basic(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_spillbuf_basic(apr_pool_t *pool)
+{
+  apr_size_t len = strlen(basic_data);  /* Don't include basic_data's NUL  */
+  svn_spillbuf_t *buf = svn_spillbuf__create(len, 10 * len, pool);
+  return test_spillbuf__basic(pool, len, buf);
+}
+
+static svn_error_t *
+test_spillbuf_basic_spill_all(apr_pool_t *pool)
+{
+  apr_size_t len = strlen(basic_data);  /* Don't include basic_data's NUL  */
+  svn_spillbuf_t *buf =
+    svn_spillbuf__create_extended(len, 10 * len, TRUE, TRUE, NULL, pool);
+  return test_spillbuf__basic(pool, len, buf);
+}
 
 static svn_error_t *
 read_callback(svn_boolean_t *stop,
@@ -107,12 +121,8 @@ read_callback(svn_boolean_t *stop,
 
 
 static svn_error_t *
-test_spillbuf_callback(apr_pool_t *pool)
+test_spillbuf__callback(apr_pool_t *pool, svn_spillbuf_t *buf)
 {
-  svn_spillbuf_t *buf = svn_spillbuf__create(
-                          sizeof(basic_data) /* blocksize */,
-                          10 * sizeof(basic_data) /* maxsize */,
-                          pool);
   int i;
   int counter;
   svn_boolean_t exhausted;
@@ -133,15 +143,31 @@ test_spillbuf_callback(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
-
 static svn_error_t *
-test_spillbuf_file(apr_pool_t *pool)
+test_spillbuf_callback(apr_pool_t *pool)
 {
-  apr_size_t altsize = sizeof(basic_data) + 2;
   svn_spillbuf_t *buf = svn_spillbuf__create(
-                          altsize /* blocksize */,
-                          2 * sizeof(basic_data) /* maxsize */,
+                          sizeof(basic_data) /* blocksize */,
+                          10 * sizeof(basic_data) /* maxsize */,
                           pool);
+  return test_spillbuf__callback(pool, buf);
+}
+
+static svn_error_t *
+test_spillbuf_callback_spill_all(apr_pool_t *pool)
+{
+  svn_spillbuf_t *buf = svn_spillbuf__create_extended(
+                          sizeof(basic_data) /* blocksize */,
+                          10 * sizeof(basic_data) /* maxsize */,
+                          TRUE /* delte on close */,
+                          TRUE /* spill all data */,
+                          NULL, pool);
+  return test_spillbuf__callback(pool, buf);
+}
+
+static svn_error_t *
+test_spillbuf__file(apr_pool_t *pool, apr_size_t altsize, svn_spillbuf_t *buf)
+{
   int i;
   const char *readptr;
   apr_size_t readlen;
@@ -203,14 +229,33 @@ test_spillbuf_file(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_spillbuf_file(apr_pool_t *pool)
+{
+  apr_size_t altsize = sizeof(basic_data) + 2;
+  svn_spillbuf_t *buf = svn_spillbuf__create(
+                          altsize /* blocksize */,
+                          2 * sizeof(basic_data) /* maxsize */,
+                          pool);
+  return test_spillbuf__file(pool, altsize, buf);
+}
 
 static svn_error_t *
-test_spillbuf_interleaving(apr_pool_t *pool)
+test_spillbuf_file_spill_all(apr_pool_t *pool)
 {
-  svn_spillbuf_t *buf = svn_spillbuf__create(8 /* blocksize */,
-                                             15 /* maxsize */,
-                                             pool);
+  apr_size_t altsize = sizeof(basic_data) + 2;
+  svn_spillbuf_t *buf = svn_spillbuf__create_extended(
+                          altsize /* blocksize */,
+                          2 * sizeof(basic_data)  /* maxsize */,
+                          TRUE /* delte on close */,
+                          TRUE /* spill all data */,
+                          NULL, pool);
+  return test_spillbuf__file(pool, altsize, buf);
+}
 
+static svn_error_t *
+test_spillbuf__interleaving(apr_pool_t *pool, svn_spillbuf_t* buf)
+{
   SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
   SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
   /* now: two blocks: 8 and 4 bytes  */
@@ -238,18 +283,33 @@ test_spillbuf_interleaving(apr_pool_t *p
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_spillbuf_interleaving(apr_pool_t *pool)
+{
+  svn_spillbuf_t *buf = svn_spillbuf__create(8 /* blocksize */,
+                                             15 /* maxsize */,
+                                             pool);
+  return test_spillbuf__interleaving(pool, buf);
+}
 
 static svn_error_t *
-test_spillbuf_reader(apr_pool_t *pool)
+test_spillbuf_interleaving_spill_all(apr_pool_t *pool)
+{
+  svn_spillbuf_t *buf = svn_spillbuf__create_extended(
+                          8 /* blocksize */,
+                          15 /* maxsize */,
+                          TRUE /* delte on close */,
+                          TRUE /* spill all data */,
+                          NULL, pool);
+  return test_spillbuf__interleaving(pool, buf);
+}
+
+static svn_error_t *
+test_spillbuf__reader(apr_pool_t *pool, svn_spillbuf_reader_t *sbr)
 {
-  svn_spillbuf_reader_t *sbr;
   apr_size_t amt;
   char buf[10];
 
-  sbr = svn_spillbuf__reader_create(4 /* blocksize */,
-                                    100 /* maxsize */,
-                                    pool);
-
   SVN_ERR(svn_spillbuf__reader_write(sbr, "abcdef", 6, pool));
 
   /* Get a buffer from the underlying reader, and grab a couple bytes.  */
@@ -270,13 +330,30 @@ test_spillbuf_reader(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_spillbuf_reader(apr_pool_t *pool)
+{
+  svn_spillbuf_reader_t *sbr = svn_spillbuf__reader_create(4 /* blocksize */,
+                                                           100 /* maxsize */,
+                                                           pool);
+  return test_spillbuf__reader(pool, sbr);
+}
 
 static svn_error_t *
-test_spillbuf_stream(apr_pool_t *pool)
+test_spillbuf_reader_spill_all(apr_pool_t *pool)
+{
+  svn_spillbuf_reader_t *sbr = svn_spillbuf__reader_create_extended(
+                          4 /* blocksize */,
+                          100 /* maxsize */,
+                          TRUE /* delte on close */,
+                          TRUE /* spill all data */,
+                          NULL, pool);
+  return test_spillbuf__reader(pool, sbr);
+}
+
+static svn_error_t *
+test_spillbuf__stream(apr_pool_t *pool, svn_stream_t *stream)
 {
-  svn_stream_t *stream = svn_stream__from_spillbuf(8 /* blocksize */,
-                                                   15 /* maxsize */,
-                                                   pool);
   char readbuf[256];
   apr_size_t readlen;
   apr_size_t writelen;
@@ -319,14 +396,30 @@ test_spillbuf_stream(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_spillbuf_stream(apr_pool_t *pool)
+{
+  svn_stream_t *stream = svn_stream__from_spillbuf(8 /* blocksize */,
+                                                   15 /* maxsize */,
+                                                   pool);
+  return test_spillbuf__stream(pool, stream);
+}
 
 static svn_error_t *
-test_spillbuf_rwfile(apr_pool_t *pool)
+test_spillbuf_stream_spill_all(apr_pool_t *pool)
 {
-  svn_spillbuf_t *buf = svn_spillbuf__create(4 /* blocksize */,
-                                             10 /* maxsize */,
-                                             pool);
+  svn_stream_t *stream = svn_stream__from_spillbuf_extended(
+                          8 /* blocksize */,
+                          15 /* maxsize */,
+                          TRUE /* delte on close */,
+                          TRUE /* spill all data */,
+                          NULL, pool);
+  return test_spillbuf__stream(pool, stream);
+}
 
+static svn_error_t *
+test_spillbuf__rwfile(apr_pool_t *pool, svn_spillbuf_t *buf)
+{
   SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
   SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
   SVN_ERR(svn_spillbuf__write(buf, "mnopqr", 6, pool));
@@ -360,14 +453,30 @@ test_spillbuf_rwfile(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
-
 static svn_error_t *
-test_spillbuf_eof(apr_pool_t *pool)
+test_spillbuf_rwfile(apr_pool_t *pool)
 {
   svn_spillbuf_t *buf = svn_spillbuf__create(4 /* blocksize */,
                                              10 /* maxsize */,
                                              pool);
+  return test_spillbuf__rwfile(pool, buf);
+}
+
+static svn_error_t *
+test_spillbuf_rwfile_spill_all(apr_pool_t *pool)
+{
+  svn_spillbuf_t *buf = svn_spillbuf__create_extended(
+                          4 /* blocksize */,
+                          10 /* maxsize */,
+                          TRUE /* delte on close */,
+                          TRUE /* spill all data */,
+                          NULL, pool);
+  return test_spillbuf__rwfile(pool, buf);
+}
 
+static svn_error_t *
+test_spillbuf__eof(apr_pool_t *pool, svn_spillbuf_t *buf)
+{
   SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
   SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
   /* now: two blocks: 4 and 2 bytes, and 6 bytes in spill file.  */
@@ -415,19 +524,107 @@ test_spillbuf_eof(apr_pool_t *pool)
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_spillbuf_eof(apr_pool_t *pool)
+{
+  svn_spillbuf_t *buf = svn_spillbuf__create(4 /* blocksize */,
+                                             10 /* maxsize */,
+                                             pool);
+  return test_spillbuf__eof(pool, buf);
+}
+
+static svn_error_t *
+test_spillbuf_eof_spill_all(apr_pool_t *pool)
+{
+  svn_spillbuf_t *buf = svn_spillbuf__create_extended(
+                          4 /* blocksize */,
+                          10 /* maxsize */,
+                          TRUE /* delte on close */,
+                          TRUE /* spill all data */,
+                          NULL, pool);
+  return test_spillbuf__eof(pool, buf);
+}
+
+static svn_error_t *
+test_spillbuf__file_attrs(apr_pool_t *pool, svn_boolean_t spill_all,
+                          svn_spillbuf_t *buf)
+{
+  apr_finfo_t finfo;
+
+  SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
+  SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
+  SVN_ERR(svn_spillbuf__write(buf, "mnopqr", 6, pool));
+
+  /* Check that the spillbuf size is what we expect it to be */
+  SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) == 18);
+
+  /* Check file existence */
+  SVN_TEST_ASSERT(svn_spillbuf__get_filename(buf) != NULL);
+  SVN_TEST_ASSERT(svn_spillbuf__get_file(buf) != NULL);
+
+  /* The size of the file must match expectations */
+  SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_SIZE,
+                               svn_spillbuf__get_file(buf), pool));
+  if (spill_all)
+    SVN_TEST_ASSERT(finfo.size == svn_spillbuf__get_size(buf));
+  else
+    SVN_TEST_ASSERT(finfo.size == (svn_spillbuf__get_size(buf)
+                                   - svn_spillbuf__get_memory_size(buf)));
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_spillbuf_file_attrs(apr_pool_t *pool)
+{
+  svn_spillbuf_t *buf = svn_spillbuf__create(4 /* blocksize */,
+                                             10 /* maxsize */,
+                                             pool);
+  return test_spillbuf__file_attrs(pool, FALSE, buf);
+}
+
+static svn_error_t *
+test_spillbuf_file_attrs_spill_all(apr_pool_t *pool)
+{
+  svn_spillbuf_t *buf = svn_spillbuf__create_extended(
+                          4 /* blocksize */,
+                          10 /* maxsize */,
+                          TRUE /* delte on close */,
+                          TRUE /* spill all data */,
+                          NULL, pool);
+  return test_spillbuf__file_attrs(pool, TRUE, buf);
+}
 
 /* The test table.  */
 struct svn_test_descriptor_t test_funcs[] =
   {
     SVN_TEST_NULL,
     SVN_TEST_PASS2(test_spillbuf_basic, "basic spill buffer test"),
+    SVN_TEST_PASS2(test_spillbuf_basic_spill_all,
+                   "basic spill buffer test (spill-all-data)"),
     SVN_TEST_PASS2(test_spillbuf_callback, "spill buffer read callback"),
+    SVN_TEST_PASS2(test_spillbuf_callback_spill_all,
+                   "spill buffer read callback (spill-all-data)"),
     SVN_TEST_PASS2(test_spillbuf_file, "spill buffer file test"),
+    SVN_TEST_PASS2(test_spillbuf_file_spill_all,
+                   "spill buffer file test (spill-all-data)"),
     SVN_TEST_PASS2(test_spillbuf_interleaving,
                    "interleaving reads and writes"),
+    SVN_TEST_PASS2(test_spillbuf_interleaving_spill_all,
+                   "interleaving reads and writes (spill-all-data)"),
     SVN_TEST_PASS2(test_spillbuf_reader, "spill buffer reader test"),
+    SVN_TEST_PASS2(test_spillbuf_reader_spill_all,
+                   "spill buffer reader test (spill-all-data)"),
     SVN_TEST_PASS2(test_spillbuf_stream, "spill buffer stream test"),
+    SVN_TEST_PASS2(test_spillbuf_stream_spill_all,
+                   "spill buffer stream test (spill-all-data)"),
     SVN_TEST_PASS2(test_spillbuf_rwfile, "read/write spill file"),
+    SVN_TEST_PASS2(test_spillbuf_rwfile_spill_all,
+                   "read/write spill file (spill-all-data)"),
     SVN_TEST_PASS2(test_spillbuf_eof, "validate reaching EOF of spill file"),
+    SVN_TEST_PASS2(test_spillbuf_eof_spill_all,
+                   "validate reaching EOF (spill-all-data)"),
+    SVN_TEST_PASS2(test_spillbuf_file_attrs, "check spill file properties"),
+    SVN_TEST_PASS2(test_spillbuf_file_attrs_spill_all,
+                   "check spill file properties (spill-all-data)"),
     SVN_TEST_NULL
   };

Modified: 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/string-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/string-test.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/string-test.c
 (original)
+++ 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/string-test.c
 Thu Aug  1 14:55:32 2013
@@ -812,7 +812,7 @@ test_string_matching(apr_pool_t *pool)
     {
       apr_size_t a_len = strlen(test->a);
       apr_size_t b_len = strlen(test->b);
-      apr_size_t max_match = MAX(a_len, b_len);
+      apr_size_t max_match = MIN(a_len, b_len);
       apr_size_t match_len
         = svn_cstring__match_length(test->a, test->b, max_match);
       apr_size_t rmatch_len

Modified: 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/subst_translate-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/subst_translate-test.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/subst_translate-test.c
 (original)
+++ 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_subr/subst_translate-test.c
 Thu Aug  1 14:55:32 2013
@@ -27,6 +27,7 @@
 
 #include "../svn_test.h"
 
+#include "svn_private_config.h"
 #include "svn_types.h"
 #include "svn_string.h"
 #include "svn_subst.h"

Modified: 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/conflict-data-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/conflict-data-test.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/conflict-data-test.c
 (original)
+++ 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/conflict-data-test.c
 Thu Aug  1 14:55:32 2013
@@ -28,6 +28,7 @@
 #include <apr_hash.h>
 #include <apr_tables.h>
 
+#include "svn_private_config.h"
 #include "svn_props.h"
 #include "svn_pools.h"
 #include "svn_hash.h"

Modified: 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/op-depth-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/op-depth-test.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/op-depth-test.c
 (original)
+++ 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/op-depth-test.c
 Thu Aug  1 14:55:32 2013
@@ -27,6 +27,7 @@
 #include <apr_pools.h>
 #include <apr_general.h>
 
+#include "svn_private_config.h"
 #include "svn_types.h"
 #include "svn_io.h"
 #include "svn_dirent_uri.h"

Modified: 
subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/wc-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/wc-test.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/wc-test.c 
(original)
+++ subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/wc-test.c 
Thu Aug  1 14:55:32 2013
@@ -24,6 +24,7 @@
 #include <apr_pools.h>
 #include <apr_general.h>
 
+#include "svn_private_config.h"
 #include "svn_types.h"
 #include "svn_io.h"
 #include "svn_dirent_uri.h"

Modified: subversion/branches/fsfs-improvements/subversion/tests/svn_test_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/svn_test_fs.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/tests/svn_test_fs.c 
(original)
+++ subversion/branches/fsfs-improvements/subversion/tests/svn_test_fs.c Thu 
Aug  1 14:55:32 2013
@@ -26,6 +26,7 @@
 
 #include "svn_test.h"
 
+#include "svn_private_config.h"
 #include "svn_string.h"
 #include "svn_utf.h"
 #include "svn_pools.h"

Modified: subversion/branches/fsfs-improvements/tools/dev/fsfs-reorg.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/tools/dev/fsfs-reorg.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/tools/dev/fsfs-reorg.c (original)
+++ subversion/branches/fsfs-improvements/tools/dev/fsfs-reorg.c Thu Aug  1 
14:55:32 2013
@@ -29,6 +29,7 @@
 #include <apr_file_io.h>
 #include <apr_poll.h>
 
+#include "svn_private_config.h"
 #include "svn_pools.h"
 #include "svn_diff.h"
 #include "svn_io.h"

Modified: subversion/branches/fsfs-improvements/tools/dist/backport.pl
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/tools/dist/backport.pl?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/tools/dist/backport.pl (original)
+++ subversion/branches/fsfs-improvements/tools/dist/backport.pl Thu Aug  1 
14:55:32 2013
@@ -22,6 +22,7 @@ use feature qw/switch say/;
 
 use Digest ();
 use Term::ReadKey qw/ReadMode ReadKey/;
+use File::Basename qw/basename/;
 use File::Copy qw/copy move/;
 use File::Temp qw/tempfile/;
 use POSIX qw/ctermid/;
@@ -29,6 +30,7 @@ use POSIX qw/ctermid/;
 ############### Start of reading values from environment ###############
 
 # Programs we use.
+my $SVNAUTH = $ENV{SVNAUTH} // 'svnauth'; # optional dependency
 my $SVN = $ENV{SVN} || 'svn'; # passed unquoted to sh
 my $SHELL = $ENV{SHELL} // '/bin/sh';
 my $VIM = 'vim';
@@ -39,7 +41,7 @@ my $PAGER = $ENV{PAGER} // 'less -F' // 
 #    svn-role:      YES=1 MAY_COMMIT=1
 #    conflicts-bot: YES=1 MAY_COMMIT=0
 #    interactive:   YES=0 MAY_COMMIT=0      (default)
-my $YES = ($ENV{YES} // 0) ? 1 : 0; # batch mode: eliminate prompts, add sleeps
+my $YES = exists $ENV{YES}; # batch mode: eliminate prompts, add sleeps
 my $MAY_COMMIT = 'false';
 $MAY_COMMIT = 'true' if ($ENV{MAY_COMMIT} // "false") =~ /^(1|yes|true)$/i;
 
@@ -48,14 +50,16 @@ my $VERBOSE = 0;
 my $DEBUG = (exists $ENV{DEBUG}) ? 'true' : 'false'; # 'set -x', etc
 
 # Username for entering votes.
+my $SVN_A_O_REALM = '<https://svn.apache.org:443> ASF Committers';            
 my ($AVAILID) = $ENV{AVAILID} // do {
-  my $SVN_A_O_REALM = 'd3c8a345b14f6a1b42251aef8027ab57';
-  open USERNAME, '<', "$ENV{HOME}/.subversion/auth/svn.simple/$SVN_A_O_REALM";
-  1 until <USERNAME> eq "username\n";
-  <USERNAME>;
-  local $_ = <USERNAME>;
-  chomp;
-  $_
+  local $_ = `$SVNAUTH list 2>/dev/null`;
+  ($? == 0 && /Auth.*realm: \Q$SVN_A_O_REALM\E\nUsername: (.*)/) ? $1 : undef
+} // do {
+  local $/; # slurp mode
+  my $filename = Digest->new("MD5")->add($SVN_A_O_REALM)->hexdigest;
+  open(USERNAME, '<', "$ENV{HOME}/.subversion/auth/svn.simple/$filename")
+  and
+  <USERNAME> =~ /K 8\nusername\nV \d+\n(.*)/ and $1 or undef
 }
 // warn "Username for commits (of votes/merges) not found";
 
@@ -82,8 +86,7 @@ $SVNq =~ s/-q// if $DEBUG eq 'true';
 
 
 sub usage {
-  my $basename = $0;
-  $basename =~ s#.*/##;
+  my $basename = basename $0;
   print <<EOF;
 backport.pl: a tool for reviewing and merging STATUS entries.  Run this with
 CWD being the root of the stable branch (e.g., 1.8.x).  The ./STATUS file
@@ -120,7 +123,7 @@ There is also a batch mode: when \$YES a
 the environment, this script will iterate the "Approved:" section, and merge
 and commit each entry therein.  If only \$YES is defined, the script will
 merge every nomination (including unapproved and vetoed ones), and complain
-to stderr if it notices any conflicts.  These mode are normally used by the
+to stderr if it notices any conflicts.  These modes are normally used by the
 'svn-role' cron job and/or buildbot, not by human users.
 
 The 'svn' binary defined by the environment variable \$SVN, or otherwise the
@@ -136,9 +139,11 @@ sub prompt {
   print $_[0]; shift;
   my %args = @_;
   my $getchar = sub {
+    my $answer;
     ReadMode 'cbreak';
-    my $answer = (ReadKey 0);
+    eval { $answer = (ReadKey 0) };
     ReadMode 'normal';
+    die $@ if $@;
     print $answer;
     return $answer;
   };
@@ -163,8 +168,13 @@ sub merge {
   my $backupfile = "backport_pl.$$.tmp";
 
   if ($entry{branch}) {
-    # NOTE: This doesn't escape the branch into the pattern.
-    $pattern = sprintf '\V\(%s branch(es)?\|branches\/%s\|Branch\(es\)\?: 
\*\n\? \*%s\)', $entry{branch}, $entry{branch}, $entry{branch};
+    my $vim_escaped_branch = 
+      join "",
+      map { sprintf '\[%s%s]', $_, ($_ x ($_ eq '\\')) }
+      split //,
+      $entry{branch};
+    $pattern = sprintf '\VBranch: \*\n\? \*\(\.\*\/branches\/\)\?%s',
+                 $vim_escaped_branch;
     if ($SVNvsn >= 1_008_000) {
       $mergeargs = "$BRANCHES/$entry{branch}";
       say $logmsg_fh "Merge the $entry{header}:";
@@ -219,7 +229,7 @@ fi
 if $MAY_COMMIT; then
   $VIM -e -s -n -N -i NONE -u NONE -c '/$pattern/normal! dap' -c wq $STATUS
   $SVNq commit -F $logmsg_filename
-elif test 1 -ne $YES; then
+elif test -z "\$YES"; then
   echo "Would have committed:"
   echo '[[['
   $SVN status -q
@@ -236,7 +246,7 @@ if $MAY_COMMIT; then
   if [ -n "\$YES" ]; then sleep 15; fi
   $SVNq rm $BRANCHES/$entry{branch} -m "Remove the '$entry{branch}' branch, 
$reintegrated_word in r\$reinteg_rev."
   if [ -n "\$YES" ]; then sleep 1; fi
-elif test 1 -ne $YES; then
+elif test -z "\$YES"; then
   echo "Would remove $reintegrated_word '$entry{branch}' branch"
 fi
 EOF
@@ -244,7 +254,7 @@ EOF
   open SHELL, '|-', qw#/bin/sh# or die "$! (in '$entry{header}')";
   print SHELL $script;
   close SHELL or warn "$0: sh($?): $! (in '$entry{header}')";
-  $ERRORS{$entry{id}} = "sh($?): $!" if $?;
+  $ERRORS{$entry{id}} = [\%entry, "sh($?): $!"] if $?;
 
   if (-z $backupfile) {
     unlink $backupfile;
@@ -263,6 +273,12 @@ sub sanitize_branch {
   return $_;
 }
 
+sub logsummarysummary {
+  my $entry = shift;
+  join "",
+    $entry->{logsummary}->[0], ('[...]' x (0 < $#{$entry->{logsummary}}))
+}
+
 # TODO: may need to parse other headers too?
 sub parse_entry {
   my $raw = shift;
@@ -302,7 +318,7 @@ sub parse_entry {
 
   # branch
   while (@_) {
-    shift and next unless $_[0] =~ s/^\s*Branch(es)?:\s*//;
+    shift and next unless $_[0] =~ s/^\s*Branch:\s*//;
     $branch = sanitize_branch (shift || shift || die "Branch header found 
without value");
   }
 
@@ -468,6 +484,7 @@ sub revert {
   system "$SVN revert -R ./" . ($YES && $MAY_COMMIT ne 'true'
                              ? " -q" : "");
   move "$STATUS.$$.tmp", $STATUS;
+  $MERGED_SOMETHING = 0;
 }
 
 sub maybe_revert {
@@ -478,6 +495,17 @@ sub maybe_revert {
   (@_ ? exit : return);
 }
 
+sub signal_handler {
+  my $sig = shift;
+
+  # Clean up after prompt()
+  ReadMode 'normal';
+
+  # Fall back to default action
+  delete $SIG{$sig};
+  kill $sig, $$;
+}
+
 sub warning_summary {
   return unless %ERRORS;
 
@@ -485,7 +513,8 @@ sub warning_summary {
   warn "===============\n";
   warn "\n";
   for my $header (keys %ERRORS) {
-    warn "$header: $ERRORS{$header}\n";
+    my $title = logsummarysummary $ERRORS{$header}->[0];
+    warn "$header ($title): $ERRORS{$header}->[1]\n";
   }
 }
 
@@ -543,15 +572,21 @@ sub handle_entry {
         my $output = `$SVN status`;
         my (@conflicts) = ($output =~ m#^(?:C...|.C..|...C)...\s(.*)#mg);
         if (@conflicts and !$entry{depends}) {
-          $ERRORS{$entry{id}} //= "Conflicts merging the $entry{header}: "
-                                  . (join ', ', map m#.*/(.*)#, @conflicts);
+          $ERRORS{$entry{id}} //= [\%entry,
+                                   sprintf "Conflicts on %s%s%s",
+                                     '[' x !!$#conflicts,
+                                     (join ', ',
+                                      map { basename $_ }
+                                      @conflicts),
+                                     ']' x !!$#conflicts,
+                                  ];
           say STDERR "Conflicts merging the $entry{header}!";
           say STDERR "";
           say STDERR $output;
           system "$SVN diff -- @conflicts";
         } elsif (!@conflicts and $entry{depends}) {
           # Not a warning since svn-role may commit the dependency without
-          # also committing the dependent in hte same pass.
+          # also committing the dependent in the same pass.
           print "No conflicts merging $entry{id}, but conflicts were "
               ."expected ('Depends:' header set)\n";
         } elsif (@conflicts) {
@@ -563,7 +598,7 @@ sub handle_entry {
   } elsif ($state->{$entry{digest}}) {
     print "\n\n";
     say "Skipping the $entry{header} (remove $STATEFILE to reset):";
-    say $entry{logsummary}->[0], ('[...]' x (0 < $#{$entry{logsummary}}));
+    say logsummarysummary \%entry;
   } else {
     # This loop is just a hack because 'goto' panics.  The goto should be where
     # the "next PROMPT;" is; there's a "last;" at the end of the loop body.
@@ -605,7 +640,7 @@ sub handle_entry {
       }
       when (/^l/i) {
         if ($entry{branch}) {
-            system "$SVN log --stop-on-copy -v -r 0:HEAD -- "
+            system "$SVN log --stop-on-copy -v -g -r 0:HEAD -- "
                    ."$BRANCHES/$entry{branch} "
                    ."| $PAGER";
         } elsif (@{$entry{revisions}}) {
@@ -694,6 +729,7 @@ sub main {
   }
 
   $SIG{INT} = \&maybe_revert unless $YES;
+  $SIG{TERM} = \&signal_handler unless $YES;
 
   my $in_approved = 0;
   while (<STATUS>) {

Modified: subversion/branches/fsfs-improvements/tools/server-side/fsfs-stats.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/tools/server-side/fsfs-stats.c?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/tools/server-side/fsfs-stats.c 
(original)
+++ subversion/branches/fsfs-improvements/tools/server-side/fsfs-stats.c Thu 
Aug  1 14:55:32 2013
@@ -28,6 +28,7 @@
 #include <apr_file_io.h>
 #include <apr_poll.h>
 
+#include "svn_private_config.h"
 #include "svn_pools.h"
 #include "svn_diff.h"
 #include "svn_io.h"

Modified: subversion/branches/fsfs-improvements/win-tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/win-tests.py?rev=1509270&r1=1509269&r2=1509270&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/win-tests.py (original)
+++ subversion/branches/fsfs-improvements/win-tests.py Thu Aug  1 14:55:32 2013
@@ -595,7 +595,7 @@ class Httpd:
     return 'LoadModule ' + name + " " + self._quote(full_path) + '\n'
 
   def _svn_module(self, name, path):
-    full_path = os.path.join(self.abs_objdir, path)
+    full_path = os.path.join(self.abs_builddir, path)
     return 'LoadModule ' + name + ' ' + self._quote(full_path) + '\n'
 
   def _svn_repo(self, name):
@@ -866,7 +866,7 @@ elif test_swig == 'perl':
   if (r != 0):
     print('[Test runner reported failure]')
     failed = True
-
+  sys.exit(1)
 elif test_swig == 'python':
   failed = False
   swig_dir = os.path.join(abs_builddir, 'swig')


Reply via email to