You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/10/15 17:31:07 UTC

svn commit: r1398337 - in /subversion/branches/http-dynamic-prop-namespaces: ./ subversion/libsvn_delta/ subversion/libsvn_fs_fs/ subversion/libsvn_ra_svn/ subversion/libsvn_repos/ subversion/libsvn_subr/ subversion/libsvn_wc/ subversion/svn/ subversio...

Author: cmpilato
Date: Mon Oct 15 15:31:06 2012
New Revision: 1398337

URL: http://svn.apache.org/viewvc?rev=1398337&view=rev
Log:
Sync the 'http-dynamic-prop-namespaces' branch with the latest trunk changes.
(Merged /subversion/trunk:r1397299-1398336.)

Modified:
    subversion/branches/http-dynamic-prop-namespaces/   (props changed)
    subversion/branches/http-dynamic-prop-namespaces/Makefile.in
    subversion/branches/http-dynamic-prop-namespaces/build.conf
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/compat.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/editor.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/svndiff.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/text_delta.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/tree.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_svn/marshal.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_repos/reporter.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache-membuffer.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache_config.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/error.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_wc/conflicts.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/svn/conflict-callbacks.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/svn/log-cmd.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/main.c
    subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/serve.c

Propchange: subversion/branches/http-dynamic-prop-namespaces/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1397299-1398336

Modified: subversion/branches/http-dynamic-prop-namespaces/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/Makefile.in?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/Makefile.in (original)
+++ subversion/branches/http-dynamic-prop-namespaces/Makefile.in Mon Oct 15 15:31:06 2012
@@ -281,6 +281,19 @@ INSTALL_EXTRA_SWIG_PY=\
     compileall.compile_dir("$(DESTDIR)$(swig_pydir_extra)", 1, \
     "$(swig_pydir_extra)");'
 
+# export an env variable so that the tests can run without being installed
+TEST_SHLIB_VAR_SWIG_PY=\
+  if [ "@SVN_APR_SHLIB_PATH_VAR@" == "DYLD_LIBRARY_PATH" ]; then \
+    for d in $(SWIG_PY_DIR)/libsvn_swig_py $(SWIG_PY_DIR)/../../../libsvn_*; do \
+      if [ -n "$$DYLD_LIBRARY_PATH" ]; then \
+        @SVN_APR_SHLIB_PATH_VAR@="$$@SVN_APR_SHLIB_PATH_VAR@:$$d/.libs"; \
+      else \
+        @SVN_APR_SHLIB_PATH_VAR@="$$d/.libs"; \
+      fi; \
+    done; \
+    export @SVN_APR_SHLIB_PATH_VAR@; \
+  fi;
+
 # The path to generated and complementary source files for the SWIG
 # bindings.
 SWIG_PL_DIR = $(abs_builddir)/subversion/bindings/swig/perl
@@ -311,6 +324,19 @@ INSTALL_EXTRA_SWIG_RB=\
     $(INSTALL_DATA) "$$i" $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
   done
 
+# export an env variable so that the tests can run without being installed
+TEST_SHLIB_VAR_SWIG_RB=\
+  if [ "@SVN_APR_SHLIB_PATH_VAR@" == "DYLD_LIBRARY_PATH" ]; then \
+    for d in $(SWIG_PY_DIR)/libsvn_swig_rb $(SWIG_PY_DIR)/../../../libsvn_*; do \
+      if [ -n "$$DYLD_LIBRARY_PATH" ]; then \
+        @SVN_APR_SHLIB_PATH_VAR@="$$@SVN_APR_SHLIB_PATH_VAR@:$$d/.libs"; \
+      else \
+        @SVN_APR_SHLIB_PATH_VAR@="$$d/.libs"; \
+      fi; \
+    done; \
+    export @SVN_APR_SHLIB_PATH_VAR@; \
+  fi;
+ 
 APXS = @APXS@ 
 
 PYTHON = @PYTHON@
