Author: hwright
Date: Thu Jan 19 20:59:50 2012
New Revision: 1233567

URL: http://svn.apache.org/viewvc?rev=1233567&view=rev
Log:
On the ev2-export branch:
Bring up-to-date with trunk.

Modified:
    subversion/branches/ev2-export/   (props changed)
    subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h
    subversion/branches/ev2-export/subversion/include/svn_editor.h
    subversion/branches/ev2-export/subversion/include/svn_io.h
    subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c
    subversion/branches/ev2-export/subversion/libsvn_subr/stream.c
    subversion/branches/ev2-export/subversion/tests/cmdline/special_tests.py
    subversion/branches/ev2-export/subversion/tests/libsvn_subr/spillbuf-test.c

Propchange: subversion/branches/ev2-export/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 19 20:59:50 2012
@@ -57,4 +57,4 @@
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
 /subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1231319-1232910
+/subversion/trunk:1231319-1233566

Modified: 
subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h?rev=1233567&r1=1233566&r2=1233567&view=diff
==============================================================================
--- 
subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h 
(original)
+++ 
subversion/branches/ev2-export/subversion/include/private/svn_subr_private.h 
Thu Jan 19 20:59:50 2012
@@ -25,6 +25,7 @@
 #define SVN_SUBR_PRIVATE_H
 
 #include "svn_types.h"
+#include "svn_io.h"
 
 
 #ifdef __cplusplus
@@ -188,6 +189,16 @@ svn_spillbuf__reader_write(svn_spillbuf_
                            apr_size_t len,
                            apr_pool_t *scratch_pool);
 
+
+/* Return a stream built on top of a spillbuf, using the same arguments as
+   svn_spillbuf__create().  This stream can be used for reading and writing,
+   but implements the same basic sematics of a spillbuf for the underlying
+   storage. */
+svn_stream_t *
+svn_stream__from_spillbuf(apr_size_t blocksize,
+                          apr_size_t maxsize,
+                          apr_pool_t *result_pool);
+
 /** @} */
 
 

