subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1329209 [17/38] - in /subversion/branches/javahl-ra: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ build/win32/ contrib/client-side/emacs/ contrib/client-side/vim/ contrib/server-side/mod_dontdothat/ notes/ notes/a...
Date Mon, 23 Apr 2012 12:33:03 GMT
Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_neon/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_neon/log.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_neon/log.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_neon/log.c Mon Apr 23 12:32:48 2012
@@ -32,6 +32,7 @@
 #include "svn_error.h"
 #include "svn_pools.h"
 #include "svn_path.h"
+#include "svn_base64.h"
 #include "svn_xml.h"
 #include "svn_props.h"
 
@@ -52,6 +53,8 @@ struct log_baton
   */
   svn_stringbuf_t *want_cdata;
   svn_stringbuf_t *cdata;
+  const char *cdata_encoding; /* encoding of CDATA (NULL or "base64") */
+
   /* Allocate log message information.
    * NOTE: this pool may be cleared multiple times as log messages are
    * received.
@@ -162,14 +165,27 @@ log_start_element(int *elem, void *baton
     case ELEM_comment:
       lb->want_cdata = lb->cdata;
       svn_stringbuf_setempty(lb->cdata);
+      lb->cdata_encoding = NULL;
+
+      /* Some tags might contain encoded CDATA. */
+      if ((elm->id == ELEM_comment) ||
+          (elm->id == ELEM_creator_displayname) ||
+          (elm->id == ELEM_log_date) ||
+          (elm->id == ELEM_rev_prop))
+        {
+          lb->cdata_encoding = svn_xml_get_attr_value("encoding", atts);
+          if (lb->cdata_encoding)
+            lb->cdata_encoding = apr_pstrdup(lb->subpool, lb->cdata_encoding);
+        }
+
+      /* revprop tags have names. */
       if (elm->id == ELEM_revprop)
         {
-          lb->revprop_name = apr_pstrdup(lb->subpool,
-                                         svn_xml_get_attr_value("name",
-                                                                atts));
-          if (lb->revprop_name == NULL)
+          const char *revprop_name = svn_xml_get_attr_value("name", atts);
+          if (revprop_name == NULL)
             return svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
                                      _("Missing name attr in revprop element"));
+          lb->revprop_name = apr_pstrdup(lb->subpool, revprop_name);
         }
       break;
     case ELEM_has_children:
@@ -235,6 +251,36 @@ log_start_element(int *elem, void *baton
   return SVN_NO_ERROR;
 }
 
+/*
+ * Set *DECODED_CDATA to a copy of current CDATA being tracked in LB,
+ * decoded as necessary, and allocated from LB->subpool.
+ */
+static svn_error_t *
+maybe_decode_log_cdata(const svn_string_t **decoded_cdata,
+                       struct log_baton *lb)
+{
+  if (lb->cdata_encoding)
+    {
+      svn_string_t in;
+      in.data = lb->cdata->data;
+      in.len = lb->cdata->len;
+
+      /* Check for a known encoding type.  This is easy -- there's
+         only one.  */
+      if (strcmp(lb->cdata_encoding, "base64") != 0)
+        return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
+
+      *decoded_cdata = svn_base64_decode_string(&in, lb->subpool);
+    }
+  else
+    {
+      *decoded_cdata = svn_string_create_from_buf(lb->cdata, lb->subpool);
+    }
+
+  return SVN_NO_ERROR;
+}
+
+
 
 /*
  * This implements the `svn_ra_neon__xml_endelm_cb' prototype.
@@ -244,6 +290,10 @@ log_end_element(void *baton, int state,
                 const char *nspace, const char *name)
 {
   struct log_baton *lb = baton;
+  const svn_string_t *decoded_cdata;
+
+  if (lb->want_cdata)
+    SVN_ERR(maybe_decode_log_cdata(&decoded_cdata, lb));
 
   switch (state)
     {
@@ -256,8 +306,7 @@ log_end_element(void *baton, int state,
           if (! lb->log_entry->revprops)
             lb->log_entry->revprops = apr_hash_make(lb->subpool);
           apr_hash_set(lb->log_entry->revprops, SVN_PROP_REVISION_AUTHOR,
-                       APR_HASH_KEY_STRING,
-                       svn_string_create_from_buf(lb->cdata, lb->subpool));
+                       APR_HASH_KEY_STRING, decoded_cdata);
         }
       break;
     case ELEM_log_date:
@@ -266,8 +315,7 @@ log_end_element(void *baton, int state,
           if (! lb->log_entry->revprops)
             lb->log_entry->revprops = apr_hash_make(lb->subpool);
           apr_hash_set(lb->log_entry->revprops, SVN_PROP_REVISION_DATE,
-                       APR_HASH_KEY_STRING,
-                       svn_string_create_from_buf(lb->cdata, lb->subpool));
+                       APR_HASH_KEY_STRING, decoded_cdata);
         }
       break;
     case ELEM_added_path:
@@ -289,8 +337,7 @@ log_end_element(void *baton, int state,
       if (! lb->log_entry->revprops)
         lb->log_entry->revprops = apr_hash_make(lb->subpool);
       apr_hash_set(lb->log_entry->revprops, lb->revprop_name,
-                   APR_HASH_KEY_STRING,
-                   svn_string_create_from_buf(lb->cdata, lb->subpool));
+                   APR_HASH_KEY_STRING, decoded_cdata);
       break;
     case ELEM_comment:
       if (lb->want_message)
@@ -298,8 +345,7 @@ log_end_element(void *baton, int state,
           if (! lb->log_entry->revprops)
             lb->log_entry->revprops = apr_hash_make(lb->subpool);
           apr_hash_set(lb->log_entry->revprops, SVN_PROP_REVISION_LOG,
-                       APR_HASH_KEY_STRING,
-                       svn_string_create_from_buf(lb->cdata, lb->subpool));
+                       APR_HASH_KEY_STRING, decoded_cdata);
         }
       break;
     case ELEM_log_item:
@@ -380,8 +426,8 @@ svn_error_t * svn_ra_neon__get_log(svn_r
      Maybe Greg can explain?  Meanwhile, I'm tentatively using
      "request_*" for my local vars below. */
 
-  static const char log_request_head[]
-    = "<S:log-report xmlns:S=\"" SVN_XML_NAMESPACE "\">" DEBUG_CR;
+  static const char log_request_head[] = "<S:log-report xmlns:S=\""
+    SVN_XML_NAMESPACE "\">" DEBUG_CR "<S:encode-binary-props/>";
 
   static const char log_request_tail[] = "</S:log-report>" DEBUG_CR;
 
@@ -404,23 +450,17 @@ svn_error_t * svn_ra_neon__get_log(svn_r
 
   if (discover_changed_paths)
     {
-      svn_stringbuf_appendcstr(request_body,
-                               apr_psprintf(pool,
-                                            "<S:discover-changed-paths/>"));
+      svn_stringbuf_appendcstr(request_body, "<S:discover-changed-paths/>");
     }
 
   if (strict_node_history)
     {
-      svn_stringbuf_appendcstr(request_body,
-                               apr_psprintf(pool,
-                                            "<S:strict-node-history/>"));
+      svn_stringbuf_appendcstr(request_body, "<S:strict-node-history/>");
     }
 
   if (include_merged_revisions)
     {
-      svn_stringbuf_appendcstr(request_body,
-                               apr_psprintf(pool,
-                                            "<S:include-merged-revisions/>"));
+      svn_stringbuf_appendcstr(request_body, "<S:include-merged-revisions/>");
     }
 
   if (revprops)
@@ -449,9 +489,7 @@ svn_error_t * svn_ra_neon__get_log(svn_r
     }
   else
     {
-      svn_stringbuf_appendcstr(request_body,
-                               apr_psprintf(pool,
-                                            "<S:all-revprops/>"));
+      svn_stringbuf_appendcstr(request_body, "<S:all-revprops/>");
       lb.want_author = lb.want_date = lb.want_message = TRUE;
       want_custom_revprops = TRUE;
     }
@@ -494,6 +532,7 @@ svn_error_t * svn_ra_neon__get_log(svn_r
   lb.cdata = svn_stringbuf_create_empty(pool);
   lb.log_entry = svn_log_entry_create(pool);
   lb.want_cdata = NULL;
+  lb.cdata_encoding = NULL;
   reset_log_item(&lb);
 
   /* ras's URL may not exist in HEAD, and thus it's not safe to send

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_neon/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_neon/merge.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_neon/merge.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_neon/merge.c Mon Apr 23 12:32:48 2012
@@ -576,29 +576,22 @@ svn_error_t * svn_ra_neon__assemble_lock
                                                    apr_hash_t *lock_tokens,
                                                    apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
-  apr_size_t buf_size;
-  const char *closing_tag = "</S:lock-token-list>";
-  apr_size_t closing_tag_size = strlen(closing_tag);
-  apr_pool_t *tmppool = svn_pool_create(pool);
-  apr_hash_t *xml_locks = apr_hash_make(tmppool);
-  svn_stringbuf_t *lockbuf = svn_stringbuf_create
-    ("<S:lock-token-list xmlns:S=\"" SVN_XML_NAMESPACE "\">" DEBUG_CR, pool);
-
-  buf_size = lockbuf->len;
-
+#define SVN_LOCK_TOKEN_LIST \
+          "<S:lock-token-list xmlns:S=\"" SVN_XML_NAMESPACE "\">" DEBUG_CR
 #define SVN_LOCK "<S:lock>" DEBUG_CR
-#define SVN_LOCK_LEN sizeof(SVN_LOCK)-1
 #define SVN_LOCK_CLOSE "</S:lock>" DEBUG_CR
-#define SVN_LOCK_CLOSE_LEN sizeof(SVN_LOCK_CLOSE)-1
 #define SVN_LOCK_PATH "<S:lock-path>"
-#define SVN_LOCK_PATH_LEN sizeof(SVN_LOCK_PATH)-1
 #define SVN_LOCK_PATH_CLOSE "</S:lock-path>" DEBUG_CR
-#define SVN_LOCK_PATH_CLOSE_LEN sizeof(SVN_LOCK_CLOSE)-1
 #define SVN_LOCK_TOKEN "<S:lock-token>"
-#define SVN_LOCK_TOKEN_LEN sizeof(SVN_LOCK_TOKEN)-1
 #define SVN_LOCK_TOKEN_CLOSE "</S:lock-token>" DEBUG_CR
-#define SVN_LOCK_TOKEN_CLOSE_LEN sizeof(SVN_LOCK_TOKEN_CLOSE)-1
+#define SVN_LOCK_TOKEN_LIST_CLOSE "</S:lock-token-list>"
+#define SVN_LEN(str) (sizeof(str) - 1)
+
+  apr_hash_index_t *hi;
+  apr_pool_t *tmppool = svn_pool_create(pool);
+  apr_hash_t *xml_locks = apr_hash_make(tmppool);
+  svn_stringbuf_t *lockbuf = svn_stringbuf_create(SVN_LOCK_TOKEN_LIST, pool);
+  apr_size_t buf_size = lockbuf->len;
 
   /* First, figure out how much string data we're talking about,
      and allocate a stringbuf big enough to hold it all... we *never*
@@ -622,17 +615,17 @@ svn_error_t * svn_ra_neon__assemble_lock
       apr_hash_set(xml_locks, lock_path_xml->data, lock_path_xml->len, val);
 
       /* Now, on with the stringbuf calculations. */
-      buf_size += SVN_LOCK_LEN;
-      buf_size += SVN_LOCK_PATH_LEN;
+      buf_size += SVN_LEN(SVN_LOCK);
+      buf_size += SVN_LEN(SVN_LOCK_PATH);
       buf_size += lock_path_xml->len;
-      buf_size += SVN_LOCK_PATH_CLOSE_LEN;
-      buf_size += SVN_LOCK_TOKEN_LEN;
+      buf_size += SVN_LEN(SVN_LOCK_PATH_CLOSE);
+      buf_size += SVN_LEN(SVN_LOCK_TOKEN);
       buf_size += strlen(val);
-      buf_size += SVN_LOCK_TOKEN_CLOSE_LEN;
-      buf_size += SVN_LOCK_CLOSE_LEN;
+      buf_size += SVN_LEN(SVN_LOCK_TOKEN_CLOSE);
+      buf_size += SVN_LEN(SVN_LOCK_CLOSE);
     }
 
-  buf_size += closing_tag_size;
+  buf_size += SVN_LEN(SVN_LOCK_TOKEN_LIST_CLOSE);
 
   svn_stringbuf_ensure(lockbuf, buf_size + 1);
 
@@ -659,25 +652,25 @@ svn_error_t * svn_ra_neon__assemble_lock
       svn_stringbuf_appendcstr(lockbuf, SVN_LOCK_CLOSE);
     }
 