@@ -791,6 +817,7 @@ copy-swig-py: autogen-swig-py $(SWIG_PY_
 swig-py: autogen-swig-py copy-swig-py
 
 check-swig-py: swig-py
+	$(TEST_SHLIB_VAR_SWIG_PY) \
 	cd $(SWIG_PY_DIR); \
 	  $(PYTHON) $(SWIG_PY_SRC_DIR)/tests/run_all.py
 
@@ -813,6 +840,7 @@ extraclean-swig-py: clean-swig-py
 swig-rb: autogen-swig-rb
 
 check-swig-rb: swig-rb svnserve
+	$(TEST_SHLIB_VAR_SWIG_RB) \
 	cd $(SWIG_RB_DIR); \
 	  $(RUBY) -I $(SWIG_RB_SRC_DIR) \
 	    $(SWIG_RB_SRC_DIR)/test/run-test.rb \

Modified: subversion/branches/http-dynamic-prop-namespaces/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/build.conf?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/build.conf (original)
+++ subversion/branches/http-dynamic-prop-namespaces/build.conf Mon Oct 15 15:31:06 2012
@@ -64,9 +64,9 @@ test-scripts =
 
 bdb-test-scripts =
 
-swig-python-opts = -python -classic
-swig-perl-opts = -perl -nopm -noproxy
-swig-ruby-opts = -ruby
+swig-python-opts = $(CPPFLAGS) -python -classic
+swig-perl-opts = $(CPPFLAGS) -perl -nopm -noproxy
+swig-ruby-opts = $(CPPFLAGS) -ruby
 swig-languages = python perl ruby
 swig-dirs = 
         subversion/bindings/swig/python

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/compat.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/compat.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/compat.c Mon Oct 15 15:31:06 2012
@@ -1637,9 +1637,12 @@ apply_change(void **dir_baton,
                                                        change->copyfrom_path,
                                                        scratch_pool);
           else
-            /* ### prefix with "/" ?  */
             copyfrom_url = change->copyfrom_path;
 
+          /* Make this an FS path by prepending "/" */
+          if (copyfrom_url[0] != '/')
+            copyfrom_url = apr_pstrcat(scratch_pool, "/", copyfrom_url, NULL);
+
           copyfrom_rev = change->copyfrom_rev;
         }
 

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/editor.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/editor.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/editor.c Mon Oct 15 15:31:06 2012
@@ -77,23 +77,23 @@ struct svn_editor_t
 #define END_CALLBACK(editor) ((editor)->within_callback = FALSE)
 
 /* Marker to indicate no further changes are allowed on this node.  */
-static const int marker_done;
+static const int marker_done = 0;
 #define MARKER_DONE (&marker_done)
 
 /* Marker indicating that add_* may be called for this path, or that it
    can be the destination of a copy or move. For copy/move, the path
    will switch to MARKER_ALLOW_ALTER, to enable further tweaks.  */
-static const int marker_allow_add;
+static const int marker_allow_add = 0;
 #define MARKER_ALLOW_ADD (&marker_allow_add)
 
 /* Marker indicating that alter_* may be called for this path.  */
-static const int marker_allow_alter;
+static const int marker_allow_alter = 0;
 #define MARKER_ALLOW_ALTER (&marker_allow_alter)
 
 /* Just like MARKER_DONE, but also indicates that the node was created
    via add_directory(). This allows us to verify that the CHILDREN param
    was comprehensive.  */
-static const int marker_added_dir;
+static const int marker_added_dir = 0;
 #define MARKER_ADDED_DIR (&marker_added_dir)
 
 #define MARK_FINISHED(editor) ((editor)->finished = TRUE)

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/svndiff.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/svndiff.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/svndiff.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/svndiff.c Mon Oct 15 15:31:06 2012
@@ -219,7 +219,7 @@ send_simple_insertion_window(svn_txdelta
   /* Encode the action code and length.  */
   if (window->tview_len >> 6 == 0)
     {
-      ibuf[0] = window->tview_len + (0x2 << 6);
+      ibuf[0] = (unsigned char)(window->tview_len + (0x2 << 6));
       ip_len = 1;
     }
   else
@@ -524,7 +524,7 @@ decode_size(apr_size_t *val,
  */
 static svn_error_t *
 zlib_decode(const unsigned char *in, apr_size_t inLen, svn_stringbuf_t *out,
-            apr_size_t limit, svn_boolean_t copyless_allowed)
+            apr_size_t limit)
 {
   apr_size_t len;
   const unsigned char *oldplace = in;
@@ -543,22 +543,10 @@ zlib_decode(const unsigned char *in, apr
   inLen -= (in - oldplace);
   if (inLen == len)
     {
-      if (copyless_allowed)
-        {
-          /* "in" is no longer used but the memory remains allocated for
-           * at least as long as "out" will be used by the caller.
-           */
-          out->data = (char *)in;
-          out->len = len;
-          out->blocksize = len; /* sic! */
-        }
-      else
-        {
-          svn_stringbuf_ensure(out, len);
-          memcpy(out->data, in, len);
-          out->data[len] = 0;
-          out->len = len;
-        }
+      svn_stringbuf_ensure(out, len);
+      memcpy(out->data, in, len);
+      out->data[len] = 0;
+      out->len = len;
 
       return SVN_NO_ERROR;
     }
@@ -735,9 +723,9 @@ decode_window(svn_txdelta_window_t *wind
       /* these may in fact simply return references to insend */
 
       SVN_ERR(zlib_decode(insend, newlen, ndout,
-                          SVN_DELTA_WINDOW_SIZE, TRUE));
+                          SVN_DELTA_WINDOW_SIZE));
       SVN_ERR(zlib_decode(data, insend - data, instout,
-                          MAX_INSTRUCTION_SECTION_LEN, TRUE));
+                          MAX_INSTRUCTION_SECTION_LEN));
 
       newlen = ndout->len;
       data = (unsigned char *)instout->data;