Modified: subversion/branches/ev2-export/subversion/include/svn_editor.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/include/svn_editor.h?rev=1233567&r1=1233566&r2=1233567&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/include/svn_editor.h (original)
+++ subversion/branches/ev2-export/subversion/include/svn_editor.h Thu Jan 19 
20:59:50 2012
@@ -87,7 +87,7 @@ extern "C" {
  * receiver editing its tree to the target state defined by the driver.
  *
  *
- * HISTORY
+ * <h3>History</h3>
  *
  * Classically, Subversion had a notion of a "tree delta" which could be
  * passed around as an independent entity. Theory implied this delta was an
@@ -117,6 +117,31 @@ extern "C" {
  * the most common functionality (cancellation and debugging) have been
  * integrated directly into this new editor system.
  *
+ *
+ * <h3>Implementation Plan</h3>
+ * @note This section can be removed after Ev2 is fully implemented.
+ *
+ * The delta editor is pretty engrained throughout Subversion, so attempting
+ * to replace it in situ is somewhat akin to performing open heart surgery
+ * while the patient is running a marathon.  However, a viable plan should
+ * make things a bit easier, and help parallelize the work.
+ *
+ * In short, the following items need to be done:
+ *  -# Implement backward compatibility wrappers ("shims")
+ *  -# Use shims to update editor consumers to Ev2
+ *  -# Update editor producers to drive Ev2
+ *     - This will largely involve rewriting the RA layers to accept and
+ *       send Ev2 commands
+ *  -# Optimize consumers and producers to leverage the features of Ev2
+ *
+ * The shims are largely self-contained, and as of this writing, are almost
+ * complete.  They can be released without much ado.  However, they do add
+ * <em>significant</em> performance regressions, which make releasing code
+ * which is half-delta-editor and half-Ev2 inadvisable.  As such, the updating
+ * of producers and consumers to Ev2 will probably need to wait until 1.9,
+ * though it could be largely parallelized.
+ *
+ *
  * @defgroup svn_editor The editor interface
  * @{
  */

Modified: subversion/branches/ev2-export/subversion/include/svn_io.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/include/svn_io.h?rev=1233567&r1=1233566&r2=1233567&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/include/svn_io.h (original)
+++ subversion/branches/ev2-export/subversion/include/svn_io.h Thu Jan 19 
20:59:50 2012
@@ -989,6 +989,14 @@ svn_stream_t *
 svn_stream_from_string(const svn_string_t *str,
                        apr_pool_t *pool);
 
+/** Return a generic stream which implements buffered reads and writes.
+ *  Allocate the stream in @a result_pool
+ *
+ * @since New in 1.8.
+ */
+svn_stream_t *
+svn_stream_buffered(apr_pool_t *result_pool);
+
 /** Return a stream that decompresses all data read and compresses all
  * data written. The stream @a stream is used to read and write all
  * compressed data. All compression data structures are allocated on

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c?rev=1233567&r1=1233566&r2=1233567&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/spillbuf.c Thu Jan 19 
20:59:50 2012
@@ -552,3 +552,56 @@ svn_spillbuf__reader_write(svn_spillbuf_
   return svn_error_trace(svn_spillbuf__write(&reader->buf, data, len,
                                              scratch_pool));
 }
+
+
+struct spillbuf_baton
+{
+  svn_spillbuf_reader_t *reader;
+  apr_pool_t *scratch_pool;
+};
+
+
+static svn_error_t *
+read_handler_spillbuf(void *baton, char *buffer, apr_size_t *len)
+{
+  struct spillbuf_baton *sb = baton;
+
+  SVN_ERR(svn_spillbuf__reader_read(len, sb->reader, buffer, *len,
+                                    sb->scratch_pool));
+
+  svn_pool_clear(sb->scratch_pool);
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+write_handler_spillbuf(void *baton, const char *data, apr_size_t *len)
+{
+  struct spillbuf_baton *sb = baton;
+
+  SVN_ERR(svn_spillbuf__reader_write(sb->reader, data, *len, 
sb->scratch_pool));
+
+  svn_pool_clear(sb->scratch_pool);
+  return SVN_NO_ERROR;
+}
+
+
+svn_stream_t *
+svn_stream__from_spillbuf(apr_size_t blocksize,
+                          apr_size_t maxsize,
+                          apr_pool_t *result_pool)
+{
+  svn_stream_t *stream;
+  struct spillbuf_baton *sb = apr_pcalloc(result_pool, sizeof(*sb));
+
+  sb->reader = svn_spillbuf__reader_create(blocksize, maxsize, result_pool);
+  sb->scratch_pool = svn_pool_create(result_pool);
+
+  stream = svn_stream_create(sb, result_pool);
+
+  svn_stream_set_read(stream, read_handler_spillbuf);
+  svn_stream_set_write(stream, write_handler_spillbuf);
+
+
+  return stream;
+}

Modified: subversion/branches/ev2-export/subversion/libsvn_subr/stream.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/stream.c?rev=1233567&r1=1233566&r2=1233567&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_subr/stream.c Thu Jan 19 
20:59:50 2012
@@ -45,6 +45,7 @@
 #include "private/svn_error_private.h"
 #include "private/svn_eol_private.h"
 #include "private/svn_io_private.h"
+#include "private/svn_subr_private.h"
 
 
 struct svn_stream_t {
@@ -1642,3 +1643,16 @@ svn_string_from_stream(svn_string_t **re
 
   return SVN_NO_ERROR;
 }
+
+
+/* These are somewhat arbirary, if we ever get good empirical data as to
+   actually valid values, feel free to update them. */
+#define BUFFER_BLOCK_SIZE 1024
+#define BUFFER_MAX_SIZE 100000
+
+svn_stream_t *
+svn_stream_buffered(apr_pool_t *result_pool)
+{
+  return svn_stream__from_spillbuf(BUFFER_BLOCK_SIZE, BUFFER_MAX_SIZE,
+                                   result_pool);
+}

Modified: 
subversion/branches/ev2-export/subversion/tests/cmdline/special_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/special_tests.py?rev=1233567&r1=1233566&r2=1233567&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/cmdline/special_tests.py 
(original)
+++ subversion/branches/ev2-export/subversion/tests/cmdline/special_tests.py 
Thu Jan 19 20:59:50 2012
@@ -1023,6 +1023,38 @@ def replace_symlinks(sbox):
   sbox.simple_update()
 
 
+@XFail()
+@Issue(4102)
+@SkipUnless(svntest.main.is_posix_os)
+def externals_as_symlink_targets(sbox):
+  "externals as symlink targets"
+  sbox.build()
+  wc = sbox.ospath
+
+  # Control: symlink to normal dir and file.
+  os.symlink('E', wc('sym_E'))
+  os.symlink('mu', wc('sym_mu'))
+
+  # Test case: symlink to external dir and file.
+  sbox.simple_propset("svn:externals",
+                      '^/A/B/E ext_E\n'
+                      '^/A/mu ext_mu',
+                      '')
+  sbox.simple_update()
+  os.symlink('ext_E', wc('sym_ext_E'))
+  os.symlink('ext_mu', wc('sym_ext_mu'))
+
+  # Adding symlinks to normal items and to a file external is OK.
+  sbox.simple_add('sym_E', 'sym_mu', 'sym_ext_mu')
+
+  ### Adding a symlink to an external dir failed with
+  ###   svn: E200009: Could not add all targets because some targets are
+  ###   already versioned
+  sbox.simple_add('sym_ext_E')
+
+  sbox.simple_commit()
+    
+
 ########################################################################
 # Run the tests
 
@@ -1051,6 +1083,7 @@ test_list = [ None,
               symlink_to_wc_svnversion,
               update_symlink,
               replace_symlinks,
+              externals_as_symlink_targets,
              ]
 
 if __name__ == '__main__':

Modified: 
subversion/branches/ev2-export/subversion/tests/libsvn_subr/spillbuf-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_subr/spillbuf-test.c?rev=1233567&r1=1233566&r2=1233567&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_subr/spillbuf-test.c 
(original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_subr/spillbuf-test.c 
Thu Jan 19 20:59:50 2012
@@ -132,7 +132,7 @@ test_spillbuf_file(apr_pool_t *pool)
   int i;
   const char *readptr;
   apr_size_t readlen;
-  int cur_index;
+  apr_size_t cur_index;
 
   /* Place enough data into the buffer to cause a spill to disk. Note that
      we are writing data that is *smaller* than the blocksize.  */
@@ -277,6 +277,55 @@ test_spillbuf_reader(apr_pool_t *pool)
 }
 
 
+static svn_error_t *
+test_spillbuf_stream(apr_pool_t *pool)
+{
+  svn_stream_t *stream = svn_stream__from_spillbuf(8 /* blocksize */,
+                                                   15 /* maxsize */,
+                                                   pool);
+  char readbuf[256];
+  apr_size_t readlen;
+  apr_size_t writelen;
+
+  writelen = 6;
+  SVN_ERR(svn_stream_write(stream, "abcdef", &writelen));
+  SVN_ERR(svn_stream_write(stream, "ghijkl", &writelen));
+  /* now: two blocks of 8 and 4 bytes  */
+
+  readlen = 8;
+  SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+  SVN_TEST_ASSERT(readlen == 8
+                  && memcmp(readbuf, "abcdefgh", 8) == 0);
+  /* now: one block of 4 bytes  */
+
+  SVN_ERR(svn_stream_write(stream, "mnopqr", &writelen));
+  /* now: two blocks of 8 and 2 bytes  */
+
+  SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+  SVN_TEST_ASSERT(readlen == 8
+                  && memcmp(readbuf, "ijklmnop", 8) == 0);
+  /* now: one block of 2 bytes  */
+
+  SVN_ERR(svn_stream_write(stream, "stuvwx", &writelen));
+  SVN_ERR(svn_stream_write(stream, "ABCDEF", &writelen));
+  SVN_ERR(svn_stream_write(stream, "GHIJKL", &writelen));
+  /* now: two blocks of 8 and 6 bytes, and 6 bytes spilled to a file  */
+
+  SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+  SVN_TEST_ASSERT(readlen == 8
+                  && memcmp(readbuf, "qrstuvwx", 8) == 0);
+  readlen = 6;
+  SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+  SVN_TEST_ASSERT(readlen == 6
+                  && memcmp(readbuf, "ABCDEF", 6) == 0);
+  SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+  SVN_TEST_ASSERT(readlen == 6
+                  && memcmp(readbuf, "GHIJKL", 6) == 0);
+
+  return SVN_NO_ERROR;
+}
+
+
 /* The test table.  */
 struct svn_test_descriptor_t test_funcs[] =
   {
@@ -287,5 +336,6 @@ struct svn_test_descriptor_t test_funcs[
     SVN_TEST_PASS2(test_spillbuf_interleaving,
                    "interleaving reads and writes"),
     SVN_TEST_PASS2(test_spillbuf_reader, "spill buffer reader test"),
+    SVN_TEST_PASS2(test_spillbuf_stream, "spill buffer stream test"),
     SVN_TEST_NULL
   };


Reply via email to