-  svn_stringbuf_appendcstr(lockbuf, closing_tag);
+  svn_stringbuf_appendcstr(lockbuf, SVN_LOCK_TOKEN_LIST_CLOSE);
+
+  /* Check our size calculation was correct */
+  SVN_ERR_ASSERT(lockbuf->len == buf_size);
 
+  *body = lockbuf;
+
+  svn_pool_destroy(tmppool);
+  return SVN_NO_ERROR;
+
+#undef SVN_LOCK_TOKEN_LIST
 #undef SVN_LOCK
-#undef SVN_LOCK_LEN
 #undef SVN_LOCK_CLOSE
-#undef SVN_LOCK_CLOSE_LEN
 #undef SVN_LOCK_PATH
-#undef SVN_LOCK_PATH_LEN
 #undef SVN_LOCK_PATH_CLOSE
-#undef SVN_LOCK_PATH_CLOSE_LEN
 #undef SVN_LOCK_TOKEN
-#undef SVN_LOCK_TOKEN_LEN
 #undef SVN_LOCK_TOKEN_CLOSE
-#undef SVN_LOCK_TOKEN_CLOSE_LEN
-
-  *body = lockbuf;
-
-  svn_pool_destroy(tmppool);
-  return SVN_NO_ERROR;
+#undef SVN_LOCK_TOKEN_LIST_CLOSE
+#undef SVN_LEN
 }
 
 

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_neon/ra_neon.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_neon/ra_neon.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_neon/ra_neon.h Mon Apr 23 12:32:48 2012
@@ -131,6 +131,9 @@ typedef struct svn_ra_neon__session_t {
      deadprop-count property.*/
   svn_tristate_t supports_deadprop_count;
 
+  /* Ev2 shim callbacks. */
+  svn_delta_shim_callbacks_t *shim_callbacks;
+
   /*** HTTP v2 protocol stuff. ***
    *
    * We assume that if mod_dav_svn sends one of the special v2 OPTIONs
@@ -1181,6 +1184,14 @@ svn_ra_neon__get_deadprop_count_support(
                                         const char *final_url,
                                         apr_pool_t *pool);
 
+svn_error_t *
+svn_ra_neon__register_editor_shim_callbacks(svn_ra_session_t *session,
+                                    svn_delta_shim_callbacks_t *callbacks);
+
+svn_error_t *svn_ra_neon__get_repos_root(svn_ra_session_t *session,
+                                         const char **url,
+                                         apr_pool_t *pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_neon/session.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_neon/session.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_neon/session.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_neon/session.c Mon Apr 23 12:32:48 2012
@@ -590,10 +590,10 @@ static svn_error_t *get_server_settings(
 #ifdef SVN_NEON_0_26
   if (http_auth_types)
     {
-      char *token, *last;
+      char *token;
       char *auth_types_list = apr_palloc(pool, strlen(http_auth_types) + 1);
       apr_collapse_spaces(auth_types_list, http_auth_types);
-      while ((token = apr_strtok(auth_types_list, ";", &last)) != NULL)
+      while ((token = svn_cstring_tokenize(";", &auth_types_list)) != NULL)
         {
           auth_types_list = NULL;
           if (svn_cstring_casecmp("basic", token) == 0)
@@ -985,13 +985,15 @@ svn_ra_neon__open(svn_ra_session_t *sess
 
       if (authorities != NULL)
         {
-          char *files, *file, *last;
-          files = apr_pstrdup(pool, authorities);
+          int i;
+          apr_array_header_t *files = svn_cstring_split(authorities, ";", TRUE,
+                                                        pool);
 
-          while ((file = apr_strtok(files, ";", &last)) != NULL)
+          for (i = 0; i < files->nelts; ++i)
             {
               ne_ssl_certificate *ca_cert;
-              files = NULL;
+              const char *file = APR_ARRAY_IDX(files, i, const char *);
+
               ca_cert = ne_ssl_cert_read(file);
               if (ca_cert == NULL)
                 {
@@ -1107,9 +1109,9 @@ static svn_error_t *svn_ra_neon__get_ses
   return SVN_NO_ERROR;
 }
 
-static svn_error_t *svn_ra_neon__get_repos_root(svn_ra_session_t *session,
-                                                const char **url,
-                                                apr_pool_t *pool)
+svn_error_t *svn_ra_neon__get_repos_root(svn_ra_session_t *session,
+                                         const char **url,
+                                         apr_pool_t *pool)
 {
   svn_ra_neon__session_t *ras = session->priv;
 
@@ -1227,7 +1229,8 @@ static const svn_ra__vtable_t neon_vtabl
   svn_ra_neon__replay,
   svn_ra_neon__has_capability,
   svn_ra_neon__replay_range,
-  svn_ra_neon__get_deleted_rev
+  svn_ra_neon__get_deleted_rev,
+  svn_ra_neon__register_editor_shim_callbacks
 };
 
 svn_error_t *

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c Mon Apr 23 12:32:48 2012
@@ -38,6 +38,7 @@
 #include "svn_utf.h"
 #include "svn_xml.h"
 #include "svn_props.h"
+#include "../libsvn_ra/ra_loader.h"
 
 #include "private/svn_fspath.h"
 #include "svn_private_config.h"
@@ -1649,3 +1650,13 @@ svn_ra_neon__get_deadprop_count_support(
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_ra_neon__register_editor_shim_callbacks(svn_ra_session_t *session,
+                                    svn_delta_shim_callbacks_t *callbacks)
+{
+  svn_ra_neon__session_t *ras = session->priv;
+
+  ras->shim_callbacks = callbacks;
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/blame.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/blame.c Mon Apr 23 12:32:48 2012
@@ -39,6 +39,8 @@
 
 #include "svn_private_config.h"
 
+#include "private/svn_string_private.h"
+
 #include "ra_serf.h"
 #include "../libsvn_ra/ra_loader.h"
 
@@ -85,10 +87,7 @@ typedef struct blame_info_t {
 
   /* The currently collected value as we build it up */
   const char *prop_name;
-  const char *prop_attr;
-  apr_size_t prop_attr_len;
-
-  svn_string_t *prop_string;
+  svn_stringbuf_t *prop_value;
 
   /* Merged revision flag */
   svn_boolean_t merged_revision;
@@ -125,18 +124,16 @@ push_state(svn_ra_serf__xml_parser_t *pa
     {
       blame_info_t *info;
 
-      info = apr_palloc(parser->state->pool, sizeof(*info));
+      info = apr_pcalloc(parser->state->pool, sizeof(*info));
 
       info->pool = parser->state->pool;
 
       info->rev = SVN_INVALID_REVNUM;
-      info->path = NULL;
 
       info->rev_props = apr_hash_make(info->pool);
       info->prop_diffs = apr_array_make(info->pool, 0, sizeof(svn_prop_t));
 
-      info->stream = NULL;
-      info->merged_revision = FALSE;
+      info->prop_value = svn_stringbuf_create_empty(info->pool);
 
       parser->state->private = info;
     }
@@ -144,36 +141,31 @@ push_state(svn_ra_serf__xml_parser_t *pa
   return parser->state->private;
 }
 
+
 static const svn_string_t *
 create_propval(blame_info_t *info)
 {
-  const svn_string_t *s;
-
-  if (!info->prop_attr)
-    {
-      return svn_string_create_empty(info->pool);
-    }
-  else
-    {
-      info->prop_attr = apr_pmemdup(info->pool, info->prop_attr,
-                                    info->prop_attr_len + 1);
-    }
-
-  s = svn_string_ncreate(info->prop_attr, info->prop_attr_len, info->pool);
   if (info->prop_base64)
     {
-      s = svn_base64_decode_string(s, info->pool);
+      const svn_string_t *morph;
+
+      morph = svn_stringbuf__morph_into_string(info->prop_value);
+#ifdef SVN_DEBUG
+      info->prop_value = NULL;  /* morph killed the stringbuf.  */
+#endif
+      return svn_base64_decode_string(morph, info->pool);
     }
-  return s;
+
+  return svn_string_create_from_buf(info->prop_value, info->pool);
 }
 
 static svn_error_t *
 start_blame(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
             svn_ra_serf__dav_props_t name,
-            const char **attrs)
+            const char **attrs,
+            apr_pool_t *scratch_pool)
 {
-  blame_context_t *blame_ctx = userData;
+  blame_context_t *blame_ctx = parser->user_data;
   blame_state_e state;
 
   state = parser->state->current_state;
@@ -240,8 +232,7 @@ start_blame(svn_ra_serf__xml_parser_t *p
         case REMOVE_PROP:
           info->prop_name = apr_pstrdup(info->pool,
                                         svn_xml_get_attr_value("name", attrs));
-          info->prop_attr = NULL;
-          info->prop_attr_len = 0;
+          svn_stringbuf_setempty(info->prop_value);
 
           enc = svn_xml_get_attr_value("encoding", attrs);
           if (enc && strcmp(enc, "base64") == 0)
@@ -266,10 +257,10 @@ start_blame(svn_ra_serf__xml_parser_t *p
 
 static svn_error_t *
 end_blame(svn_ra_serf__xml_parser_t *parser,
-          void *userData,
-          svn_ra_serf__dav_props_t name)
+          svn_ra_serf__dav_props_t name,
+          apr_pool_t *scratch_pool)
 {
-  blame_context_t *blame_ctx = userData;
+  blame_context_t *blame_ctx = parser->user_data;
   blame_state_e state;
   blame_info_t *info;
 
@@ -338,11 +329,11 @@ end_blame(svn_ra_serf__xml_parser_t *par
 
 static svn_error_t *
 cdata_blame(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
             const char *data,
-            apr_size_t len)
+            apr_size_t len,
+            apr_pool_t *scratch_pool)
 {
-  blame_context_t *blame_ctx = userData;
+  blame_context_t *blame_ctx = parser->user_data;
   blame_state_e state;
   blame_info_t *info;
 
@@ -360,8 +351,7 @@ cdata_blame(svn_ra_serf__xml_parser_t *p
     {
       case REV_PROP:
       case SET_PROP:
-        svn_ra_serf__expand_string(&info->prop_attr, &info->prop_attr_len,
-                                   data, len, parser->state->pool);
+        svn_stringbuf_appendbytes(info->prop_value, data, len);
         break;
       case TXDELTA:
         if (info->stream)

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/commit.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/commit.c Mon Apr 23 12:32:48 2012
@@ -328,7 +328,7 @@ checkout_dir(dir_context_t *dir)
       return SVN_NO_ERROR;
     }
 
-  /* Is this directory or one of our parent dirs newly added? 
+  /* Is this directory or one of our parent dirs newly added?
    * If so, we're already implicitly checked out. */
   while (p_dir)
     {
@@ -2217,7 +2217,10 @@ close_edit(void *edit_baton,
 
   if (svn_ra_serf__merge_get_status(merge_ctx) != 200)
     {
-      SVN_ERR_MALFUNCTION();
+      return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+                               _("MERGE request failed: returned %d "
+                                 "(during commit)"),
+                               svn_ra_serf__merge_get_status(merge_ctx));
     }
 
   /* Inform the WC that we did a commit.  */
@@ -2319,8 +2322,8 @@ svn_ra_serf__get_commit_editor(svn_ra_se
   svn_delta_editor_t *editor;
   commit_context_t *ctx;
   apr_hash_index_t *hi;
-  svn_delta_shim_callbacks_t *shim_callbacks =
-                                    svn_delta_shim_callbacks_default(pool);
+  const char *repos_root;
+  const char *base_relpath;
 
   ctx = apr_pcalloc(pool, sizeof(*ctx));
 
@@ -2367,8 +2370,13 @@ svn_ra_serf__get_commit_editor(svn_ra_se
   *ret_editor = editor;
   *edit_baton = ctx;
 
+  SVN_ERR(svn_ra_serf__get_repos_root(ra_session, &repos_root, pool));
+  base_relpath = svn_uri_skip_ancestor(repos_root, session->session_url_str,
+                                       pool);
+
   SVN_ERR(svn_editor__insert_shims(ret_editor, edit_baton, *ret_editor,
-                                   *edit_baton, shim_callbacks, pool, pool));
+                                   *edit_baton, repos_root, base_relpath,
+                                   session->shim_callbacks, pool, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/get_deleted_rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/get_deleted_rev.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/get_deleted_rev.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/get_deleted_rev.c Mon Apr 23 12:32:48 2012
@@ -70,11 +70,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
 static svn_error_t *
 start_getdrev(svn_ra_serf__xml_parser_t *parser,
-              void *userData,
               svn_ra_serf__dav_props_t name,
-              const char **attrs)
+              const char **attrs,
+              apr_pool_t *scratch_pool)
 {
-  drev_context_t *drev_ctx = userData;
+  drev_context_t *drev_ctx = parser->user_data;
   drev_state_e state;
 
   state = parser->state->current_state;
@@ -90,10 +90,10 @@ start_getdrev(svn_ra_serf__xml_parser_t 
 
 static svn_error_t *
 end_getdrev(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
-            svn_ra_serf__dav_props_t name)
+            svn_ra_serf__dav_props_t name,
+            apr_pool_t *scratch_pool)
 {
-  drev_context_t *drev_ctx = userData;
+  drev_context_t *drev_ctx = parser->user_data;
   drev_state_e state;
   svn_string_t *info;
 
@@ -113,11 +113,11 @@ end_getdrev(svn_ra_serf__xml_parser_t *p
 
 static svn_error_t *
 cdata_getdrev(svn_ra_serf__xml_parser_t *parser,
-              void *userData,
               const char *data,
-              apr_size_t len)
+              apr_size_t len,
+              apr_pool_t *scratch_pool)
 {
-  drev_context_t *drev_ctx = userData;
+  drev_context_t *drev_ctx = parser->user_data;
   drev_state_e state;
 
   UNUSED_CTX(drev_ctx);

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getdate.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getdate.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getdate.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getdate.c Mon Apr 23 12:32:48 2012
@@ -51,15 +51,8 @@ typedef enum date_state_e {
   VERSION_NAME
 } date_state_e;
 
-typedef struct date_info_t {
-  /* The currently collected value as we build it up */
-  const char *tmp;
-  apr_size_t tmp_len;
-} date_info_t;
 
 typedef struct date_context_t {
-  apr_pool_t *pool;
-
   /* The time asked about. */
   apr_time_t time;
 
@@ -71,41 +64,24 @@ typedef struct date_context_t {
 
 } date_context_t;
 
-
-static date_info_t *
-push_state(svn_ra_serf__xml_parser_t *parser,
-           date_context_t *date_ctx,
-           date_state_e state)
-{
-  svn_ra_serf__xml_push_state(parser, state);
-
-  if (state == VERSION_NAME)
-    {
-      date_info_t *info;
-
-      info = apr_pcalloc(parser->state->pool, sizeof(*info));
-
-      parser->state->private = info;
-    }
-
-  return parser->state->private;
-}
 
 static svn_error_t *
 start_getdate(svn_ra_serf__xml_parser_t *parser,
-              void *userData,
               svn_ra_serf__dav_props_t name,
-              const char **attrs)
+              const char **attrs,
+              apr_pool_t *scratch_pool)
 {
-  date_context_t *date_ctx = userData;
-  date_state_e state;
+  date_context_t *date_ctx = parser->user_data;
+  date_state_e state = parser->state->current_state;
 
-  state = parser->state->current_state;
+  UNUSED_CTX(date_ctx);
 
   if (state == NONE &&
       strcmp(name.name, SVN_DAV__VERSION_NAME) == 0)
     {
-      push_state(parser, date_ctx, VERSION_NAME);
+      svn_ra_serf__xml_push_state(parser, VERSION_NAME);
+
+      parser->state->private = svn_stringbuf_create_empty(parser->state->pool);
     }
 
   return SVN_NO_ERROR;
@@ -113,20 +89,18 @@ start_getdate(svn_ra_serf__xml_parser_t 
 
 static svn_error_t *
 end_getdate(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
-            svn_ra_serf__dav_props_t name)
+            svn_ra_serf__dav_props_t name,
+            apr_pool_t *scratch_pool)
 {
-  date_context_t *date_ctx = userData;
-  date_state_e state;
-  date_info_t *info;
-
-  state = parser->state->current_state;
-  info = parser->state->private;
+  date_context_t *date_ctx = parser->user_data;
+  date_state_e state = parser->state->current_state;
 
   if (state == VERSION_NAME &&
       strcmp(name.name, SVN_DAV__VERSION_NAME) == 0)
     {
-      *date_ctx->revision = SVN_STR_TO_REV(info->tmp);
+      const svn_stringbuf_t *datebuf = parser->state->private;
+
+      *date_ctx->revision = SVN_STR_TO_REV(datebuf->data);
       svn_ra_serf__xml_pop_state(parser);
     }
 
@@ -135,24 +109,21 @@ end_getdate(svn_ra_serf__xml_parser_t *p
 
 static svn_error_t *
 cdata_getdate(svn_ra_serf__xml_parser_t *parser,
-              void *userData,
               const char *data,
-              apr_size_t len)
+              apr_size_t len,
+              apr_pool_t *scratch_pool)
 {
-  date_context_t *date_ctx = userData;
-  date_state_e state;
-  date_info_t *info;
+  date_context_t *date_ctx = parser->user_data;
+  date_state_e state = parser->state->current_state;
+  svn_stringbuf_t *datebuf;
 
   UNUSED_CTX(date_ctx);
 
-  state = parser->state->current_state;
-  info = parser->state->private;
-
   switch (state)
     {
     case VERSION_NAME:
-        svn_ra_serf__expand_string(&info->tmp, &info->tmp_len,
-                                   data, len, parser->state->pool);
+        datebuf = parser->state->private;
+        svn_stringbuf_appendbytes(datebuf, data, len);
         break;
     default:
         break;
@@ -202,8 +173,7 @@ svn_ra_serf__get_dated_revision(svn_ra_s
   const char *report_target;
   int status_code;
 
-  date_ctx = apr_pcalloc(pool, sizeof(*date_ctx));
-  date_ctx->pool = pool;
+  date_ctx = apr_palloc(pool, sizeof(*date_ctx));
   date_ctx->time = tm;
   date_ctx->revision = revision;
   date_ctx->done = FALSE;

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocations.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocations.c Mon Apr 23 12:32:48 2012
@@ -109,11 +109,11 @@ static void pop_state(loc_context_t *loc
 
 static svn_error_t *
 start_getloc(svn_ra_serf__xml_parser_t *parser,
-             void *userData,
              svn_ra_serf__dav_props_t name,
-             const char **attrs)
+             const char **attrs,
+             apr_pool_t *scratch_pool)
 {
-  loc_context_t *loc_ctx = userData;
+  loc_context_t *loc_ctx = parser->user_data;
 
   if (!loc_ctx->state && strcmp(name.name, "get-locations-report") == 0)
     {
@@ -148,10 +148,10 @@ start_getloc(svn_ra_serf__xml_parser_t *
 
 static svn_error_t *
 end_getloc(svn_ra_serf__xml_parser_t *parser,
-           void *userData,
-           svn_ra_serf__dav_props_t name)
+           svn_ra_serf__dav_props_t name,
+           apr_pool_t *scratch_pool)
 {
-  loc_context_t *loc_ctx = userData;
+  loc_context_t *loc_ctx = parser->user_data;
   loc_state_list_t *cur_state;
 
   if (!loc_ctx->state)

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocationsegments.c Mon Apr 23 12:32:48 2012
@@ -64,11 +64,11 @@ typedef struct gls_context_t {
 
 static svn_error_t *
 start_gls(svn_ra_serf__xml_parser_t *parser,
-          void *userData,
           svn_ra_serf__dav_props_t name,
-          const char **attrs)
+          const char **attrs,
+          apr_pool_t *scratch_pool)
 {
-  gls_context_t *gls_ctx = userData;
+  gls_context_t *gls_ctx = parser->user_data;
 
   if ((! gls_ctx->inside_report)
       && strcmp(name.name, "get-location-segments-report") == 0)
@@ -115,10 +115,10 @@ start_gls(svn_ra_serf__xml_parser_t *par
 
 static svn_error_t *
 end_gls(svn_ra_serf__xml_parser_t *parser,
-        void *userData,
-        svn_ra_serf__dav_props_t name)
+        svn_ra_serf__dav_props_t name,
+        apr_pool_t *scratch_pool)
 {
-  gls_context_t *gls_ctx = userData;
+  gls_context_t *gls_ctx = parser->user_data;
 
   if (strcmp(name.name, "get-location-segments-report") == 0)
     gls_ctx->inside_report = FALSE;

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocks.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocks.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocks.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/getlocks.c Mon Apr 23 12:32:48 2012
@@ -65,8 +65,7 @@ typedef struct lock_info_t {
   svn_lock_t *lock;
 
   /* The currently collected value as we build it up */
-  const char *tmp;
-  apr_size_t tmp_len;
+  svn_stringbuf_t *cdata;
 
 } lock_info_t;
 
@@ -101,7 +100,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
       info->pool = lock_ctx->pool;
       info->lock = svn_lock_create(lock_ctx->pool);
-      info->lock->path =
+      info->cdata = svn_stringbuf_create_empty(info->pool);
 
       parser->state->private = info;
     }
@@ -111,11 +110,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
 static svn_error_t *
 start_getlocks(svn_ra_serf__xml_parser_t *parser,
-               void *userData,
                svn_ra_serf__dav_props_t name,
-               const char **attrs)
+               const char **attrs,
+               apr_pool_t *scratch_pool)
 {
-  lock_context_t *lock_ctx = userData;
+  lock_context_t *lock_ctx = parser->user_data;
   lock_state_e state;
 
   state = parser->state->current_state;
@@ -163,10 +162,10 @@ start_getlocks(svn_ra_serf__xml_parser_t
 
 static svn_error_t *
 end_getlocks(svn_ra_serf__xml_parser_t *parser,
-             void *userData,
-             svn_ra_serf__dav_props_t name)
+             svn_ra_serf__dav_props_t name,
+             apr_pool_t *scratch_pool)
 {
-  lock_context_t *lock_ctx = userData;
+  lock_context_t *lock_ctx = parser->user_data;
   lock_state_e state;
   lock_info_t *info;
 
@@ -212,46 +211,50 @@ end_getlocks(svn_ra_serf__xml_parser_t *
   else if (state == PATH &&
            strcmp(name.name, "path") == 0)
     {
-      info->lock->path = apr_pstrmemdup(info->pool, info->tmp, info->tmp_len);
-      info->tmp_len = 0;
+      info->lock->path = apr_pstrmemdup(info->pool,
+                                        info->cdata->data, info->cdata->len);
+      svn_stringbuf_setempty(info->cdata);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == TOKEN &&
            strcmp(name.name, "token") == 0)
     {
-      info->lock->token = apr_pstrmemdup(info->pool, info->tmp, info->tmp_len);
-      info->tmp_len = 0;
+      info->lock->token = apr_pstrmemdup(info->pool,
+                                         info->cdata->data, info->cdata->len);
+      svn_stringbuf_setempty(info->cdata);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == OWNER &&
            strcmp(name.name, "owner") == 0)
     {
-      info->lock->owner = apr_pstrmemdup(info->pool, info->tmp, info->tmp_len);
-      info->tmp_len = 0;
+      info->lock->owner = apr_pstrmemdup(info->pool,
+                                         info->cdata->data, info->cdata->len);
+      svn_stringbuf_setempty(info->cdata);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == COMMENT &&
            strcmp(name.name, "comment") == 0)
     {
       info->lock->comment = apr_pstrmemdup(info->pool,
-                                           info->tmp, info->tmp_len);
-      info->tmp_len = 0;
+                                           info->cdata->data,
+                                           info->cdata->len);
+      svn_stringbuf_setempty(info->cdata);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == CREATION_DATE &&
            strcmp(name.name, SVN_DAV__CREATIONDATE) == 0)
     {
       SVN_ERR(svn_time_from_cstring(&info->lock->creation_date,
-                                    info->tmp, info->pool));
-      info->tmp_len = 0;
+                                    info->cdata->data, info->pool));
+      svn_stringbuf_setempty(info->cdata);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == EXPIRATION_DATE &&
            strcmp(name.name, "expirationdate") == 0)
     {
       SVN_ERR(svn_time_from_cstring(&info->lock->expiration_date,
-                                    info->tmp, info->pool));
-      info->tmp_len = 0;
+                                    info->cdata->data, info->pool));
+      svn_stringbuf_setempty(info->cdata);
       svn_ra_serf__xml_pop_state(parser);
     }
 
@@ -260,11 +263,11 @@ end_getlocks(svn_ra_serf__xml_parser_t *
 
 static svn_error_t *
 cdata_getlocks(svn_ra_serf__xml_parser_t *parser,
-               void *userData,
                const char *data,
-               apr_size_t len)
+               apr_size_t len,
+               apr_pool_t *scratch_pool)
 {
-  lock_context_t *lock_ctx = userData;
+  lock_context_t *lock_ctx = parser->user_data;
   lock_state_e state;
   lock_info_t *info;
 
@@ -281,8 +284,7 @@ cdata_getlocks(svn_ra_serf__xml_parser_t
     case COMMENT:
     case CREATION_DATE:
     case EXPIRATION_DATE:
-        svn_ra_serf__expand_string(&info->tmp, &info->tmp_len,
-                                   data, len, parser->state->pool);
+        svn_stringbuf_appendbytes(info->cdata, data, len);
         break;
       default:
         break;

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/locks.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/locks.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/locks.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/locks.c Mon Apr 23 12:32:48 2012
@@ -58,11 +58,6 @@ typedef enum lock_state_e {
   COMMENT
 } lock_state_e;
 
-typedef struct lock_prop_info_t {
-  const char *data;
-  apr_size_t len;
-} lock_prop_info_t;
-
 typedef struct lock_info_t {
   apr_pool_t *pool;
 
@@ -79,16 +74,12 @@ typedef struct lock_info_t {
   int status_code;
   const char *reason;
 
-  /* The currently collected value as we build it up */
-  const char *tmp;
-  apr_size_t tmp_len;
-
   /* are we done? */
   svn_boolean_t done;
 } lock_info_t;
 
 
-static lock_prop_info_t*
+static svn_stringbuf_t *
 push_state(svn_ra_serf__xml_parser_t *parser,
            lock_info_t *lock_ctx,
            lock_state_e state)
@@ -102,8 +93,8 @@ push_state(svn_ra_serf__xml_parser_t *pa
     case TIMEOUT:
     case LOCK_TOKEN:
     case COMMENT:
-        parser->state->private = apr_pcalloc(parser->state->pool,
-                                             sizeof(lock_prop_info_t));
+        parser->state->private =
+          svn_stringbuf_create_empty(parser->state->pool);
         break;
       default:
         break;
@@ -117,11 +108,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
  */
 static svn_error_t *
 start_lock(svn_ra_serf__xml_parser_t *parser,
-           void *userData,
            svn_ra_serf__dav_props_t name,
-           const char **attrs)
+           const char **attrs,
+           apr_pool_t *scratch_pool)
 {
-  lock_info_t *ctx = userData;
+  lock_info_t *ctx = parser->user_data;
   lock_state_e state;
 
   state = parser->state->current_state;
@@ -198,10 +189,10 @@ start_lock(svn_ra_serf__xml_parser_t *pa
  */
 static svn_error_t *
 end_lock(svn_ra_serf__xml_parser_t *parser,
-         void *userData,
-         svn_ra_serf__dav_props_t name)
+         svn_ra_serf__dav_props_t name,
+         apr_pool_t *scratch_pool)
 {
-  lock_info_t *ctx = userData;
+  lock_info_t *ctx = parser->user_data;
   lock_state_e state;
 
   state = parser->state->current_state;
@@ -239,7 +230,7 @@ end_lock(svn_ra_serf__xml_parser_t *pars
   else if (state == TIMEOUT &&
            strcmp(name.name, "timeout") == 0)
     {
-      lock_prop_info_t *info = parser->state->private;
+      svn_stringbuf_t *info = parser->state->private;
 
       if (strcmp(info->data, "Infinite") == 0)
         {
@@ -255,12 +246,12 @@ end_lock(svn_ra_serf__xml_parser_t *pars
   else if (state == LOCK_TOKEN &&
            strcmp(name.name, "locktoken") == 0)
     {
-      lock_prop_info_t *info = parser->state->private;
+      svn_stringbuf_t *info = parser->state->private;
 
       if (!ctx->lock->token && info->len)
         {
-          apr_collapse_spaces((char*)info->data, info->data);
-          ctx->lock->token = apr_pstrndup(ctx->pool, info->data, info->len);
+          apr_collapse_spaces(info->data, info->data);
+          ctx->lock->token = apr_pstrmemdup(ctx->pool, info->data, info->len);
         }
       /* We don't actually need the lock token. */
       svn_ra_serf__xml_pop_state(parser);
@@ -268,11 +259,12 @@ end_lock(svn_ra_serf__xml_parser_t *pars
   else if (state == COMMENT &&
            strcmp(name.name, "owner") == 0)
     {
-      lock_prop_info_t *info = parser->state->private;
+      svn_stringbuf_t *info = parser->state->private;
 
       if (info->len)
         {
-          ctx->lock->comment = apr_pstrndup(ctx->pool, info->data, info->len);
+          ctx->lock->comment = apr_pstrmemdup(ctx->pool,
+                                              info->data, info->len);
         }
       svn_ra_serf__xml_pop_state(parser);
     }
@@ -282,13 +274,13 @@ end_lock(svn_ra_serf__xml_parser_t *pars
 
 static svn_error_t *
 cdata_lock(svn_ra_serf__xml_parser_t *parser,
-           void *userData,
            const char *data,
-           apr_size_t len)
+           apr_size_t len,
+           apr_pool_t *scratch_pool)
 {
-  lock_info_t *lock_ctx = userData;
+  lock_info_t *lock_ctx = parser->user_data;
   lock_state_e state;
-  lock_prop_info_t *info;
+  svn_stringbuf_t *info;
 
   UNUSED_CTX(lock_ctx);
 
@@ -303,9 +295,9 @@ cdata_lock(svn_ra_serf__xml_parser_t *pa
     case TIMEOUT:
     case LOCK_TOKEN:
     case COMMENT:
-        svn_ra_serf__expand_string(&info->data, &info->len,
-                                   data, len, parser->state->pool);
+        svn_stringbuf_appendbytes(info, data, len);
         break;
+
       default:
         break;
     }
@@ -412,7 +404,7 @@ handle_lock(serf_request_t *request,
       if (err && APR_STATUS_IS_EOF(err->apr_err))
         {
           ctx->done = TRUE;
-          err = svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED,
+          err = svn_error_createf(SVN_ERR_RA_DAV_FORBIDDEN,
                                   err,
                                   _("Lock request failed: %d %s"),
                                   ctx->status_code, ctx->reason);
@@ -572,44 +564,43 @@ svn_ra_serf__lock(svn_ra_session_t *ra_s
                   svn_boolean_t force,
                   svn_ra_lock_callback_t lock_func,
                   void *lock_baton,
-                  apr_pool_t *pool)
+                  apr_pool_t *scratch_pool)
 {
   svn_ra_serf__session_t *session = ra_session->priv;
   apr_hash_index_t *hi;
-  apr_pool_t *subpool;
+  apr_pool_t *iterpool;
 
-  subpool = svn_pool_create(pool);
+  iterpool = svn_pool_create(scratch_pool);
 
   /* ### TODO for issue 2263: Send all the locks over the wire at once.  This
      loop is just a temporary shim. */
-  for (hi = apr_hash_first(pool, path_revs); hi; hi = apr_hash_next(hi))
+  for (hi = apr_hash_first(scratch_pool, path_revs);
+       hi;
+       hi = apr_hash_next(hi))
     {
       svn_ra_serf__handler_t *handler;
       svn_ra_serf__xml_parser_t *parser_ctx;
       const char *req_url;
       lock_info_t *lock_ctx;
-      const void *key;
-      void *val;
       svn_error_t *err;
       svn_error_t *new_err = NULL;
 
-      svn_pool_clear(subpool);
+      svn_pool_clear(iterpool);
 
-      lock_ctx = apr_pcalloc(subpool, sizeof(*lock_ctx));
+      lock_ctx = apr_pcalloc(iterpool, sizeof(*lock_ctx));
 
-      apr_hash_this(hi, &key, NULL, &val);
-      lock_ctx->pool = subpool;
-      lock_ctx->path = key;
-      lock_ctx->revision = *((svn_revnum_t*)val);
-      lock_ctx->lock = svn_lock_create(subpool);
-      lock_ctx->lock->path = key;
+      lock_ctx->pool = iterpool;
+      lock_ctx->path = svn__apr_hash_index_key(hi);
+      lock_ctx->revision = *((svn_revnum_t*)svn__apr_hash_index_val(hi));
+      lock_ctx->lock = svn_lock_create(iterpool);
+      lock_ctx->lock->path = lock_ctx->path;
       lock_ctx->lock->comment = comment;
 
       lock_ctx->force = force;
       req_url = svn_path_url_add_component2(session->session_url.path,
-                                            lock_ctx->path, subpool);
+                                            lock_ctx->path, iterpool);
 
-      handler = apr_pcalloc(subpool, sizeof(*handler));
+      handler = apr_pcalloc(iterpool, sizeof(*handler));
 
       handler->method = "LOCK";
       handler->path = req_url;
@@ -617,9 +608,9 @@ svn_ra_serf__lock(svn_ra_session_t *ra_s
       handler->conn = session->conns[0];
       handler->session = session;
 
-      parser_ctx = apr_pcalloc(subpool, sizeof(*parser_ctx));
+      parser_ctx = apr_pcalloc(iterpool, sizeof(*parser_ctx));
 
-      parser_ctx->pool = subpool;
+      parser_ctx->pool = iterpool;
       parser_ctx->user_data = lock_ctx;
       parser_ctx->start = start_lock;
       parser_ctx->end = end_lock;
@@ -636,16 +627,18 @@ svn_ra_serf__lock(svn_ra_session_t *ra_s
       handler->response_baton = parser_ctx;
 
       svn_ra_serf__request_create(handler);
-      err = svn_ra_serf__context_run_wait(&lock_ctx->done, session, subpool);
+      err = svn_ra_serf__context_run_wait(&lock_ctx->done, session, iterpool);
 
       if (lock_func)
         new_err = lock_func(lock_baton, lock_ctx->path, TRUE, lock_ctx->lock,
-                            err, subpool);
+                            err, iterpool);
       svn_error_clear(err);
 
       SVN_ERR(new_err);
     }
 
+  svn_pool_destroy(iterpool);
+
   return SVN_NO_ERROR;
 }
 
@@ -677,45 +670,44 @@ svn_ra_serf__unlock(svn_ra_session_t *ra
                     svn_boolean_t force,
                     svn_ra_lock_callback_t lock_func,
                     void *lock_baton,
-                    apr_pool_t *pool)
+                    apr_pool_t *scratch_pool)
 {
   svn_ra_serf__session_t *session = ra_session->priv;
   apr_hash_index_t *hi;
-  apr_pool_t *subpool;
+  apr_pool_t *iterpool;
 
-  subpool = svn_pool_create(pool);
+  iterpool = svn_pool_create(scratch_pool);
 
   /* ### TODO for issue 2263: Send all the locks over the wire at once.  This
      loop is just a temporary shim. */
-  for (hi = apr_hash_first(pool, path_tokens); hi; hi = apr_hash_next(hi))
+  for (hi = apr_hash_first(scratch_pool, path_tokens);
+       hi;
+       hi = apr_hash_next(hi))
     {
       svn_ra_serf__handler_t *handler;
       svn_ra_serf__simple_request_context_t *ctx;
       const char *req_url, *path, *token;
-      const void *key;
-      void *val;
       svn_lock_t *existing_lock = NULL;
       struct unlock_context_t unlock_ctx;
-      svn_error_t *lock_err = NULL;
+      svn_error_t *err = NULL;
+      svn_error_t *new_err = NULL;
+
 
-      svn_pool_clear(subpool);
+      svn_pool_clear(iterpool);
 
-      ctx = apr_pcalloc(subpool, sizeof(*ctx));
-      ctx->pool = subpool;
+      ctx = apr_pcalloc(iterpool, sizeof(*ctx));
+      ctx->pool = iterpool;
 
-      apr_hash_this(hi, &key, NULL, &val);
-      path = key;
-      token = val;
+      path = svn__apr_hash_index_key(hi);
+      token = svn__apr_hash_index_val(hi);
 
       if (force && (!token || token[0] == '\0'))
         {
           SVN_ERR(svn_ra_serf__get_lock(ra_session, &existing_lock, path,
-                                        subpool));
+                                        iterpool));
           token = existing_lock->token;
           if (!token)
             {
-              svn_error_t *err;
-
               err = svn_error_createf(SVN_ERR_RA_NOT_LOCKED, NULL,
                                       _("'%s' is not locked in the repository"),
                                       path);
@@ -723,22 +715,29 @@ svn_ra_serf__unlock(svn_ra_session_t *ra
               if (lock_func)
                 {
                   svn_error_t *err2;
-                  err2 = lock_func(lock_baton, path, FALSE, NULL, err, subpool);
+                  err2 = lock_func(lock_baton, path, FALSE, NULL, err,
+                                   iterpool);
                   svn_error_clear(err);
+                  err = NULL;
                   if (err2)
-                    return err2;
+                    return svn_error_trace(err2);
+                }
+              else
+                {
+                  svn_error_clear(err);
+                  err = NULL;
                 }
               continue;
             }
         }
 
       unlock_ctx.force = force;
-      unlock_ctx.token = apr_pstrcat(subpool, "<", token, ">", (char *)NULL);
+      unlock_ctx.token = apr_pstrcat(iterpool, "<", token, ">", (char *)NULL);
 
       req_url = svn_path_url_add_component2(session->session_url.path, path,
-                                            subpool);
+                                            iterpool);
 
-      handler = apr_pcalloc(subpool, sizeof(*handler));
+      handler = apr_pcalloc(iterpool, sizeof(*handler));
 
       handler->method = "UNLOCK";
       handler->path = req_url;
@@ -752,7 +751,7 @@ svn_ra_serf__unlock(svn_ra_session_t *ra
       handler->response_baton = ctx;
 
       svn_ra_serf__request_create(handler);
-      SVN_ERR(svn_ra_serf__context_run_wait(&ctx->done, session, subpool));
+      SVN_ERR(svn_ra_serf__context_run_wait(&ctx->done, session, iterpool));
 
       switch (ctx->status)
         {
@@ -760,23 +759,25 @@ svn_ra_serf__unlock(svn_ra_session_t *ra
             break; /* OK */
           case 403:
             /* Api users expect this specific error code to detect failures */
-            lock_err = svn_error_createf(SVN_ERR_FS_LOCK_OWNER_MISMATCH, NULL,
-                                         _("Unlock request failed: %d %s"),
-                                         ctx->status, ctx->reason);
+            err = svn_error_createf(SVN_ERR_FS_LOCK_OWNER_MISMATCH, NULL,
+                                    _("Unlock request failed: %d %s"),
+                                    ctx->status, ctx->reason);
             break;
           default:
-            lock_err = svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
-                                   _("Unlock request failed: %d %s"),
-                                   ctx->status, ctx->reason);
+            err = svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+                                    _("Unlock request failed: %d %s"),
+                                    ctx->status, ctx->reason);
         }
 
       if (lock_func)
-        {
-          SVN_ERR(lock_func(lock_baton, path, FALSE, existing_lock,
-                            lock_err, subpool));
-          svn_error_clear(lock_err);
-        }
+        new_err = lock_func(lock_baton, path, FALSE, existing_lock, err,
+                            iterpool);
+
+      svn_error_clear(err);
+      SVN_ERR(new_err);
     }
 
+  svn_pool_destroy(iterpool);
+
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/log.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/log.c Mon Apr 23 12:32:48 2012
@@ -32,12 +32,14 @@
 #include "svn_pools.h"
 #include "svn_ra.h"
 #include "svn_dav.h"
+#include "svn_base64.h"
 #include "svn_xml.h"
 #include "svn_config.h"
 #include "svn_path.h"
 #include "svn_props.h"
 
 #include "private/svn_dav_protocol.h"
+#include "private/svn_string_private.h"
 #include "svn_private_config.h"
 
 #include "ra_serf.h"
@@ -67,9 +69,11 @@ typedef enum log_state_e {
 typedef struct log_info_t {
   apr_pool_t *pool;
 
-  /* The currently collected value as we build it up */
-  const char *tmp;
-  apr_size_t tmp_len;
+  /* The currently collected value as we build it up, and its wire
+   * encoding (if any).
+   */
+  svn_stringbuf_t *tmp;
+  const char *tmp_encoding;
 
   /* Temporary change path - ultimately inserted into changed_paths hash. */
   svn_log_changed_path2_t *tmp_path;
@@ -114,7 +118,8 @@ typedef struct log_context_t {
 static log_info_t *
 push_state(svn_ra_serf__xml_parser_t *parser,
            log_context_t *log_ctx,
-           log_state_e state)
+           log_state_e state,
+           const char **attrs)
 {
   svn_ra_serf__xml_push_state(parser, state);
 
@@ -125,6 +130,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
       info = apr_pcalloc(info_pool, sizeof(*info));
       info->pool = info_pool;
+      info->tmp = svn_stringbuf_create_empty(info_pool);
       info->log_entry = svn_log_entry_create(info_pool);
 
       info->log_entry->revision = SVN_INVALID_REVNUM;
@@ -152,6 +158,10 @@ push_state(svn_ra_serf__xml_parser_t *pa
     {
       log_info_t *info = parser->state->private;
 
+      info->tmp_encoding = svn_xml_get_attr_value("encoding", attrs);
+      if (info->tmp_encoding)
+        info->tmp_encoding = apr_pstrdup(info->pool, info->tmp_encoding);
+
       if (!info->log_entry->revprops)
         {
           info->log_entry->revprops = apr_hash_make(info->pool);
@@ -180,11 +190,11 @@ read_changed_path_attributes(svn_log_cha
 
 static svn_error_t *
 start_log(svn_ra_serf__xml_parser_t *parser,
-          void *userData,
           svn_ra_serf__dav_props_t name,
-          const char **attrs)
+          const char **attrs,
+          apr_pool_t *scratch_pool)
 {
-  log_context_t *log_ctx = userData;
+  log_context_t *log_ctx = parser->user_data;
   log_state_e state;
 
   state = parser->state->current_state;
@@ -192,12 +202,12 @@ start_log(svn_ra_serf__xml_parser_t *par
   if (state == NONE &&
       strcmp(name.name, "log-report") == 0)
     {
-      push_state(parser, log_ctx, REPORT);
+      push_state(parser, log_ctx, REPORT, attrs);
     }
   else if (state == REPORT &&
            strcmp(name.name, "log-item") == 0)
     {
-      push_state(parser, log_ctx, ITEM);
+      push_state(parser, log_ctx, ITEM, attrs);
     }
   else if (state == ITEM)
     {
@@ -205,44 +215,43 @@ start_log(svn_ra_serf__xml_parser_t *par
 
       if (strcmp(name.name, SVN_DAV__VERSION_NAME) == 0)
         {
-          push_state(parser, log_ctx, VERSION);
+          push_state(parser, log_ctx, VERSION, attrs);
         }
       else if (strcmp(name.name, "creator-displayname") == 0)
         {
-          push_state(parser, log_ctx, CREATOR);
+          push_state(parser, log_ctx, CREATOR, attrs);
         }
       else if (strcmp(name.name, "date") == 0)
         {
-          push_state(parser, log_ctx, DATE);
+          push_state(parser, log_ctx, DATE, attrs);
         }
       else if (strcmp(name.name, "comment") == 0)
         {
-          push_state(parser, log_ctx, COMMENT);
+          push_state(parser, log_ctx, COMMENT, attrs);
         }
       else if (strcmp(name.name, "revprop") == 0)
         {
-          const char *revprop_name;
-          info = push_state(parser, log_ctx, REVPROP);
-          revprop_name = svn_xml_get_attr_value("name", attrs);
+          const char *revprop_name =
+            svn_xml_get_attr_value("name", attrs);
           if (revprop_name == NULL)
             return svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
                                      _("Missing name attr in revprop element"));
-
+          info = push_state(parser, log_ctx, REVPROP, attrs);
           info->revprop_name = apr_pstrdup(info->pool, revprop_name);
         }
       else if (strcmp(name.name, "has-children") == 0)
         {
-          push_state(parser, log_ctx, HAS_CHILDREN);
+          push_state(parser, log_ctx, HAS_CHILDREN, attrs);
         }
       else if (strcmp(name.name, "subtractive-merge") == 0)
         {
-          push_state(parser, log_ctx, SUBTRACTIVE_MERGE);
+          push_state(parser, log_ctx, SUBTRACTIVE_MERGE, attrs);
         }
       else if (strcmp(name.name, "added-path") == 0)
         {
           const char *copy_path, *copy_rev_str;
 
-          info = push_state(parser, log_ctx, ADDED_PATH);
+          info = push_state(parser, log_ctx, ADDED_PATH, attrs);
           info->tmp_path->action = 'A';
 
           copy_path = svn_xml_get_attr_value("copyfrom-path", attrs);
@@ -266,7 +275,7 @@ start_log(svn_ra_serf__xml_parser_t *par
         {
           const char *copy_path, *copy_rev_str;
 
-          info = push_state(parser, log_ctx, REPLACED_PATH);
+          info = push_state(parser, log_ctx, REPLACED_PATH, attrs);
           info->tmp_path->action = 'R';
 
           copy_path = svn_xml_get_attr_value("copyfrom-path", attrs);
@@ -288,14 +297,14 @@ start_log(svn_ra_serf__xml_parser_t *par
         }
       else if (strcmp(name.name, "deleted-path") == 0)
         {
-          info = push_state(parser, log_ctx, DELETED_PATH);
+          info = push_state(parser, log_ctx, DELETED_PATH, attrs);
           info->tmp_path->action = 'D';
 
           SVN_ERR(read_changed_path_attributes(info->tmp_path, attrs));
         }
       else if (strcmp(name.name, "modified-path") == 0)
         {
-          info = push_state(parser, log_ctx, MODIFIED_PATH);
+          info = push_state(parser, log_ctx, MODIFIED_PATH, attrs);
           info->tmp_path->action = 'M';
 
           SVN_ERR(read_changed_path_attributes(info->tmp_path, attrs));
@@ -305,12 +314,48 @@ start_log(svn_ra_serf__xml_parser_t *par
   return SVN_NO_ERROR;
 }
 
+/*
+ * Set *DECODED_CDATA to a copy of current CDATA being tracked in INFO,
+ * decoded as necessary, and allocated from INFO->pool..
+ */
+static svn_error_t *
+maybe_decode_log_cdata(const svn_string_t **decoded_cdata,
+                       log_info_t *info)
+{
+
+  if (info->tmp_encoding)
+    {
+      svn_string_t tmp;
+
+      /* Don't use morph_info_string cuz we need info->tmp to
+         remain usable.  */
+      tmp.data = info->tmp->data;
+      tmp.len = info->tmp->len;
+
+      /* Check for a known encoding type.  This is easy -- there's
+         only one.  */
+      if (strcmp(info->tmp_encoding, "base64") != 0)
+        {
+          return svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
+                                   _("Unsupported encoding '%s'"),
+                                   info->tmp_encoding);
+        }
+
+      *decoded_cdata = svn_base64_decode_string(&tmp, info->pool);
+    }
+  else
+    {
+      *decoded_cdata = svn_string_create_from_buf(info->tmp, info->pool);
+    }
+  return SVN_NO_ERROR;
+}
+
 static svn_error_t *
 end_log(svn_ra_serf__xml_parser_t *parser,
-        void *userData,
-        svn_ra_serf__dav_props_t name)
+        svn_ra_serf__dav_props_t name,
+        apr_pool_t *scratch_pool)
 {
-  log_context_t *log_ctx = userData;
+  log_context_t *log_ctx = parser->user_data;
   log_state_e state;
   log_info_t *info;
 
@@ -352,8 +397,8 @@ end_log(svn_ra_serf__xml_parser_t *parse
   else if (state == VERSION &&
            strcmp(name.name, SVN_DAV__VERSION_NAME) == 0)
     {
-      info->log_entry->revision = SVN_STR_TO_REV(info->tmp);
-      info->tmp_len = 0;
+      info->log_entry->revision = SVN_STR_TO_REV(info->tmp->data);
+      svn_stringbuf_setempty(info->tmp);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == CREATOR &&
@@ -361,12 +406,12 @@ end_log(svn_ra_serf__xml_parser_t *parse
     {
       if (log_ctx->want_author)
         {
+          const svn_string_t *decoded_cdata;
+          SVN_ERR(maybe_decode_log_cdata(&decoded_cdata, info));
           apr_hash_set(info->log_entry->revprops, SVN_PROP_REVISION_AUTHOR,
-                       APR_HASH_KEY_STRING,
-                       svn_string_ncreate(info->tmp, info->tmp_len,
-                                          info->pool));
+                       APR_HASH_KEY_STRING, decoded_cdata);
         }
-      info->tmp_len = 0;
+      svn_stringbuf_setempty(info->tmp);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == DATE &&
@@ -374,12 +419,12 @@ end_log(svn_ra_serf__xml_parser_t *parse
     {
       if (log_ctx->want_date)
         {
+          const svn_string_t *decoded_cdata;
+          SVN_ERR(maybe_decode_log_cdata(&decoded_cdata, info));
           apr_hash_set(info->log_entry->revprops, SVN_PROP_REVISION_DATE,
-                       APR_HASH_KEY_STRING,
-                       svn_string_ncreate(info->tmp, info->tmp_len,
-                                          info->pool));
+                       APR_HASH_KEY_STRING, decoded_cdata);
         }
-      info->tmp_len = 0;
+      svn_stringbuf_setempty(info->tmp);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == COMMENT &&
@@ -387,20 +432,21 @@ end_log(svn_ra_serf__xml_parser_t *parse
     {
       if (log_ctx->want_message)
         {
+          const svn_string_t *decoded_cdata;
+          SVN_ERR(maybe_decode_log_cdata(&decoded_cdata, info));
           apr_hash_set(info->log_entry->revprops, SVN_PROP_REVISION_LOG,
-                       APR_HASH_KEY_STRING,
-                       svn_string_ncreate(info->tmp, info->tmp_len,
-                                          info->pool));
+                       APR_HASH_KEY_STRING, decoded_cdata);
         }
-      info->tmp_len = 0;
+      svn_stringbuf_setempty(info->tmp);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == REVPROP)
     {
+      const svn_string_t *decoded_cdata;
+      SVN_ERR(maybe_decode_log_cdata(&decoded_cdata, info));
       apr_hash_set(info->log_entry->revprops, info->revprop_name,
-                   APR_HASH_KEY_STRING,
-                   svn_string_ncreate(info->tmp, info->tmp_len, info->pool));
-      info->tmp_len = 0;
+                   APR_HASH_KEY_STRING, decoded_cdata);
+      svn_stringbuf_setempty(info->tmp);
       svn_ra_serf__xml_pop_state(parser);
     }
   else if (state == HAS_CHILDREN &&
@@ -426,8 +472,8 @@ end_log(svn_ra_serf__xml_parser_t *parse
     {
       char *path;
 
-      path = apr_pstrmemdup(info->pool, info->tmp, info->tmp_len);
-      info->tmp_len = 0;
+      path = apr_pstrmemdup(info->pool, info->tmp->data, info->tmp->len);
+      svn_stringbuf_setempty(info->tmp);
 
       apr_hash_set(info->log_entry->changed_paths2, path, APR_HASH_KEY_STRING,
                    info->tmp_path);
@@ -439,11 +485,11 @@ end_log(svn_ra_serf__xml_parser_t *parse
 
 static svn_error_t *
 cdata_log(svn_ra_serf__xml_parser_t *parser,
-          void *userData,
           const char *data,
-          apr_size_t len)
+          apr_size_t len,
+          apr_pool_t *scratch_pool)
 {
-  log_context_t *log_ctx = userData;
+  log_context_t *log_ctx = parser->user_data;
   log_state_e state;
   log_info_t *info;
 
@@ -463,9 +509,9 @@ cdata_log(svn_ra_serf__xml_parser_t *par
       case REPLACED_PATH:
       case DELETED_PATH:
       case MODIFIED_PATH:
-        svn_ra_serf__expand_string(&info->tmp, &info->tmp_len,
-                                   data, len, info->pool);
+        svn_stringbuf_appendbytes(info->tmp, data, len);
         break;
+
       default:
         break;
     }
@@ -562,6 +608,10 @@ create_log_body(serf_bucket_t **body_bkt
         }
     }
 
+  svn_ra_serf__add_tag_buckets(buckets,
+                               "S:encode-binary-props", NULL,
+                               alloc);
+
   svn_ra_serf__add_close_tag_buckets(buckets, alloc,
                                      "S:log-report");
 

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/merge.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/merge.c Mon Apr 23 12:32:48 2012
@@ -80,8 +80,8 @@ typedef struct merge_info_t {
 
   const char *prop_ns;
   const char *prop_name;
-  const char *prop_val;
-  apr_size_t prop_val_len;
+  svn_stringbuf_t *prop_value;
+
 } merge_info_t;
 
 /* Structure associated with a MERGE request. */
@@ -119,6 +119,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
       info = apr_palloc(parser->state->pool, sizeof(*info));
       info->pool = parser->state->pool;
       info->props = apr_hash_make(info->pool);
+      info->prop_value = svn_stringbuf_create_empty(info->pool);
 
       parser->state->private = info;
     }
@@ -128,11 +129,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
 static svn_error_t *
 start_merge(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
             svn_ra_serf__dav_props_t name,
-            const char **attrs)
+            const char **attrs,
+            apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__merge_context_t *ctx = userData;
+  svn_ra_serf__merge_context_t *ctx = parser->user_data;
   merge_state_e state;
   merge_info_t *info;
 
@@ -163,9 +164,8 @@ start_merge(svn_ra_serf__xml_parser_t *p
       info = push_state(parser, ctx, PROP_VAL);
 
       info->prop_ns = name.namespace;
-      info->prop_name = apr_pstrdup(info->pool, name.name);
-      info->prop_val = NULL;
-      info->prop_val_len = 0;
+      info->prop_name = "href";
+      svn_stringbuf_setempty(info->prop_value);
     }
   else if (state == RESPONSE &&
            strcmp(name.name, "propstat") == 0)
@@ -206,11 +206,9 @@ start_merge(svn_ra_serf__xml_parser_t *p
            strcmp(name.name, "checked-in") == 0)
     {
       info = push_state(parser, ctx, IGNORE_PROP_NAME);
-
       info->prop_ns = name.namespace;
-      info->prop_name = apr_pstrdup(info->pool, name.name);
-      info->prop_val = NULL;
-      info->prop_val_len = 0;
+      info->prop_name = "checked-in";
+      svn_stringbuf_setempty(info->prop_value);
     }
   else if (state == PROP)
     {
@@ -225,8 +223,7 @@ start_merge(svn_ra_serf__xml_parser_t *p
       info = push_state(parser, ctx, PROP_VAL);
       info->prop_ns = name.namespace;
       info->prop_name = apr_pstrdup(info->pool, name.name);
-      info->prop_val = NULL;
-      info->prop_val_len = 0;
+      svn_stringbuf_setempty(info->prop_value);
     }
   else
     {
@@ -238,10 +235,10 @@ start_merge(svn_ra_serf__xml_parser_t *p
 
 static svn_error_t *
 end_merge(svn_ra_serf__xml_parser_t *parser,
-          void *userData,
-          svn_ra_serf__dav_props_t name)
+          svn_ra_serf__dav_props_t name,
+          apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__merge_context_t *ctx = userData;
+  svn_ra_serf__merge_context_t *ctx = parser->user_data;
   merge_state_e state;
   merge_info_t *info;
 
@@ -349,24 +346,27 @@ end_merge(svn_ra_serf__xml_parser_t *par
     }
   else if (state == PROP_VAL)
     {
+      const char *value;
+
       if (!info->prop_name)
         {
+          /* ### gstein sez: dunno what this is about.  */
           info->prop_name = apr_pstrdup(info->pool, name.name);
         }
-      info->prop_val = apr_pstrmemdup(info->pool, info->prop_val,
-                                      info->prop_val_len);
+
       if (strcmp(info->prop_name, "href") == 0)
-        info->prop_val = svn_urlpath__canonicalize(info->prop_val,
-                                                       info->pool);
+        value = svn_urlpath__canonicalize(info->prop_value->data, info->pool);
+      else
+        value = apr_pstrmemdup(info->pool,
+                               info->prop_value->data, info->prop_value->len);
 
       /* Set our property. */
       apr_hash_set(info->props, info->prop_name, APR_HASH_KEY_STRING,
-                   info->prop_val);
+                   value);
 
       info->prop_ns = NULL;
       info->prop_name = NULL;
-      info->prop_val = NULL;
-      info->prop_val_len = 0;
+      svn_stringbuf_setempty(info->prop_value);
 
       svn_ra_serf__xml_pop_state(parser);
     }
@@ -376,11 +376,11 @@ end_merge(svn_ra_serf__xml_parser_t *par
 
 static svn_error_t *
 cdata_merge(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
             const char *data,
-            apr_size_t len)
+            apr_size_t len,
+            apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__merge_context_t *ctx = userData;
+  svn_ra_serf__merge_context_t *ctx = parser->user_data;
   merge_state_e state;
   merge_info_t *info;
 
@@ -390,10 +390,7 @@ cdata_merge(svn_ra_serf__xml_parser_t *p
   info = parser->state->private;
 
   if (state == PROP_VAL)
-    {
-      svn_ra_serf__expand_string(&info->prop_val, &info->prop_val_len,
-                                 data, len, parser->state->pool);
-    }
+    svn_stringbuf_appendbytes(info->prop_value, data, len);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/mergeinfo.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/mergeinfo.c Mon Apr 23 12:32:48 2012
@@ -66,11 +66,11 @@ typedef struct mergeinfo_context_t {
 
 static svn_error_t *
 start_element(svn_ra_serf__xml_parser_t *parser,
-              void *userData,
               svn_ra_serf__dav_props_t name,
-              const char **attrs)
+              const char **attrs,
+              apr_pool_t *scratch_pool)
 {
-  mergeinfo_context_t *mergeinfo_ctx = userData;
+  mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
   mergeinfo_state_e state;
 
   state = parser->state->current_state;
@@ -99,10 +99,11 @@ start_element(svn_ra_serf__xml_parser_t 
 }
 
 static svn_error_t *
-end_element(svn_ra_serf__xml_parser_t *parser, void *userData,
-            svn_ra_serf__dav_props_t name)
+end_element(svn_ra_serf__xml_parser_t *parser,
+            svn_ra_serf__dav_props_t name,
+            apr_pool_t *scratch_pool)
 {
-  mergeinfo_context_t *mergeinfo_ctx = userData;
+  mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
   mergeinfo_state_e state;
 
   state = parser->state->current_state;
@@ -149,10 +150,12 @@ end_element(svn_ra_serf__xml_parser_t *p
 
 
 static svn_error_t *
-cdata_handler(svn_ra_serf__xml_parser_t *parser, void *userData,
-              const char *data, apr_size_t len)
+cdata_handler(svn_ra_serf__xml_parser_t *parser,
+              const char *data,
+              apr_size_t len,
+              apr_pool_t *scratch_pool)
 {
-  mergeinfo_context_t *mergeinfo_ctx = userData;
+  mergeinfo_context_t *mergeinfo_ctx = parser->user_data;
   mergeinfo_state_e state;
 
   state = parser->state->current_state;

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/options.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/options.c Mon Apr 23 12:32:48 2012
@@ -66,8 +66,8 @@ struct svn_ra_serf__options_context_t {
   /* pool to allocate memory from */
   apr_pool_t *pool;
 
-  const char *attr_val;
-  apr_size_t attr_val_len;
+  /* Buffer for the activity-collection  */
+  svn_stringbuf_t *acbuf;
   svn_boolean_t collect_cdata;
 
   /* Current state we're in */
@@ -127,11 +127,11 @@ static void pop_state(svn_ra_serf__optio
 
 static svn_error_t *
 start_options(svn_ra_serf__xml_parser_t *parser,
-              void *userData,
               svn_ra_serf__dav_props_t name,
-              const char **attrs)
+              const char **attrs,
+              apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__options_context_t *options_ctx = userData;
+  svn_ra_serf__options_context_t *options_ctx = parser->user_data;
 
   if (!options_ctx->state && strcmp(name.name, "options-response") == 0)
     {
@@ -159,10 +159,10 @@ start_options(svn_ra_serf__xml_parser_t 
 
 static svn_error_t *
 end_options(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
-            svn_ra_serf__dav_props_t name)
+            svn_ra_serf__dav_props_t name,
+            apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__options_context_t *options_ctx = userData;
+  svn_ra_serf__options_context_t *options_ctx = parser->user_data;
   options_state_list_t *cur_state;
 
   if (!options_ctx->state)
@@ -187,7 +187,7 @@ end_options(svn_ra_serf__xml_parser_t *p
     {
       options_ctx->collect_cdata = FALSE;
       options_ctx->activity_collection =
-        svn_urlpath__canonicalize(options_ctx->attr_val, options_ctx->pool);
+        svn_urlpath__canonicalize(options_ctx->acbuf->data, options_ctx->pool);
       pop_state(options_ctx);
     }
 
@@ -196,16 +196,14 @@ end_options(svn_ra_serf__xml_parser_t *p
 
 static svn_error_t *
 cdata_options(svn_ra_serf__xml_parser_t *parser,
-              void *userData,
               const char *data,
-              apr_size_t len)
+              apr_size_t len,
+              apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__options_context_t *ctx = userData;
+  svn_ra_serf__options_context_t *ctx = parser->user_data;
+
   if (ctx->collect_cdata)
-    {
-      svn_ra_serf__expand_string(&ctx->attr_val, &ctx->attr_val_len,
-                                 data, len, ctx->pool);
-    }
+    svn_stringbuf_appendbytes(ctx->acbuf, data, len);
 
   return SVN_NO_ERROR;
 }
@@ -442,6 +440,8 @@ svn_ra_serf__create_options_req(svn_ra_s
 
   new_ctx->pool = pool;
 
+  new_ctx->acbuf = svn_stringbuf_create_empty(pool);
+
   new_ctx->path = path;
   new_ctx->youngest_rev = SVN_INVALID_REVNUM;
 

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c Mon Apr 23 12:32:48 2012
@@ -33,6 +33,7 @@
 
 #include "private/svn_dav_protocol.h"
 #include "private/svn_fspath.h"
+#include "private/svn_string_private.h"
 #include "svn_private_config.h"
 
 #include "ra_serf.h"
@@ -51,11 +52,8 @@ typedef struct prop_info_t {
 
   /* Current ns, attribute name, and value of the property we're parsing */
   const char *ns;
-
   const char *name;
-
-  const char *val;
-  apr_size_t val_len;
+  svn_stringbuf_t *value;
 
   const char *encoding;
 
@@ -243,6 +241,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
       info = apr_pcalloc(parser->state->pool, sizeof(*info));
       info->pool = parser->state->pool;
+      info->value = svn_stringbuf_create_empty(info->pool);
 
       parser->state->private = info;
     }
@@ -255,11 +254,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
  */
 static svn_error_t *
 start_propfind(svn_ra_serf__xml_parser_t *parser,
-               void *userData,
                svn_ra_serf__dav_props_t name,
-               const char **attrs)
+               const char **attrs,
+               apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__propfind_context_t *ctx = userData;
+  svn_ra_serf__propfind_context_t *ctx = parser->user_data;
   prop_state_e state;
   prop_info_t *info;
 
@@ -273,7 +272,7 @@ start_propfind(svn_ra_serf__xml_parser_t
     {
       info = push_state(parser, ctx, PROPVAL);
       info->ns = name.namespace;
-      info->name = apr_pstrdup(info->pool, name.name);
+      info->name = "href";
     }
   else if (state == RESPONSE && strcmp(name.name, "prop") == 0)
     {
@@ -296,10 +295,10 @@ start_propfind(svn_ra_serf__xml_parser_t
  */
 static svn_error_t *
 end_propfind(svn_ra_serf__xml_parser_t *parser,
-             void *userData,
-             svn_ra_serf__dav_props_t name)
+             svn_ra_serf__dav_props_t name,
+             apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__propfind_context_t *ctx = userData;
+  svn_ra_serf__propfind_context_t *ctx = parser->user_data;
   prop_state_e state;
   prop_info_t *info;
 
@@ -316,24 +315,20 @@ end_propfind(svn_ra_serf__xml_parser_t *
     }
   else if (state == PROPVAL)
     {
-      const char *ns, *pname, *val;
-      svn_string_t *val_str;
+      const char *ns;
+      const char *pname;
+      const svn_string_t *val_str = NULL;
 
       /* if we didn't see a CDATA element, we may want the tag name
        * as long as it isn't equivalent to the property name.
        */
-      if (!info->val)
+      /* ### gstein sez: I have no idea what this is about.  */
+      if (*info->value->data == '\0')
         {
           if (strcmp(info->name, name.name) != 0)
-            {
-              info->val = name.name;
-              info->val_len = strlen(info->val);
-            }
+            val_str = svn_string_create(name.name, ctx->pool);
           else
-            {
-              info->val = "";
-              info->val_len = 0;
-            }
+            val_str = svn_string_create_empty(ctx->pool);
         }
 
       if (parser->state->prev->current_state == RESPONSE &&
@@ -342,7 +337,7 @@ end_propfind(svn_ra_serf__xml_parser_t *
           if (strcmp(ctx->depth, "1") == 0)
             {
               ctx->current_path =
-                svn_urlpath__canonicalize(info->val, ctx->pool);
+                svn_urlpath__canonicalize(info->value->data, ctx->pool);
             }
           else
             {
@@ -353,15 +348,13 @@ end_propfind(svn_ra_serf__xml_parser_t *
         {
           if (strcmp(info->encoding, "base64") == 0)
             {
-              svn_string_t encoded;
-              const svn_string_t *decoded;
-
-              encoded.data = info->val;
-              encoded.len = info->val_len;
+              const svn_string_t *morph;
 
-              decoded = svn_base64_decode_string(&encoded, parser->state->pool);
-              info->val = decoded->data;
-              info->val_len = decoded->len;
+              morph = svn_stringbuf__morph_into_string(info->value);
+#ifdef SVN_DEBUG
+              info->value = NULL;  /* morph killed the stringbuf.  */
+#endif
+              val_str = svn_base64_decode_string(morph, ctx->pool);
             }
           else
             {
@@ -372,10 +365,13 @@ end_propfind(svn_ra_serf__xml_parser_t *
             }
         }
 
+      /* ### there may be better logic to ensure this is set above, but just
+         ### going for the easy win here.  */
+      if (val_str == NULL)
+        val_str = svn_string_create_from_buf(info->value, ctx->pool);
+
       ns = apr_pstrdup(ctx->pool, info->ns);
       pname = apr_pstrdup(ctx->pool, info->name);
-      val = apr_pmemdup(ctx->pool, info->val, info->val_len);
-      val_str = svn_string_ncreate(val, info->val_len, ctx->pool);
 
       /* set the return props and update our cache too. */
       svn_ra_serf__set_ver_prop(ctx->ret_props,
@@ -396,11 +392,11 @@ end_propfind(svn_ra_serf__xml_parser_t *
  */
 static svn_error_t *
 cdata_propfind(svn_ra_serf__xml_parser_t *parser,
-               void *userData,
                const char *data,
-               apr_size_t len)
+               apr_size_t len,
+               apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__propfind_context_t *ctx = userData;
+  svn_ra_serf__propfind_context_t *ctx = parser->user_data;
   prop_state_e state;
   prop_info_t *info;
 
@@ -410,10 +406,7 @@ cdata_propfind(svn_ra_serf__xml_parser_t
   info = parser->state->private;
 
   if (state == PROPVAL)
-    {
-      svn_ra_serf__expand_string(&info->val, &info->val_len, data, len,
-                                 info->pool);
-    }
+    svn_stringbuf_appendbytes(info->value, data, len);
 
   return SVN_NO_ERROR;
 }
@@ -988,32 +981,33 @@ svn_ra_serf__get_baseline_info(const cha
      revision (if needed) with an OPTIONS request.  */
   if (SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(session))
     {
-      basecoll_url = apr_psprintf(pool, "%s/%ld",
-                                  session->rev_root_stub, revision);
+      svn_revnum_t actual_revision;
 
-      if (latest_revnum)
+      if (SVN_IS_VALID_REVNUM(revision))
         {
-          if (SVN_IS_VALID_REVNUM(revision))
-            {
-              *latest_revnum = revision;
-            }
-          else
-           {
-              svn_ra_serf__options_context_t *opt_ctx;
+          actual_revision = revision;
+        }
+      else
+        {
+          svn_ra_serf__options_context_t *opt_ctx;
 
-              SVN_ERR(svn_ra_serf__create_options_req(&opt_ctx, session, conn,
+          SVN_ERR(svn_ra_serf__create_options_req(&opt_ctx, session, conn,
                                                   session->session_url.path,
                                                   pool));
-              SVN_ERR(svn_ra_serf__context_run_wait(
+          SVN_ERR(svn_ra_serf__context_run_wait(
                 svn_ra_serf__get_options_done_ptr(opt_ctx), session, pool));
 
-             *latest_revnum = svn_ra_serf__options_get_youngest_rev(opt_ctx);
-             if (! SVN_IS_VALID_REVNUM(*latest_revnum))
-               return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
-                                       _("The OPTIONS response did not include "
-                                         "the youngest revision"));
-          }
+          actual_revision = svn_ra_serf__options_get_youngest_rev(opt_ctx);
+          if (! SVN_IS_VALID_REVNUM(actual_revision))
+            return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
+                                    _("The OPTIONS response did not include "
+                                      "the youngest revision"));
         }
+
+      basecoll_url = apr_psprintf(pool, "%s/%ld",
+                                  session->rev_root_stub, actual_revision);
+      if (latest_revnum)
+        *latest_revnum = actual_revision;
     }
 
   /* Otherwise, we fall back to the old VCC_URL PROPFIND hunt.  */
@@ -1021,7 +1015,7 @@ svn_ra_serf__get_baseline_info(const cha
     {
       SVN_ERR(svn_ra_serf__discover_vcc(&vcc_url, session, conn, pool));
 
-      if (revision != SVN_INVALID_REVNUM)
+      if (SVN_IS_VALID_REVNUM(revision))
         {
           /* First check baseline information cache. */
           SVN_ERR(svn_ra_serf__blncache_get_bc_url(&basecoll_url,



Mime
View raw message