@@ -1082,8 +1070,7 @@ svn__compress(svn_string_t *in,
               svn_stringbuf_t *out,
               int compression_level)
 {
-  return zlib_encode(in->data, in->len, out,
-                     compression_level);
+  return zlib_encode(in->data, in->len, out, compression_level);
 }
 
 svn_error_t *
@@ -1091,6 +1078,5 @@ svn__decompress(svn_string_t *in,
                 svn_stringbuf_t *out,
                 apr_size_t limit)
 {
-  return zlib_decode((const unsigned char*)in->data, in->len, out, limit,
-                     FALSE);
+  return zlib_decode((const unsigned char*)in->data, in->len, out, limit);
 }

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/text_delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/text_delta.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/text_delta.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_delta/text_delta.c Mon Oct 15 15:31:06 2012
@@ -1008,7 +1008,9 @@ svn_txdelta_send_contents(const unsigned
 {
   svn_string_t new_data;
   svn_txdelta_op_t op = { svn_txdelta_new, 0, 0 };
-  svn_txdelta_window_t window = { 0, 0, 0, 1, 0, &op, &new_data};
+  svn_txdelta_window_t window = { 0, 0, 0, 1, 0 };
+  window.ops = &op;
+  window.new_data = &new_data;
 
   /* send CONTENT as a series of max-sized windows */
   while (len > 0)

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/fs_fs.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/fs_fs.c Mon Oct 15 15:31:06 2012
@@ -2585,6 +2585,10 @@ svn_fs_fs__put_node_revision(svn_fs_t *f
   fs_fs_data_t *ffd = fs->fsap_data;
   apr_file_t *noderev_file;
   const char *txn_id = svn_fs_fs__id_txn_id(id);
+  const char *sha1 = ffd->rep_sharing_allowed && noderev->data_rep
+                   ? svn_checksum_to_cstring(noderev->data_rep->sha1_checksum,
+                                             pool)
+                   : NULL;
 
   noderev->is_fresh_txn_root = fresh_txn_root;
 
@@ -2603,7 +2607,32 @@ svn_fs_fs__put_node_revision(svn_fs_t *f
                                    svn_fs_fs__fs_supports_mergeinfo(fs),
                                    pool));
 
-  return svn_io_file_close(noderev_file, pool);
+  SVN_ERR(svn_io_file_close(noderev_file, pool));
+
+  /* if rep sharing has been enabled and the noderev has a data rep and
+   * its SHA-1 is known, store the rep struct under its SHA1. */
+  if (sha1)
+    {
+      apr_file_t *rep_file;
+      const char *file_name = svn_dirent_join(path_txn_dir(fs, txn_id, pool),
+                                              sha1, pool);
+      const char *rep_string = representation_string(noderev->data_rep,
+                                                     ffd->format,
+                                                     (noderev->kind
+                                                      == svn_node_dir),
+                                                     FALSE,
+                                                     pool);
+      SVN_ERR(svn_io_file_open(&rep_file, file_name,
+                               APR_WRITE | APR_CREATE | APR_TRUNCATE
+                               | APR_BUFFERED, APR_OS_DEFAULT, pool));
+
+      SVN_ERR(svn_io_file_write_full(rep_file, rep_string,
+                                     strlen(rep_string), NULL, pool));
+
+      SVN_ERR(svn_io_file_close(rep_file, pool));
+    }
+
+  return SVN_NO_ERROR;
 }
 
 
@@ -3510,8 +3539,8 @@ parse_packed_revprops(svn_fs_t *fs,
 
   revprops->packed_revprops = svn_stringbuf_create_empty(pool);
   revprops->packed_revprops->data = uncompressed->data + offset;
-  revprops->packed_revprops->len = uncompressed->len - offset;
-  revprops->packed_revprops->blocksize = uncompressed->blocksize - offset;
+  revprops->packed_revprops->len = (apr_size_t)(uncompressed->len - offset);
+  revprops->packed_revprops->blocksize = (apr_size_t)(uncompressed->blocksize - offset);
 
   /* STREAM still points to the first entry in the sizes list.
    * Init / construct REVPROPS members. */
@@ -4843,8 +4872,8 @@ get_contents(struct rep_read_baton *rb,
           offset = rs->off - rs->start;
           if (copy_len + offset > rb->base_window->len)
             copy_len = offset < rb->base_window->len
-                     ? rb->base_window->len - offset
-                     : 0;
+                     ? (apr_size_t)(rb->base_window->len - offset)
+                     : 0ul;
 
           memcpy (cur, rb->base_window->data + offset, copy_len);
         }
@@ -5206,8 +5235,8 @@ get_dir_contents(apr_hash_t *entries,
        */
       apr_pool_t *text_pool = svn_pool_create(pool);
       apr_size_t len = noderev->data_rep->expanded_size
-                     ? noderev->data_rep->expanded_size
-                     : noderev->data_rep->size;
+                     ? (apr_size_t)noderev->data_rep->expanded_size
+                     : (apr_size_t)noderev->data_rep->size;
       svn_stringbuf_t *text = svn_stringbuf_create_ensure(len, text_pool);
       text->len = len;
 
@@ -7083,6 +7112,30 @@ get_shared_rep(representation_t **old_re
         }
     }
 
+  /* look for intra-revision matches (usually data reps but not limited
+     to them in case props happen to look like some data rep)
+   */
+  if (*old_rep == NULL && rep->txn_id)
+    {
+      svn_node_kind_t kind;
+      const char *file_name
+        = svn_dirent_join(path_txn_dir(fs, rep->txn_id, pool),
+                          svn_checksum_to_cstring(rep->sha1_checksum, pool),
+                          pool);
+
+      /* in our txn, is there a rep file named with the wanted SHA1?
+         If so, read it and use that rep.
+       */
+      SVN_ERR(svn_io_check_path(file_name, &kind, pool));
+      if (kind == svn_node_file)
+        {
+          svn_stringbuf_t *rep_string;
+          SVN_ERR(svn_stringbuf_from_file2(&rep_string, file_name, pool));
+          SVN_ERR(read_rep_offsets_body(old_rep, rep_string->data,
+                                        rep->txn_id, FALSE, pool));
+        }
+    }
+
   /* Add information that is missing in the cached data. */
   if (*old_rep)
     {
@@ -9650,7 +9703,7 @@ pack_revprops_shard(const char *pack_fil
           total_size + SVN_INT64_BUFFER_SIZE + finfo.size > max_pack_size)
         {
           SVN_ERR(copy_revprops(pack_file_dir, pack_filename, shard_path,
-                                start_rev, rev-1, sizes, total_size,
+                                start_rev, rev-1, sizes, (apr_size_t)total_size,
                                 compression_level, cancel_func, cancel_baton,
                                 iterpool));
 
@@ -9676,7 +9729,7 @@ pack_revprops_shard(const char *pack_fil
   /* write the last pack file */
   if (sizes->nelts != 0)
     SVN_ERR(copy_revprops(pack_file_dir, pack_filename, shard_path,
-                          start_rev, rev-1, sizes, total_size,
+                          start_rev, rev-1, sizes, (apr_size_t)total_size,
                           compression_level, cancel_func, cancel_baton,
                           iterpool));
 

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/tree.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_fs_fs/tree.c Mon Oct 15 15:31:06 2012
@@ -148,7 +148,7 @@ typedef struct cache_entry_t
 {
   /* hash value derived from PATH, REVISION.
      Used to short-circuit failed lookups. */
-  apr_uint64_t hash_value;
+  long int hash_value;
 
   /* revision to which the NODE belongs */
   svn_revnum_t revision;
@@ -337,7 +337,7 @@ cache_lookup( fs_fs_dag_cache_t *cache
 {
   apr_size_t i, bucket_index;
   apr_size_t path_len = strlen(path);
-  apr_uint64_t hash_value = revision;
+  long int hash_value = revision;
 
   /* optimistic lookup: hit the same bucket again? */
   cache_entry_t *result = &cache->buckets[cache->last_hit];

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_svn/marshal.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_svn/marshal.c Mon Oct 15 15:31:06 2012
@@ -365,12 +365,12 @@ static svn_error_t *readbuf_input(svn_ra
 }
 
 /* Treat the next LEN input bytes from CONN as "read" */
-static svn_error_t *readbuf_skip(svn_ra_svn_conn_t *conn, apr_size_t len)
+static svn_error_t *readbuf_skip(svn_ra_svn_conn_t *conn, apr_uint64_t len)
 {
   do
   {
     apr_size_t buflen = conn->read_end - conn->read_ptr;
-    apr_size_t copylen = (buflen < len) ? buflen : len;
+    apr_size_t copylen = (buflen < len) ? buflen : (apr_size_t)len;
     conn->read_ptr += copylen;
     len -= copylen;
     if (len == 0)

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_repos/reporter.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_repos/reporter.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_repos/reporter.c Mon Oct 15 15:31:06 2012
@@ -534,7 +534,9 @@ delta_proplists(report_baton_t *b, svn_r
     {
       /* convert committed-rev to  string */
       char buf[SVN_INT64_BUFFER_SIZE];
-      svn_string_t cr_str = { buf, svn__i64toa(buf, crev) };
+      svn_string_t cr_str;
+      cr_str.data = buf;
+      cr_str.len = svn__i64toa(buf, crev);
 
       /* Transmit the committed-rev. */
       SVN_ERR(change_fn(b, object,

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache-membuffer.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache-membuffer.c Mon Oct 15 15:31:06 2012
@@ -130,6 +130,11 @@
  */
 #define MAX_SEGMENT_COUNT 0x10000
 
+/* As of today, APR won't allocate chunks of 4GB or more. So, limit the
+ * segment size to slightly below that.
+ */
+#define MAX_SEGMENT_SIZE 0xffff0000ull
+
 /* We don't mark the initialization status for every group but initialize
  * a number of groups at once. That will allow for a very small init flags
  * vector that is likely to fit into the CPU caches even for fairly large
@@ -150,6 +155,12 @@
  */
 #define MAX_ITEM_SIZE ((apr_uint32_t)(0 - ITEM_ALIGNMENT))
 
+/* A 16 byte key type. We use that to identify cache entries.
+ * The notation as just two integer values will cause many compilers
+ * to create better code.
+ */
+typedef apr_uint64_t entry_key_t[2];
+
 /* Debugging / corruption detection support.
  * If you define this macro, the getter functions will performed expensive
  * checks on the item data, requested keys and entry types. If there is
@@ -210,7 +221,7 @@ static void get_prefix_tail(const char *
 /* Initialize all members of TAG except for the content hash.
  */
 static svn_error_t *store_key_part(entry_tag_t *tag,
-                                   unsigned char *prefix_hash,
+                                   entry_key_t prefix_hash,
                                    char *prefix_tail,
                                    const void *key,
                                    apr_size_t key_len,
@@ -275,11 +286,12 @@ static svn_error_t* assert_equal_tags(co
 
 #define DEBUG_CACHE_MEMBUFFER_TAG_ARG entry_tag_t *tag,
 
-#define DEBUG_CACHE_MEMBUFFER_TAG &tag,
+#define DEBUG_CACHE_MEMBUFFER_TAG tag,
 
 #define DEBUG_CACHE_MEMBUFFER_INIT_TAG                         \
-  entry_tag_t tag;                                             \
-  SVN_ERR(store_key_part(&tag,                                 \
+  entry_tag_t _tag;                                            \
+  entry_tag_t *tag = &_tag;                                    \
+  SVN_ERR(store_key_part(tag,                                  \
                          cache->prefix,                        \
                          cache->prefix_tail,                   \
                          key,                                  \
@@ -298,12 +310,6 @@ static svn_error_t* assert_equal_tags(co
 
 #endif /* SVN_DEBUG_CACHE_MEMBUFFER */
 
-/* A 16 byte key type. We use that to identify cache entries.
- * The notation as just two integer values will cause many compilers
- * to create better code.
- */
-typedef apr_uint64_t entry_key_t[2];
-
 /* A single dictionary entry. Since all entries will be allocated once
  * during cache creation, those entries might be either used or unused.
  * An entry is used if and only if it is contained in the doubly-linked
@@ -1139,6 +1145,11 @@ svn_cache__membuffer_cache_create(svn_me
   apr_uint64_t data_size;
   apr_uint64_t max_entry_size;
 
+  /* Limit the total size
+   */
+  if (total_size > MAX_SEGMENT_SIZE * MAX_SEGMENT_COUNT)
+    total_size = MAX_SEGMENT_SIZE * MAX_SEGMENT_COUNT;
+  
   /* Limit the segment count
    */
   if (segment_count > MAX_SEGMENT_COUNT)
@@ -1176,6 +1187,14 @@ svn_cache__membuffer_cache_create(svn_me
       segment_count = 1 << segment_count_shift;
     }
 
+  /* If we have an extremely large cache (>512 GB), the default segment
+   * size may exceed the amount allocatable as one chunk. In that case,
+   * increase segmentation until we are under the threshold.
+   */
+  while (   total_size / segment_count > MAX_SEGMENT_SIZE
+         && segment_count < MAX_SEGMENT_COUNT)
+    segment_count *= 2;
+
   /* allocate cache as an array of segments / cache objects */
   c = apr_palloc(pool, segment_count * sizeof(*c));
 
@@ -1378,6 +1397,14 @@ membuffer_cache_set_internal(svn_membuff
       && cache->max_entry_size >= size
       && ensure_data_insertable(cache, size))
     {
+      /* Remove old data for this key, if that exists.
+       * Get an unused entry for the key and and initialize it with
+       * the serialized item's (future) position within data buffer.
+       */
+      entry = find_entry(cache, group_index, to_find, TRUE);
+      entry->size = size;
+      entry->offset = cache->current_data;
+
 #ifdef SVN_DEBUG_CACHE_MEMBUFFER
 
       /* Remember original content, type and key (hashes)
@@ -1387,16 +1414,8 @@ membuffer_cache_set_internal(svn_membuff
 
 #endif
 
-      /* Remove old data for this key, if that exists.
-       * Get an unused entry for the key and and initialize it with
-       * the serialized item's (future) position within data buffer.
-       */
-      entry = find_entry(cache, group_index, to_find, TRUE);
-      entry->size = size;
-      entry->offset = cache->current_data;
-
       /* Link the entry properly.
-        */
+       */
       insert_entry(cache, entry);
 
       /* Copy the serialized item data into the cache.
@@ -1509,7 +1528,7 @@ membuffer_cache_get_internal(svn_membuff
 
   /* Compare original content, type and key (hashes)
    */
-  SVN_ERR(store_content_part(tag, buffer, entry->size, result_pool));
+  SVN_ERR(store_content_part(tag, *buffer, entry->size, result_pool));
   SVN_ERR(assert_equal_tags(&entry->tag, tag));
 
 #endif
@@ -1746,17 +1765,17 @@ membuffer_cache_set_partial_internal(svn
                   /* Link the entry properly.
                    */
                   insert_entry(cache, entry);
+                }
+            }
 
 #ifdef SVN_DEBUG_CACHE_MEMBUFFER
 
-                  /* Remember original content, type and key (hashes)
-                   */
-                  SVN_ERR(store_content_part(tag, data, size, scratch_pool));
-                  memcpy(&entry->tag, tag, sizeof(*tag));
+          /* Remember original content, type and key (hashes)
+           */
+          SVN_ERR(store_content_part(tag, data, size, scratch_pool));
+          memcpy(&entry->tag, tag, sizeof(*tag));
 
 #endif
-                }
-            }
         }
     }
 
@@ -1782,7 +1801,7 @@ membuffer_cache_set_partial(svn_membuffe
   WITH_WRITE_LOCK(cache,
                   membuffer_cache_set_partial_internal
                      (cache, group_index, key, func, baton,
-                      DEBUG_CACHE_MEMBUFFER_TAG_ARG
+                      DEBUG_CACHE_MEMBUFFER_TAG
                       scratch_pool));
 
   /* done here -> unlock the cache

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache_config.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache_config.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache_config.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/cache_config.c Mon Oct 15 15:31:06 2012
@@ -52,7 +52,7 @@ static svn_cache_config_t cache_settings
                   * has little impact on performance and a more modest
                   * value (< 100) may be more suitable.
                   */
-#ifdef APR_HAS_THREADS
+#if APR_HAS_THREADS
     FALSE        /* assume multi-threaded operation.
                   * Because this simply activates proper synchronization
                   * between threads, it is a safe default.

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/error.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/error.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_subr/error.c Mon Oct 15 15:31:06 2012
@@ -196,9 +196,14 @@ svn_error_wrap_apr(apr_status_t status,
       va_start(ap, fmt);
       msg = apr_pvsprintf(err->pool, fmt, ap);
       va_end(ap);
-      err->message = apr_psprintf(err->pool, "%s%s%s", msg,
-                                  (msg_apr) ? ": " : "",
-                                  (msg_apr) ? msg_apr : "");
+      if (msg_apr)
+        {
+          err->message = apr_pstrcat(err->pool, msg, ": ", msg_apr, NULL);
+        }
+      else
+        {
+          err->message = msg;
+        }
     }
 
   return err;

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_wc/conflicts.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_wc/conflicts.c Mon Oct 15 15:31:06 2012
@@ -2000,9 +2000,9 @@ read_prop_conflicts(apr_array_header_t *
       if (my_value == NULL)
         desc->reason = svn_wc_conflict_reason_deleted;
       else if (their_value == NULL)
-        desc->action = svn_wc_conflict_reason_added;
+        desc->reason = svn_wc_conflict_reason_added;
       else
-        desc->action = svn_wc_conflict_reason_edited;
+        desc->reason = svn_wc_conflict_reason_edited;
 
       /* ### This should be changed. The prej file should be stored
        * ### separately from the other files. We need to rev the

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/svn/conflict-callbacks.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/svn/conflict-callbacks.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/svn/conflict-callbacks.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/svn/conflict-callbacks.c Mon Oct 15 15:31:06 2012
@@ -477,7 +477,8 @@ handle_text_conflict(svn_wc_conflict_res
           if (performed_edit)
             knows_something = TRUE;
         }
-      else if (strcmp(answer, "m") == 0 || strcmp(answer, ":-M") == 0)
+      else if (strcmp(answer, "m") == 0 || strcmp(answer, ":-g") ||
+               strcmp(answer, "=>-") == 0 || strcmp(answer, ":>.") == 0)
         {
           if (desc->kind != svn_wc_conflict_kind_text)
             {

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/svn/log-cmd.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/svn/log-cmd.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/svn/log-cmd.c Mon Oct 15 15:31:06 2012
@@ -626,7 +626,13 @@ log_entry_receiver_xml(void *baton,
               /* <path action="X"> */
               svn_xml_make_open_tag(&sb, pool, svn_xml_protect_pcdata, "path",
                                     "action", action,
-                                    "kind", svn_cl__node_kind_str_xml(log_item->node_kind), NULL);
+                                    "kind", svn_cl__node_kind_str_xml(
+                                                     log_item->node_kind),
+                                    "text-mods", svn_tristate__to_word(
+                                                     log_item->text_modified),
+                                    "prop-mods", svn_tristate__to_word(
+                                                     log_item->props_modified),
+                                    NULL);
             }
           /* xxx</path> */
           svn_xml_escape_cdata_cstring(&sb, path, pool);

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/main.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/main.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/main.c Mon Oct 15 15:31:06 2012
@@ -952,7 +952,7 @@ int main(int argc, const char *argv[])
     settings.single_threaded = TRUE;
     if (handling_mode == connection_mode_thread)
       {
-#ifdef APR_HAS_THREADS
+#if APR_HAS_THREADS
         settings.single_threaded = FALSE;
 #else
         /* No requests will be processed at all

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/serve.c?rev=1398337&r1=1398336&r2=1398337&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/serve.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/svnserve/serve.c Mon Oct 15 15:31:06 2012
@@ -3197,37 +3197,67 @@ fs_warning_func(void *baton, svn_error_t
   svn_pool_clear(b->pool);
 }
 
-
-static svn_error_t *
-fetch_props_func(apr_hash_t **props,
-                 void *baton,
-                 const char *path,
-                 svn_revnum_t base_revision,
-                 apr_pool_t *result_pool,
-                 apr_pool_t *scratch_pool)
+/* Return the normalized repository-relative path for the given PATH
+ * (may be a URL, full path or relative path) and fs contained in the
+ * server baton BATON. Allocate the result in POOL.
+ */
+static const char *
+get_normalized_repo_rel_path(void *baton,
+                             const char *path,
+                             apr_pool_t *pool)
 {
   server_baton_t *sb = baton;
-  svn_fs_root_t *fs_root;
-  svn_error_t *err;
-
-  if (!SVN_IS_VALID_REVNUM(base_revision))
-    SVN_ERR(svn_fs_youngest_rev(&base_revision, sb->fs, scratch_pool));
 
   if (svn_path_is_url(path))
     {
       /* This is a copyfrom URL. */
-      path = svn_uri_skip_ancestor(sb->repos_url, path, scratch_pool);
-      path = svn_fspath__canonicalize(path, scratch_pool);
+      path = svn_uri_skip_ancestor(sb->repos_url, path, pool);
+      path = svn_fspath__canonicalize(path, pool);
     }
   else
     {
       /* This is a base-relative path. */
-      if (path[0] != '/')
+      if ((path)[0] != '/')
         /* Get an absolute path for use in the FS. */
-        path = svn_fspath__join(sb->fs_path->data, path, scratch_pool);
+        path = svn_fspath__join(sb->fs_path->data, path, pool);
     }
 
-  SVN_ERR(svn_fs_revision_root(&fs_root, sb->fs, base_revision, scratch_pool));
+  return path;
+}
+
+/* Get the revision root for REVISION in fs given by server baton BATON
+ * and return it in *FS_ROOT. Use HEAD if REVISION is SVN_INVALID_REVNUM.
+ * Use POOL for allocations.
+ */
+static svn_error_t *
+get_revision_root(svn_fs_root_t **fs_root,
+                  void *baton,
+                  svn_revnum_t revision,
+                  apr_pool_t *pool)
+{
+  server_baton_t *sb = baton;
+
+  if (!SVN_IS_VALID_REVNUM(revision))
+    SVN_ERR(svn_fs_youngest_rev(&revision, sb->fs, pool));
+
+  SVN_ERR(svn_fs_revision_root(fs_root, sb->fs, revision, pool));
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+fetch_props_func(apr_hash_t **props,
+                 void *baton,
+                 const char *path,
+                 svn_revnum_t base_revision,
+                 apr_pool_t *result_pool,
+                 apr_pool_t *scratch_pool)
+{
+  svn_fs_root_t *fs_root;
+  svn_error_t *err;
+
+  path = get_normalized_repo_rel_path(baton, path, scratch_pool);
+  SVN_ERR(get_revision_root(&fs_root, baton, base_revision, scratch_pool));
 
   err = svn_fs_node_proplist(props, fs_root, path, result_pool);
   if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
@@ -3249,28 +3279,11 @@ fetch_kind_func(svn_kind_t *kind,
                 svn_revnum_t base_revision,
                 apr_pool_t *scratch_pool)
 {
-  server_baton_t *sb = baton;
   svn_node_kind_t node_kind;
   svn_fs_root_t *fs_root;
 
-  if (!SVN_IS_VALID_REVNUM(base_revision))
-    SVN_ERR(svn_fs_youngest_rev(&base_revision, sb->fs, scratch_pool));
-
-  if (svn_path_is_url(path))
-    {
-      /* This is a copyfrom URL. */
-      path = svn_uri_skip_ancestor(sb->repos_url, path, scratch_pool);
-      path = svn_fspath__canonicalize(path, scratch_pool);
-    }
-  else
-    {
-      /* This is a base-relative path. */
-      if (path[0] != '/')
-        /* Get an absolute path for use in the FS. */
-        path = svn_fspath__join(sb->fs_path->data, path, scratch_pool);
-    }
-
-  SVN_ERR(svn_fs_revision_root(&fs_root, sb->fs, base_revision, scratch_pool));
+  path = get_normalized_repo_rel_path(baton, path, scratch_pool);
+  SVN_ERR(get_revision_root(&fs_root, baton, base_revision, scratch_pool));
 
   SVN_ERR(svn_fs_check_path(&node_kind, fs_root, path, scratch_pool));
   *kind = svn__kind_from_node_kind(node_kind, FALSE);
@@ -3286,31 +3299,14 @@ fetch_base_func(const char **filename,
                 apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
 {
-  server_baton_t *sb = baton;
   svn_stream_t *contents;
   svn_stream_t *file_stream;
   const char *tmp_filename;
   svn_fs_root_t *fs_root;
   svn_error_t *err;
 
-  if (!SVN_IS_VALID_REVNUM(base_revision))
-    SVN_ERR(svn_fs_youngest_rev(&base_revision, sb->fs, scratch_pool));
-
-  if (svn_path_is_url(path))
-    {
-      /* This is a copyfrom URL. */
-      path = svn_uri_skip_ancestor(sb->repos_url, path, scratch_pool);
-      path = svn_fspath__canonicalize(path, scratch_pool);
-    }
-  else
-    {
-      /* This is a base-relative path. */
-      if (path[0] != '/')
-        /* Get an absolute path for use in the FS. */
-        path = svn_fspath__join(sb->fs_path->data, path, scratch_pool);
-    }
-
-  SVN_ERR(svn_fs_revision_root(&fs_root, sb->fs, base_revision, scratch_pool));
+  path = get_normalized_repo_rel_path(baton, path, scratch_pool);
+  SVN_ERR(get_revision_root(&fs_root, baton, base_revision, scratch_pool));
 
   err = svn_fs_file_contents(&contents, fs_root, path, scratch_pool);
   if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)