You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ar...@apache.org on 2011/08/16 11:38:43 UTC

svn commit: r1158171 [5/10] - in /subversion/branches/svn-bisect: ./ build/ build/ac-macros/ build/generator/ build/generator/swig/ notes/ subversion/bindings/ctypes-python/csvn/ subversion/bindings/ctypes-python/test/ subversion/bindings/javahl/native...

Modified: subversion/branches/svn-bisect/subversion/libsvn_ra_serf/locks.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_ra_serf/locks.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_ra_serf/locks.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_ra_serf/locks.c Tue Aug 16 09:38:37 2011
@@ -385,14 +385,6 @@ handle_lock(serf_request_t *request,
           return err;
         }
 
-      /* 405 == Method Not Allowed (Occurs when trying to lock a working
-         copy path which no longer exists at HEAD in the repository. */
-      if (sl.code == 405)
-        return svn_error_createf(SVN_ERR_FS_OUT_OF_DATE,
-                                 NULL,
-                                 _("Lock request failed: %d %s"),
-                                   ctx->status_code, ctx->reason);
-
       headers = serf_bucket_response_get_headers(response);
 
       val = serf_bucket_headers_get(headers, SVN_DAV_LOCK_OWNER_HEADER);

Modified: subversion/branches/svn-bisect/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_ra_serf/log.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_ra_serf/log.c Tue Aug 16 09:38:37 2011
@@ -464,7 +464,7 @@ cdata_log(svn_ra_serf__xml_parser_t *par
       case DELETED_PATH:
       case MODIFIED_PATH:
         svn_ra_serf__expand_string(&info->tmp, &info->tmp_len,
-                                   data, len, parser->state->pool);
+                                   data, len, info->pool);
         break;
       default:
         break;
@@ -589,6 +589,7 @@ svn_ra_serf__get_log(svn_ra_session_t *r
   svn_ra_serf__xml_parser_t *parser_ctx;
   svn_boolean_t want_custom_revprops;
   svn_revnum_t peg_rev;
+  svn_error_t *err;
   const char *relative_url, *basecoll_url, *req_url;
 
   log_ctx = apr_pcalloc(pool, sizeof(*log_ctx));
@@ -674,7 +675,13 @@ svn_ra_serf__get_log(svn_ra_session_t *r
 
   svn_ra_serf__request_create(handler);
 
-  SVN_ERR(svn_ra_serf__context_run_wait(&log_ctx->done, session, pool));
+  err = svn_ra_serf__context_run_wait(&log_ctx->done, session, pool);
+
+  SVN_ERR(svn_error_compose_create(
+              svn_ra_serf__error_on_status(log_ctx->status_code,
+                                           req_url,
+                                           parser_ctx->location),
+              err));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/svn-bisect/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_ra_serf/merge.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_ra_serf/merge.c Tue Aug 16 09:38:37 2011
@@ -294,8 +294,7 @@ end_merge(svn_ra_serf__xml_parser_t *par
           href = apr_hash_get(info->props, "href", APR_HASH_KEY_STRING);
           if (! svn_urlpath__is_ancestor(ctx->merge_url, href))
             {
-              /* ### need something better than APR_EGENERAL */
-              return svn_error_createf(APR_EGENERAL, NULL,
+              return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
                                        _("A MERGE response for '%s' is not "
                                          "a child of the destination ('%s')"),
                                        href, ctx->merge_url);

Modified: subversion/branches/svn-bisect/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_ra_serf/ra_serf.h?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_ra_serf/ra_serf.h Tue Aug 16 09:38:37 2011
@@ -74,7 +74,7 @@ typedef struct svn_ra_serf__connection_t
   serf_bucket_alloc_t *bkt_alloc;
 
   /* Host name */
-  const char *hostinfo;
+  const char *hostname;
 
   /* Are we using ssl */
   svn_boolean_t using_ssl;
@@ -139,9 +139,13 @@ struct svn_ra_serf__session_t {
   const svn_ra_callbacks2_t *wc_callbacks;
   void *wc_callback_baton;
 
-  /* Callback function to send info to WC */
-  svn_ra_progress_notify_func_t wc_progress_func;
-  void *wc_progress_baton;
+  /* Callback function to send progress info to the client */
+  svn_ra_progress_notify_func_t progress_func;
+  void *progress_baton;
+
+  /* Callback function to handle cancellation */
+  svn_cancel_func_t cancel_func;
+  void *cancel_baton;
 
   /* Error that we've received but not yet returned upstream. */
   svn_error_t *pending_error;
@@ -175,6 +179,9 @@ struct svn_ra_serf__session_t {
   /* Connection timeout value */
   long timeout;
 
+  /* HTTPv1 flags */
+  svn_tristate_t supports_deadprop_count;
+
   /*** HTTP v2 protocol stuff. ***
    *
    * We assume that if mod_dav_svn sends one of the special v2 OPTIONs
@@ -622,6 +629,11 @@ struct svn_ra_serf__xml_parser_t {
 
      See libsvn_ra_serf/util.c  */
   struct svn_ra_serf__pending_t *pending;
+
+  /* Response restart support */
+  const void *headers_baton; /* Last pointer to headers */
+  apr_off_t skip_size; /* Number of bytes to skip */
+  apr_off_t read_size; /* Number of bytes read from response */
 };
 
 /*

Modified: subversion/branches/svn-bisect/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_ra_serf/replay.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_ra_serf/replay.c Tue Aug 16 09:38:37 2011
@@ -194,6 +194,7 @@ start_replay(svn_ra_serf__xml_parser_t *
 
       /* Create a pool for the commit editor. */
       ctx->dst_rev_pool = svn_pool_create(ctx->src_rev_pool);
+      ctx->file_pool = svn_pool_create(ctx->dst_rev_pool);
 
       /* ### it would be nice to have a proper scratch_pool.  */
       SVN_ERR(svn_ra_serf__select_revprops(&ctx->props,
@@ -650,7 +651,6 @@ svn_ra_serf__replay(svn_ra_session_t *ra
 
   replay_ctx = apr_pcalloc(pool, sizeof(*replay_ctx));
   replay_ctx->src_rev_pool = pool;
-  replay_ctx->file_pool = svn_pool_create(pool);
   replay_ctx->editor = editor;
   replay_ctx->editor_baton = edit_baton;
   replay_ctx->done = FALSE;
@@ -756,6 +756,9 @@ svn_ra_serf__replay_range(svn_ra_session
          to store the response status code. */
       int status_code;
 
+      if (session->cancel_func)
+        SVN_ERR(session->cancel_func(session->cancel_baton));
+
       /* Send pending requests, if any. Limit the number of outstanding
          requests to MAX_OUTSTANDING_REQUESTS. */
       if (rev <= end_revision  && active_reports < MAX_OUTSTANDING_REQUESTS)
@@ -766,7 +769,6 @@ svn_ra_serf__replay_range(svn_ra_session
 
           replay_ctx = apr_pcalloc(ctx_pool, sizeof(*replay_ctx));
           replay_ctx->src_rev_pool = ctx_pool;
-          replay_ctx->file_pool = svn_pool_create(pool);
           replay_ctx->revstart_func = revstart_func;
           replay_ctx->revfinish_func = revfinish_func;
           replay_ctx->replay_baton = replay_baton;

Modified: subversion/branches/svn-bisect/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_ra_serf/serf.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_ra_serf/serf.c Tue Aug 16 09:38:37 2011
@@ -39,10 +39,11 @@
 #include "../libsvn_ra/ra_loader.h"
 #include "svn_config.h"
 #include "svn_delta.h"
-#include "svn_version.h"
 #include "svn_dirent_uri.h"
+#include "svn_hash.h"
 #include "svn_path.h"
 #include "svn_time.h"
+#include "svn_version.h"
 
 #include "private/svn_dav_protocol.h"
 #include "private/svn_dep_compat.h"
@@ -326,11 +327,11 @@ static void
 svn_ra_serf__progress(void *progress_baton, apr_off_t read, apr_off_t written)
 {
   const svn_ra_serf__session_t *serf_sess = progress_baton;
-  if (serf_sess->wc_progress_func)
+  if (serf_sess->progress_func)
     {
-      serf_sess->wc_progress_func(read + written, -1,
-                                  serf_sess->wc_progress_baton,
-                                  serf_sess->pool);
+      serf_sess->progress_func(read + written, -1,
+                               serf_sess->progress_baton,
+                               serf_sess->pool);
     }
 }
 
@@ -355,8 +356,10 @@ svn_ra_serf__open(svn_ra_session_t *sess
   serf_sess->pool = svn_pool_create(pool);
   serf_sess->wc_callbacks = callbacks;
   serf_sess->wc_callback_baton = callback_baton;
-  serf_sess->wc_progress_baton = callbacks->progress_baton;
-  serf_sess->wc_progress_func = callbacks->progress_func;
+  serf_sess->progress_func = callbacks->progress_func;
+  serf_sess->progress_baton = callbacks->progress_baton;
+  serf_sess->cancel_func = callbacks->cancel_func;
+  serf_sess->cancel_baton = callback_baton;
 
   /* todo: reuse serf context across sessions */
   serf_sess->context = serf_context_create(serf_sess->pool);
@@ -384,6 +387,8 @@ svn_ra_serf__open(svn_ra_session_t *sess
   serf_sess->session_url_str = apr_pstrdup(serf_sess->pool, repos_URL);
   serf_sess->using_ssl = (svn_cstring_casecmp(url.scheme, "https") == 0);
 
+  serf_sess->supports_deadprop_count = svn_tristate_unknown;
+
   serf_sess->capabilities = apr_hash_make(serf_sess->pool);
 
   SVN_ERR(load_config(serf_sess, config, serf_sess->pool));
@@ -400,7 +405,7 @@ svn_ra_serf__open(svn_ra_session_t *sess
 
   serf_sess->conns[0]->using_ssl = serf_sess->using_ssl;
   serf_sess->conns[0]->using_compression = serf_sess->using_compression;
-  serf_sess->conns[0]->hostinfo = url.hostinfo;
+  serf_sess->conns[0]->hostname = url.hostname;
   serf_sess->conns[0]->useragent = NULL;
 
   /* create the user agent string */
@@ -658,6 +663,8 @@ struct dirent_walker_baton_t {
   /* Update the fields in this entry.  */
   svn_dirent_t *entry;
 
+  svn_tristate_t *supports_deadprop_count;
+
   /* If allocations are necessary, then use this pool.  */
   apr_pool_t *result_pool;
 };
@@ -683,9 +690,16 @@ dirent_walker(void *baton,
     {
       if(strcmp(name, "deadprop-count") == 0)
         {
-          apr_int64_t deadprop_count;
-          SVN_ERR(svn_cstring_atoi64(&deadprop_count, val->data));
-          dwb->entry->has_props = deadprop_count > 0;
+          if (*val->data)
+            {
+              apr_int64_t deadprop_count;
+              SVN_ERR(svn_cstring_atoi64(&deadprop_count, val->data));
+              dwb->entry->has_props = deadprop_count > 0;
+              if (dwb->supports_deadprop_count)
+                *dwb->supports_deadprop_count = svn_tristate_true;
+            }
+          else if (dwb->supports_deadprop_count)
+            *dwb->supports_deadprop_count = svn_tristate_false;
         }
     }
   else if (strcmp(ns, "DAV:") == 0)
@@ -732,6 +746,8 @@ struct path_dirent_visitor_t {
   apr_hash_t *full_paths;
   apr_hash_t *base_paths;
   const char *orig_path;
+  svn_tristate_t supports_deadprop_count;
+  apr_pool_t *result_pool;
 };
 
 static svn_error_t *
@@ -769,57 +785,74 @@ path_dirent_walker(void *baton,
     }
 
   dwb.entry = entry;
-  dwb.result_pool = pool;  /* ### fix this!  */
+  dwb.supports_deadprop_count = &dirents->supports_deadprop_count;
+  dwb.result_pool = dirents->result_pool;
   return svn_error_trace(dirent_walker(&dwb, ns, name, val, pool));
 }
 
 static const svn_ra_serf__dav_props_t *
-get_dirent_props(apr_uint32_t dirent_fields, apr_pool_t *pool)
+get_dirent_props(apr_uint32_t dirent_fields,
+                 svn_ra_serf__session_t *session,
+                 apr_pool_t *pool)
 {
   svn_ra_serf__dav_props_t *prop;
   apr_array_header_t *props = apr_array_make
     (pool, 7, sizeof(svn_ra_serf__dav_props_t));
 
-  if (dirent_fields & SVN_DIRENT_KIND)
+  if (session->supports_deadprop_count != svn_tristate_false
+      || ! (dirent_fields & SVN_DIRENT_HAS_PROPS))
     {
-      prop = apr_array_push(props);
-      prop->namespace = "DAV:";
-      prop->name = "resourcetype";
-    }
+      if (dirent_fields & SVN_DIRENT_KIND)
+        {
+          prop = apr_array_push(props);
+          prop->namespace = "DAV:";
+          prop->name = "resourcetype";
+        }
 
-  if (dirent_fields & SVN_DIRENT_SIZE)
-    {
-      prop = apr_array_push(props);
-      prop->namespace = "DAV:";
-      prop->name = "getcontentlength";
-    }
+      if (dirent_fields & SVN_DIRENT_SIZE)
+        {
+          prop = apr_array_push(props);
+          prop->namespace = "DAV:";
+          prop->name = "getcontentlength";
+        }
 
-  if (dirent_fields & SVN_DIRENT_HAS_PROPS)
-    {
-      prop = apr_array_push(props);
-      prop->namespace = SVN_DAV_PROP_NS_DAV;
-      prop->name = "deadprop-count";
-    }
+      if (dirent_fields & SVN_DIRENT_HAS_PROPS)
+        {
+          prop = apr_array_push(props);
+          prop->namespace = SVN_DAV_PROP_NS_DAV;
+          prop->name = "deadprop-count";
+        }
 
-  if (dirent_fields & SVN_DIRENT_CREATED_REV)
-    {
-      svn_ra_serf__dav_props_t *p = apr_array_push(props);
-      p->namespace = "DAV:";
-      p->name = SVN_DAV__VERSION_NAME;
-    }
+      if (dirent_fields & SVN_DIRENT_CREATED_REV)
+        {
+          svn_ra_serf__dav_props_t *p = apr_array_push(props);
+          p->namespace = "DAV:";
+          p->name = SVN_DAV__VERSION_NAME;
+        }
 
-  if (dirent_fields & SVN_DIRENT_TIME)
-    {
-      prop = apr_array_push(props);
-      prop->namespace = "DAV:";
-      prop->name = SVN_DAV__CREATIONDATE;
-    }
+      if (dirent_fields & SVN_DIRENT_TIME)
+        {
+          prop = apr_array_push(props);
+          prop->namespace = "DAV:";
+          prop->name = SVN_DAV__CREATIONDATE;
+        }
 
-  if (dirent_fields & SVN_DIRENT_LAST_AUTHOR)
+      if (dirent_fields & SVN_DIRENT_LAST_AUTHOR)
+        {
+          prop = apr_array_push(props);
+          prop->namespace = "DAV:";
+          prop->name = "creator-displayname";
+        }
+    }
+  else
     {
+      /* We found an old subversion server that can't handle
+         the deadprop-count property in the way we expect.
+
+         The neon behavior is to retrieve all properties in this case */
       prop = apr_array_push(props);
       prop->namespace = "DAV:";
-      prop->name = "creator-displayname";
+      prop->name = "allprop";
     }
 
   prop = apr_array_push(props);
@@ -843,10 +876,12 @@ svn_ra_serf__stat(svn_ra_session_t *ra_s
   svn_revnum_t fetched_rev;
   svn_error_t *err;
   struct dirent_walker_baton_t dwb;
+  svn_tristate_t deadprop_count = svn_tristate_unknown;
 
   err = fetch_path_props(&prop_ctx, &props, &path, &fetched_rev,
                          session, rel_path, revision,
-                         get_dirent_props(SVN_DIRENT_ALL, pool), pool);
+                         get_dirent_props(SVN_DIRENT_ALL, session, pool),
+                         pool);
   if (err)
     {
       if (err->apr_err == SVN_ERR_FS_NOT_FOUND)
@@ -860,11 +895,33 @@ svn_ra_serf__stat(svn_ra_session_t *ra_s
     }
 
   dwb.entry = apr_pcalloc(pool, sizeof(*dwb.entry));
-  dwb.result_pool = pool;  /* ### fix this  */
+  dwb.supports_deadprop_count = &deadprop_count;
+  dwb.result_pool = pool;
   SVN_ERR(svn_ra_serf__walk_all_props(props, path, fetched_rev,
                                       dirent_walker, &dwb,
                                       pool));
 
+  if (deadprop_count == svn_tristate_false
+      && session->supports_deadprop_count == svn_tristate_unknown
+      && !dwb.entry->has_props)
+    {
+      /* We have to requery as the server didn't give us the right
+         information */
+      session->supports_deadprop_count = svn_tristate_false;
+
+      SVN_ERR(fetch_path_props(&prop_ctx, &props, &path, &fetched_rev,
+                               session, rel_path, fetched_rev,
+                               get_dirent_props(SVN_DIRENT_ALL, session, pool),
+                               pool));
+
+      SVN_ERR(svn_ra_serf__walk_all_props(props, path, fetched_rev,
+                                      dirent_walker, &dwb,
+                                      pool));
+    }
+
+  if (deadprop_count != svn_tristate_unknown)
+    session->supports_deadprop_count = deadprop_count;
+
   *dirent = dwb.entry;
 
   return SVN_NO_ERROR;
@@ -941,7 +998,7 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
       SVN_ERR(svn_ra_serf__retrieve_props(&props, session, session->conns[0],
                                           path, revision, "1",
                                           get_dirent_props(dirent_fields,
-                                                           pool),
+                                                           session, pool),
                                           pool, pool));
 
       /* Check if the path is really a directory. */
@@ -954,11 +1011,38 @@ svn_ra_serf__get_dir(svn_ra_session_t *r
       dirent_walk.full_paths = apr_hash_make(pool);
       dirent_walk.base_paths = apr_hash_make(pool);
       dirent_walk.orig_path = svn_urlpath__canonicalize(path, pool);
+      dirent_walk.supports_deadprop_count = svn_tristate_unknown;
+      dirent_walk.result_pool = pool;
 
       SVN_ERR(svn_ra_serf__walk_all_paths(props, revision, path_dirent_walker,
                                           &dirent_walk, pool));
 
+      if (dirent_walk.supports_deadprop_count == svn_tristate_false
+          && session->supports_deadprop_count == svn_tristate_unknown
+          && dirent_fields & SVN_DIRENT_HAS_PROPS)
+        {
+          /* We have to requery as the server didn't give us the right
+             information */
+          session->supports_deadprop_count = svn_tristate_false;
+          SVN_ERR(svn_ra_serf__retrieve_props(&props, session,
+                                              session->conns[0],
+                                              path, revision, "1",
+                                              get_dirent_props(dirent_fields,
+                                                               session, pool),
+                                              pool, pool));
+
+          SVN_ERR(svn_hash__clear(dirent_walk.full_paths, pool));
+          SVN_ERR(svn_hash__clear(dirent_walk.base_paths, pool));
+
+          SVN_ERR(svn_ra_serf__walk_all_paths(props, revision,
+                                              path_dirent_walker,
+                                              &dirent_walk, pool));
+        }
+
       *dirents = dirent_walk.base_paths;
+
+      if (dirent_walk.supports_deadprop_count != svn_tristate_unknown)
+        session->supports_deadprop_count = dirent_walk.supports_deadprop_count;
     }
 
   /* If we're asked for the directory properties, fetch them too. */
@@ -1026,7 +1110,7 @@ svn_ra_serf__get_uuid(svn_ra_session_t *
       SVN_ERR(svn_ra_serf__discover_vcc(&vcc_url, session, NULL, pool));
       if (!session->uuid)
         {
-          return svn_error_create(APR_EGENERAL, NULL,
+          return svn_error_create(SVN_ERR_RA_DAV_RESPONSE_HEADER_BADNESS, NULL,
                                   _("The UUID property was not found on the "
                                     "resource or any of its parents"));
         }

Modified: subversion/branches/svn-bisect/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_ra_serf/update.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_ra_serf/update.c Tue Aug 16 09:38:37 2011
@@ -118,7 +118,7 @@ typedef struct report_dir_t
   /* the canonical url for this directory after updating. (received) */
   const char *url;
 
-  /* The original repos_relpath of this url (from the workingcopy)
+  /* The original repos_relpath of this url (from the working copy)
      or NULL if the repos_relpath can be calculated from the edit root. */
   const char *repos_relpath;
 
@@ -918,6 +918,7 @@ handle_fetch(serf_request_t *request,
 
       if (fetch_ctx->aborted_read)
         {
+          apr_off_t skip;
           /* We haven't caught up to where we were before. */
           if (fetch_ctx->read_size < fetch_ctx->aborted_read_size)
             {
@@ -938,9 +939,10 @@ handle_fetch(serf_request_t *request,
           /* Woo-hoo.  We're back. */
           fetch_ctx->aborted_read = FALSE;
 
-          /* Increment data and len by the difference. */
-          data += fetch_ctx->read_size - fetch_ctx->aborted_read_size;
-          len = fetch_ctx->read_size - fetch_ctx->aborted_read_size;
+          /* Update data and len to just provide the new data. */
+          skip = len - (fetch_ctx->read_size - fetch_ctx->aborted_read_size);
+          data += skip;
+          len -= skip;
         }
 
       if (fetch_ctx->delta_stream)
@@ -983,7 +985,12 @@ handle_fetch(serf_request_t *request,
              ### end of this block, so it will work for now.  */
           apr_pool_t *scratch_pool = info->editor_pool;
 
-          err = info->textdelta(NULL, info->textdelta_baton);
+          if (fetch_ctx->delta_stream)
+            err = svn_error_trace(svn_stream_close(fetch_ctx->delta_stream));
+          else
+            err = svn_error_trace(info->textdelta(NULL,
+                                                  info->textdelta_baton));
+
           if (err)
             {
               return error_fetch(request, fetch_ctx, err);
@@ -1021,7 +1028,7 @@ handle_fetch(serf_request_t *request,
 
           if (err)
             {
-              return error_fetch(request, fetch_ctx, err);
+              return svn_error_trace(error_fetch(request, fetch_ctx, err));
             }
 
           fetch_ctx->done = TRUE;
@@ -2214,7 +2221,7 @@ open_connection_if_needed(svn_ra_serf__s
       sess->conns[cur] = apr_palloc(sess->pool, sizeof(*sess->conns[cur]));
       sess->conns[cur]->bkt_alloc = serf_bucket_allocator_create(sess->pool,
                                                                  NULL, NULL);
-      sess->conns[cur]->hostinfo = sess->conns[0]->hostinfo;
+      sess->conns[cur]->hostname  = sess->conns[0]->hostname;
       sess->conns[cur]->using_ssl = sess->conns[0]->using_ssl;
       sess->conns[cur]->using_compression = sess->conns[0]->using_compression;
       sess->conns[cur]->useragent = sess->conns[0]->useragent;
@@ -2362,6 +2369,9 @@ finish_report(void *report_baton,
       /* Note: this throws out the old ITERPOOL_INNER.  */
       svn_pool_clear(iterpool);
 
+      if (sess->cancel_func)
+        SVN_ERR(sess->cancel_func(sess->cancel_baton));
+
       /* We need to be careful between the outer and inner ITERPOOLs,
          and what items are allocated within.  */
       iterpool_inner = svn_pool_create(iterpool);

Modified: subversion/branches/svn-bisect/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_ra_serf/util.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_ra_serf/util.c Tue Aug 16 09:38:37 2011
@@ -117,6 +117,7 @@ static int pbtest_step = 0;
                : ((p)->spill == NULL ? ((p)->head == NULL ? 2 : 3) \
                                      : ((p)->head == NULL ? 6 : 4)))
 
+/* Note: INJECT and COMPLETED are only used for debug output.  */
 typedef struct {
   svn_boolean_t paused;   /* pause the parser on this step?  */
   svn_boolean_t inject;   /* inject pending content on this step?  */
@@ -143,13 +144,17 @@ static const pbtest_desc_t pbtest_descri
 };
 
 #define PBTEST_SET_PAUSED(ctx) \
-  (pbtest_step < 14                                          \
+  (PBTEST_THIS_REQ(ctx) && pbtest_step < 14                  \
    ? (ctx)->paused = pbtest_description[pbtest_step].paused  \
    : FALSE)
 
-#define PBTEST_MAYBE_STEP(ctx) maybe_next_step(ctx)
+#define PBTEST_MAYBE_STEP(ctx, force) maybe_next_step(ctx, force)
 
-#define PBTEST_FORCE_SPILL() (pbtest_step == 6)
+#define PBTEST_FORCE_SPILL(ctx) (PBTEST_THIS_REQ(ctx) && pbtest_step == 6)
+
+#define PBTEST_THIS_REQ(ctx) \
+  ((ctx)->response_type != NULL \
+   && strcmp((ctx)->response_type, "update-report") == 0)
 
 #else /* PBTEST_ACTIVE  */
 
@@ -157,9 +162,10 @@ static const pbtest_desc_t pbtest_descri
    end up with "statement with no effect" warnings. Obviously, this
    depends upon particular usage, which is easy to verify.  */
 #define PBTEST_SET_PAUSED(ctx)  /* empty */
-#define PBTEST_MAYBE_STEP(ctx)  /* empty */
+#define PBTEST_MAYBE_STEP(ctx, force)  /* empty */
 
-#define PBTEST_FORCE_SPILL() FALSE
+#define PBTEST_FORCE_SPILL(ctx) FALSE
+#define PBTEST_THIS_REQ(ctx) FALSE
 
 #endif /* PBTEST_ACTIVE  */
 
@@ -296,7 +302,7 @@ ssl_server_cert(void *baton, int failure
       int i;
       for (i = 0; i < san->nelts; i++) {
           char *s = APR_ARRAY_IDX(san, i, char*);
-          if (apr_fnmatch(s, conn->hostinfo,
+          if (apr_fnmatch(s, conn->hostname,
                           APR_FNM_PERIOD) == APR_SUCCESS) {
               found_matching_hostname = 1;
               cert_info.hostname = s;
@@ -308,7 +314,7 @@ ssl_server_cert(void *baton, int failure
   /* Match server certificate CN with the hostname of the server */
   if (!found_matching_hostname && cert_info.hostname)
     {
-      if (apr_fnmatch(cert_info.hostname, conn->hostinfo,
+      if (apr_fnmatch(cert_info.hostname, conn->hostname,
                       APR_FNM_PERIOD) == APR_FNM_NOMATCH)
         {
           svn_failures |= SVN_AUTH_SSL_CNMISMATCH;
@@ -422,7 +428,7 @@ conn_setup(apr_socket_t *sock,
           conn->ssl_context = serf_bucket_ssl_encrypt_context_get(*read_bkt);
 
 #if SERF_VERSION_AT_LEAST(1,0,0)
-          serf_ssl_set_hostname(conn->ssl_context, conn->hostinfo);
+          serf_ssl_set_hostname(conn->ssl_context, conn->hostname);
 #endif
 
           serf_ssl_client_cert_provider_set(conn->ssl_context,
@@ -743,9 +749,8 @@ svn_ra_serf__context_run_wait(svn_boolea
 
       svn_pool_clear(iterpool);
 
-      if (sess->wc_callbacks &&
-          sess->wc_callbacks->cancel_func)
-        SVN_ERR((sess->wc_callbacks->cancel_func)(sess->wc_callback_baton));
+      if (sess->cancel_func)
+        SVN_ERR((*sess->cancel_func)(sess->cancel_baton));
 
       status = serf_context_run(sess->context, sess->timeout, iterpool);
 
@@ -816,7 +821,7 @@ start_error(svn_ra_serf__xml_parser_t *p
         }
       else
         {
-          ctx->error->apr_err = APR_EGENERAL;
+          ctx->error->apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED;
         }
 
       /* Start collecting cdata. */
@@ -1311,9 +1316,10 @@ add_done_item(svn_ra_serf__xml_parser_t 
 #ifdef PBTEST_ACTIVE
 
 /* Determine whether we should move to the next step. Print out the
-   transition for debugging purposes.  */
+   transition for debugging purposes. If FORCE is TRUE, then we
+   definitely make a step (injection has completed).  */
 static void
-maybe_next_step(svn_ra_serf__xml_parser_t *parser)
+maybe_next_step(svn_ra_serf__xml_parser_t *parser, svn_boolean_t force)
 {
   const pbtest_desc_t *desc;
   int state;
@@ -1323,10 +1329,15 @@ maybe_next_step(svn_ra_serf__xml_parser_
   if (pbtest_step == 14)
     return;
 
+  /* If this is not the request running the test, then exit.  */
+  if (!PBTEST_THIS_REQ(parser))
+    return;
+
   desc = &pbtest_description[pbtest_step];
   state = PBTEST_STATE(parser->pending);
 
-  if (desc->inject || state == desc->when_next || pbtest_step == 0)
+  /* Forced? ... or reached target state?  */
+  if (force || state == desc->when_next)
     {
       ++pbtest_step;
 
@@ -1337,8 +1348,8 @@ maybe_next_step(svn_ra_serf__xml_parser_
       ++desc;
       parser->paused = desc->paused;
 
-      SVN_DBG(("PBTEST: advanced: step=%d  paused=%d  inject=%d\n",
-               pbtest_step, desc->paused, desc->inject));
+      SVN_DBG(("PBTEST: advanced: step=%d  paused=%d  inject=%d  state=%d\n",
+               pbtest_step, desc->paused, desc->inject, state));
     }
   else
     {
@@ -1397,13 +1408,13 @@ write_to_pending(svn_ra_serf__xml_parser
 
      For testing purposes, there are points when we may want to
      create the spill file, regardless.  */
-  if (PBTEST_FORCE_SPILL()
+  if (PBTEST_FORCE_SPILL(ctx)
       || (ctx->pending->spill == NULL
           && ctx->pending->memory_size > SPILL_SIZE))
     {
 #ifdef PBTEST_ACTIVE
       /* Only allow a spill file for steps 6 or later.  */
-      if (pbtest_step >= 6)
+      if (!PBTEST_THIS_REQ(ctx) || pbtest_step >= 6)
 #endif
       SVN_ERR(svn_io_open_unique_file3(&ctx->pending->spill,
                                        NULL /* temp_path */,
@@ -1486,6 +1497,21 @@ inject_to_parser(svn_ra_serf__xml_parser
   return SVN_NO_ERROR;
 }
 
+/* Apr pool cleanup handler to release an XML_Parser in success and error
+   conditions */
+static apr_status_t
+xml_parser_cleanup(void *baton)
+{
+  XML_Parser *xmlp = baton;
+
+  if (*xmlp)
+    {
+      XML_ParserFree(*xmlp);
+      *xmlp = NULL;
+    }
+
+  return APR_SUCCESS;
+}
 
 svn_error_t *
 svn_ra_serf__process_pending(svn_ra_serf__xml_parser_t *parser,
@@ -1500,15 +1526,16 @@ svn_ra_serf__process_pending(svn_ra_serf
 
 #ifdef PBTEST_ACTIVE
   /* If this step should not inject content, then fast-path exit.  */
-  if (pbtest_step < 14 && !pbtest_description[pbtest_step].inject)
+  if (PBTEST_THIS_REQ(parser)
+      && pbtest_step < 14 && !pbtest_description[pbtest_step].inject)
     {
       SVN_DBG(("PBTEST: process: injection disabled\n"));
       return SVN_NO_ERROR;
     }
 #endif
 
-  /* Fast path exit: already paused, or nothing to do.  */
-  if (parser->paused || parser->pending == NULL)
+  /* Fast path exit: already paused, nothing to do, or already done.  */
+  if (parser->paused || parser->pending == NULL || *parser->done)
     return SVN_NO_ERROR;
 
   /* ### it is possible that the XML parsing of the pending content is
@@ -1548,9 +1575,10 @@ svn_ra_serf__process_pending(svn_ra_serf
   /* For steps 4 and 9, we wait until all of the memory content has been
      injected. At that point, we can take another step which will pause
      the parser, and we'll need to exit.  */
-  if (pbtest_step == 4 || pbtest_step == 9)
+  if (PBTEST_THIS_REQ(parser)
+      && (pbtest_step == 4 || pbtest_step == 9))
     {
-      PBTEST_MAYBE_STEP(parser);
+      PBTEST_MAYBE_STEP(parser, TRUE);
       return SVN_NO_ERROR;
     }
 #endif
@@ -1609,17 +1637,25 @@ svn_ra_serf__process_pending(svn_ra_serf
      the network, then we're completely done with the parsing.  */
   if (parser->pending->network_eof)
     {
+#ifdef PBTEST_ACTIVE
+      if (PBTEST_THIS_REQ(parser))
+        SVN_DBG(("process: terminating parse.\n"));
+#endif
+
+      SVN_ERR_ASSERT(parser->xmlp != NULL);
+
       /* Tell the parser that no more content will be parsed. Ignore the
          return status. We just don't care.  */
       (void) XML_Parse(parser->xmlp, NULL, 0, 1);
 
-      XML_ParserFree(parser->xmlp);
+      apr_pool_cleanup_run(parser->pool, &parser->xmlp, xml_parser_cleanup);
+      parser->xmlp = NULL;
       add_done_item(parser);
     }
 
   /* For testing step 12, we have written all of the disk content. This
      will advance to step 13 and pause the parser again.  */
-  PBTEST_MAYBE_STEP(parser);
+  PBTEST_MAYBE_STEP(parser, TRUE);
 
   return SVN_NO_ERROR;
 }
@@ -1669,9 +1705,27 @@ svn_ra_serf__handle_xml_parser(serf_requ
       return SVN_NO_ERROR;
     }
 
+  if (ctx->headers_baton == NULL)
+    ctx->headers_baton = serf_bucket_response_get_headers(response);
+  else if (ctx->headers_baton != serf_bucket_response_get_headers(response))
+    {
+      /* We got a new response to an existing parser...
+         This tells us the connection has restarted and we should continue
+         where we stopped last time.
+       */
+
+      /* Is this a second attempt?? */
+      if (!ctx->skip_size)
+        ctx->skip_size = ctx->read_size;
+
+      ctx->read_size = 0; /* New request, nothing read */
+    }
+
   if (!ctx->xmlp)
     {
       ctx->xmlp = XML_ParserCreate(NULL);
+      apr_pool_cleanup_register(ctx->pool, &ctx->xmlp, xml_parser_cleanup,
+                                apr_pool_cleanup_null);
       XML_SetUserData(ctx->xmlp, ctx);
       XML_SetElementHandler(ctx->xmlp, start_xml, end_xml);
       if (ctx->cdata)
@@ -1682,9 +1736,8 @@ svn_ra_serf__handle_xml_parser(serf_requ
       /* This is the first invocation. If we're looking at an update
          report, then move to step 1 of the testing sequence.  */
 #ifdef PBTEST_ACTIVE
-      if (ctx->response_type != NULL
-          && strcmp(ctx->response_type, "update-report") == 0)
-        PBTEST_MAYBE_STEP(ctx);
+      if (PBTEST_THIS_REQ(ctx))
+        PBTEST_MAYBE_STEP(ctx, TRUE);
 #endif
     }
 
@@ -1712,14 +1765,51 @@ svn_ra_serf__handle_xml_parser(serf_requ
           return svn_error_wrap_apr(status, NULL);
         }
 
+      ctx->read_size += len;
+
+      if (ctx->skip_size)
+        {
+          /* Handle restarted requests correctly: Skip what we already read */
+          apr_size_t skip;
+
+          if (ctx->skip_size >= ctx->read_size)
+            {
+            /* Eek.  What did the file shrink or something? */
+              if (APR_STATUS_IS_EOF(status))
+                {
+                  SVN_ERR_MALFUNCTION();
+                }
+
+              /* Skip on to the next iteration of this loop. */
+              if (APR_STATUS_IS_EAGAIN(status))
+                {
+                  return svn_error_wrap_apr(status, NULL);
+                }
+              continue;
+            }
+
+          skip = (apr_size_t)(len - (ctx->read_size - ctx->skip_size));
+          data += skip;
+          len -= skip;
+          ctx->skip_size = 0;
+        }
+
       /* Ensure that the parser's PAUSED state is correct before we test
          the flag.  */
       PBTEST_SET_PAUSED(ctx);
 
 #ifdef PBTEST_ACTIVE
-      SVN_DBG(("response: len=%d  paused=%d  status=%08x\n",
-               (int)len, ctx->paused, status));
-      SVN_DBG(("content=%s\n", data));
+      if (PBTEST_THIS_REQ(ctx))
+        {
+          SVN_DBG(("response: len=%d  paused=%d  status=%08x\n",
+                   (int)len, ctx->paused, status));
+#if 0
+          /* ### DATA is not necessarily NUL-terminated, but this
+             ### generally works. so if you want to see content... */
+          if (len > 0)
+            SVN_DBG(("content=%s\n", data));
+#endif
+        }
 #endif
 
       /* Note: once the callbacks invoked by inject_to_parser() sets the
@@ -1731,7 +1821,6 @@ svn_ra_serf__handle_xml_parser(serf_requ
          We want to save arriving content into the PENDING structures if
          the parser has been paused, or we already have data in there (so
          the arriving data is appended, rather than injected out of order)  */
-#ifdef PBTEST_ACTIVE
       if (ctx->paused || HAS_PENDING_DATA(ctx->pending))
         {
           err = write_to_pending(ctx, data, len, pool);
@@ -1741,10 +1830,9 @@ svn_ra_serf__handle_xml_parser(serf_requ
              Note: this only happens on writing to PENDING. If the
              parser is unpaused, then we will never change state within
              this network-reading loop.  */
-          PBTEST_MAYBE_STEP(ctx);
+          PBTEST_MAYBE_STEP(ctx, FALSE);
         }
       else
-#endif
         {
           err = inject_to_parser(ctx, data, len, &sl);
           if (err)
@@ -1755,7 +1843,9 @@ svn_ra_serf__handle_xml_parser(serf_requ
         }
       if (err)
         {
-          XML_ParserFree(ctx->xmlp);
+          SVN_ERR_ASSERT(ctx->xmlp != NULL);
+
+          apr_pool_cleanup_run(ctx->pool, &ctx->xmlp, xml_parser_cleanup);
           add_done_item(ctx);
           return svn_error_trace(err);
         }
@@ -1770,14 +1860,26 @@ svn_ra_serf__handle_xml_parser(serf_requ
           if (ctx->pending != NULL)
             ctx->pending->network_eof = TRUE;
 
+#ifdef PBTEST_ACTIVE
+          if (PBTEST_THIS_REQ(ctx))
+            SVN_DBG(("network: reached EOF.\n"));
+#endif
+
           /* We just hit the end of the network content. If we have nothing
              in the PENDING structures, then we're completely done.  */
           if (!HAS_PENDING_DATA(ctx->pending))
             {
+#ifdef PBTEST_ACTIVE
+              if (PBTEST_THIS_REQ(ctx))
+                SVN_DBG(("network: terminating parse.\n"));
+#endif
+
+              SVN_ERR_ASSERT(ctx->xmlp != NULL);
+
               /* Ignore the return status. We just don't care.  */
               (void) XML_Parse(ctx->xmlp, NULL, 0, 1);
 
-              XML_ParserFree(ctx->xmlp);
+              apr_pool_cleanup_run(ctx->pool, &ctx->xmlp, xml_parser_cleanup);
               add_done_item(ctx);
             }
 
@@ -1971,17 +2073,27 @@ handle_response(serf_request_t *request,
 
   ctx->conn->last_status_code = sl.code;
 
-  if (sl.code == 409 || sl.code >= 500)
+  if (sl.code == 405 || sl.code == 409 || sl.code >= 500)
     {
-      /* 409 Conflict: can indicate a hook error.
+      /* 405 Method Not allowed.
+         409 Conflict: can indicate a hook error.
          5xx (Internal) Server error. */
       SVN_ERR(svn_ra_serf__handle_server_error(request, response, pool));
 
       if (!ctx->session->pending_error)
         {
+          apr_status_t apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED;
+
+          /* 405 == Method Not Allowed (Occurs when trying to lock a working
+             copy path which no longer exists at HEAD in the repository. */
+
+          if (sl.code == 405 && !strcmp(ctx->method, "LOCK"))
+            apr_err = SVN_ERR_FS_OUT_OF_DATE;
+
           return
-              svn_error_createf(APR_EGENERAL, NULL,
-              _("Unspecified error message: %d %s"), sl.code, sl.reason);
+              svn_error_createf(apr_err, NULL,
+                                _("%s request on '%s' failed: %d %s"),
+                                ctx->method, ctx->path, sl.code, sl.reason);
         }
 
       return SVN_NO_ERROR; /* Error is set in caller */
@@ -2207,7 +2319,7 @@ svn_ra_serf__discover_vcc(const char **v
           if ((err->apr_err != SVN_ERR_FS_NOT_FOUND) &&
               (err->apr_err != SVN_ERR_RA_DAV_FORBIDDEN))
             {
-              return err;  /* found a _real_ error */
+              return svn_error_trace(err);  /* found a _real_ error */
             }
           else
             {

Modified: subversion/branches/svn-bisect/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_repos/commit.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_repos/commit.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_repos/commit.c Tue Aug 16 09:38:37 2011
@@ -94,6 +94,9 @@ struct edit_baton
   /* The object representing the root directory of the svn txn. */
   svn_fs_root_t *txn_root;
 
+  /* Avoid aborting an fs transaction more than once */
+  svn_boolean_t txn_aborted;
+
   /** Filled in when the edit is closed: **/
 
   /* The new revision created by this commit. */
@@ -718,12 +721,13 @@ close_edit(void *edit_baton,
          So, in a nutshell: svn commits are an all-or-nothing deal.
          Each commit creates a new fs txn which either succeeds or is
          aborted completely.  No second chances;  the user simply
-         needs to update and commit again  :)
+         needs to update and commit again  :) */
+
+      eb->txn_aborted = TRUE;
 
-         We ignore the possible error result from svn_fs_abort_txn();
-         it's more important to return the original error. */
-      svn_error_clear(svn_fs_abort_txn(eb->txn, pool));
-      return svn_error_trace(err);
+      return svn_error_trace(
+                svn_error_compose_create(err,
+                                         svn_fs_abort_txn(eb->txn, pool)));
     }
 
   /* Pass new revision information to the caller's callback. */
@@ -769,9 +773,12 @@ abort_edit(void *edit_baton,
            apr_pool_t *pool)
 {
   struct edit_baton *eb = edit_baton;
-  if ((! eb->txn) || (! eb->txn_owner))
+  if ((! eb->txn) || (! eb->txn_owner) || eb->txn_aborted)
     return SVN_NO_ERROR;
-  return svn_fs_abort_txn(eb->txn, pool);
+
+  eb->txn_aborted = TRUE;
+
+  return svn_error_trace(svn_fs_abort_txn(eb->txn, pool));
 }
 
 

Modified: subversion/branches/svn-bisect/subversion/libsvn_repos/hooks.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_repos/hooks.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_repos/hooks.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_repos/hooks.c Tue Aug 16 09:38:37 2011
@@ -202,7 +202,8 @@ run_hook_cmd(svn_string_t **result,
 
   if (err)
     {
-      err = svn_error_createf
+      /* CMD_PROC is not safe to use. Bail. */
+      return svn_error_createf
         (SVN_ERR_REPOS_HOOK_FAILURE, err, _("Failed to start '%s' hook"), cmd);
     }
   else
@@ -618,18 +619,9 @@ svn_repos__hooks_pre_lock(svn_repos_t *r
                            pool));
 
       if (token)
-        {
-          svn_error_t *err;
-          /* Convert hook output from native encoding to UTF-8. */
-          err = svn_utf_cstring_to_utf8(token, buf->data, pool);
-          if (err)
-            {
-              return svn_error_create(SVN_ERR_REPOS_HOOK_FAILURE, err,
-                                      _("Output of pre-lock hook could not be "
-                                        "translated from the native locale to "
-                                        "UTF-8."));
-            }
-        }
+        /* No validation here; the FS will take care of that. */
+        *token = buf->data;
+
     }
   else if (token)
     *token = "";

Modified: subversion/branches/svn-bisect/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_repos/log.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_repos/log.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_repos/log.c Tue Aug 16 09:38:37 2011
@@ -857,6 +857,9 @@ get_combined_mergeinfo_changes(svn_merge
                                     iterpool));
       mergeinfo = apr_hash_get(catalog, path, APR_HASH_KEY_STRING);
 
+      if (!prev_mergeinfo && !mergeinfo)
+        continue;
+
       /* Compare, constrast, and combine the results. */
       SVN_ERR(svn_mergeinfo_diff(&deleted, &added, prev_mergeinfo,
                                  mergeinfo, FALSE, iterpool));
@@ -1514,6 +1517,7 @@ static svn_error_t *
 do_logs(svn_fs_t *fs,
         const apr_array_header_t *paths,
         svn_mergeinfo_t log_target_history_as_mergeinfo,
+        svn_mergeinfo_t processed,
         apr_hash_t *nested_merges,
         svn_revnum_t hist_start,
         svn_revnum_t hist_end,
@@ -1568,6 +1572,7 @@ handle_merged_revisions(svn_revnum_t rev
                         svn_fs_t *fs,
                         svn_mergeinfo_t log_target_history_as_mergeinfo,
                         apr_hash_t *nested_merges,
+                        svn_mergeinfo_t processed,
                         svn_mergeinfo_t added_mergeinfo,
                         svn_mergeinfo_t deleted_mergeinfo,
                         svn_boolean_t discover_changed_paths,
@@ -1610,7 +1615,7 @@ handle_merged_revisions(svn_revnum_t rev
 
       svn_pool_clear(iterpool);
       SVN_ERR(do_logs(fs, pl_range->paths, log_target_history_as_mergeinfo,
-                      nested_merges,
+                      processed, nested_merges,
                       pl_range->range.start, pl_range->range.end, 0,
                       discover_changed_paths, strict_node_history,
                       TRUE, pl_range->reverse_merge, TRUE, TRUE,
@@ -1633,6 +1638,115 @@ struct added_deleted_mergeinfo
   svn_mergeinfo_t deleted_mergeinfo;
 };
 
+/* Reduce the search range PATHS, HIST_START, HIST_END by removing
+   parts already covered by PROCESSED.  If reduction is possible
+   elements may be removed from PATHS and *START_REDUCED and
+   *END_REDUCED may be set to a narrower range. */
+static svn_error_t *
+reduce_search(apr_array_header_t *paths,
+              svn_revnum_t *hist_start,
+              svn_revnum_t *hist_end,
+              svn_mergeinfo_t processed,
+              apr_pool_t *scratch_pool)
+{
+  /* We add 1 to end to compensate for store_search */
+  svn_revnum_t start = *hist_start <= *hist_end ? *hist_start : *hist_end;
+  svn_revnum_t end = *hist_start <= *hist_end ? *hist_end + 1 : *hist_start + 1;
+  int i;
+
+  for (i = 0; i < paths->nelts; ++i)
+    {
+      const char *path = APR_ARRAY_IDX(paths, i, const char *);
+      apr_array_header_t *ranges = apr_hash_get(processed, path,
+                                                APR_HASH_KEY_STRING);
+      int j;
+
+      if (!ranges)
+        continue;
+
+      /* ranges is ordered, could we use some sort of binay search
+         rather than iterating? */
+      for (j = 0; j < ranges->nelts; ++j)
+        {
+          svn_merge_range_t *range = APR_ARRAY_IDX(ranges, j,
+                                                   svn_merge_range_t *);
+          if (range->start <= start && range->end >= end)
+            {
+              for (j = i; j < paths->nelts - 1; ++j)
+                APR_ARRAY_IDX(paths, j, const char *)
+                  = APR_ARRAY_IDX(paths, j + 1, const char *);
+
+              --paths->nelts;
+              --i;
+              break;
+            }
+
+          /* If there is only one path then we also check for a
+             partial overlap rather than the full overlap above, and
+             reduce the [hist_start, hist_end] range rather than
+             dropping the path. */
+          if (paths->nelts == 1)
+            {
+              if (range->start <= start && range->end > start)
+                {
+                  if (start == *hist_start)
+                    *hist_start = range->end - 1;
+                  else
+                    *hist_end = range->end - 1;
+                  break;
+                }
+              if (range->start < end && range->end >= end)
+                {
+                  if (start == *hist_start)
+                    *hist_end = range->start;
+                  else
+                    *hist_start = range->start;
+                  break;
+                }
+            }
+        }
+    }
+
+  return SVN_NO_ERROR;
+}
+
+/* Extend PROCESSED to cover PATHS from HIST_START to HIST_END */
+static svn_error_t *
+store_search(svn_mergeinfo_t processed,
+             const apr_array_header_t *paths,
+             svn_revnum_t hist_start,
+             svn_revnum_t hist_end,
+             apr_pool_t *scratch_pool)
+{
+  /* We add 1 to end so that we can use the mergeinfo API to handle
+     singe revisions where HIST_START is equal to HIST_END. */
+  svn_revnum_t start = hist_start <= hist_end ? hist_start : hist_end;
+  svn_revnum_t end = hist_start <= hist_end ? hist_end + 1 : hist_start + 1;
+  svn_mergeinfo_t mergeinfo = apr_hash_make(scratch_pool);
+  apr_pool_t *processed_pool = apr_hash_pool_get(processed);
+  int i;
+
+  for (i = 0; i < paths->nelts; ++i)
+    {
+      const char *path = APR_ARRAY_IDX(paths, i, const char *);
+      apr_array_header_t *ranges = apr_array_make(processed_pool, 1,
+                                                  sizeof(svn_merge_range_t*));
+      svn_merge_range_t *range = apr_palloc(processed_pool,
+                                            sizeof(svn_merge_range_t));
+      
+      range->start = start;
+      range->end = end;
+      range->inheritable = TRUE;
+      APR_ARRAY_PUSH(ranges, svn_merge_range_t *) = range;
+      apr_hash_set(mergeinfo, apr_pstrdup(processed_pool, path),
+                   APR_HASH_KEY_STRING, ranges);
+    }
+  SVN_ERR(svn_mergeinfo_merge(processed, mergeinfo,
+                              apr_hash_pool_get(processed)));
+
+  return SVN_NO_ERROR;
+}
+
 /* Find logs for PATHS from HIST_START to HIST_END in FS, and invoke
    RECEIVER with RECEIVER_BATON on them.  If DESCENDING_ORDER is TRUE, send
    the logs back as we find them, else buffer the logs and send them back
@@ -1657,12 +1771,17 @@ struct added_deleted_mergeinfo
    do_logs()/send_logs()/handle_merge_revisions() recursions, see also the
    argument of the same name in send_logs().
 
+   PROCESSED is a mergeinfo hash that represents the paths and
+   revisions that have already been searched.  Allocated like
+   NESTED_MERGES above.
+
    All other parameters are the same as svn_repos_get_logs4().
  */
 static svn_error_t *
 do_logs(svn_fs_t *fs,
         const apr_array_header_t *paths,
         svn_mergeinfo_t log_target_history_as_mergeinfo,
+        svn_mergeinfo_t processed,
         apr_hash_t *nested_merges,
         svn_revnum_t hist_start,
         svn_revnum_t hist_end,
@@ -1691,6 +1810,20 @@ do_logs(svn_fs_t *fs,
   int send_count = 0;
   int i;
 
+  if (processed)
+    {
+      /* Casting away const. This only happens on recursive calls when
+         it is known to be safe because we allocated paths. */
+      SVN_ERR(reduce_search((apr_array_header_t *)paths, &hist_start, &hist_end,
+                            processed, pool));
+    }
+
+  if (!paths->nelts)
+    return SVN_NO_ERROR;
+
+  if (processed)
+    SVN_ERR(store_search(processed, paths, hist_start, hist_end, pool));
+
   /* We have a list of paths and a revision range.  But we don't care
      about all the revisions in the range -- only the ones in which
      one of our paths was changed.  So let's go figure out which
@@ -1779,11 +1912,13 @@ do_logs(svn_fs_t *fs,
                          recursions so we can track and squelch duplicates. */
                       subpool = svn_pool_create(pool);
                       nested_merges = apr_hash_make(subpool);
+                      processed = apr_hash_make(subpool);
                     }
 
                   SVN_ERR(handle_merged_revisions(
                     current, fs,
                     log_target_history_as_mergeinfo, nested_merges,
+                    processed,
                     added_mergeinfo, deleted_mergeinfo,
                     discover_changed_paths,
                     strict_node_history,
@@ -1882,6 +2017,7 @@ do_logs(svn_fs_t *fs,
               SVN_ERR(handle_merged_revisions(current, fs,
                                               log_target_history_as_mergeinfo,
                                               nested_merges,
+                                              processed,
                                               added_mergeinfo,
                                               deleted_mergeinfo,
                                               discover_changed_paths,
@@ -2092,7 +2228,7 @@ svn_repos_get_logs4(svn_repos_t *repos,
       svn_pool_destroy(subpool);
     }
 
-  return do_logs(repos->fs, paths, paths_history_mergeinfo, NULL, start, end,
+  return do_logs(repos->fs, paths, paths_history_mergeinfo, NULL, NULL, start, end,
                  limit, discover_changed_paths, strict_node_history,
                  include_merged_revisions, FALSE, FALSE, FALSE, revprops,
                  descending_order, receiver, receiver_baton,

Modified: subversion/branches/svn-bisect/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_repos/repos.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_repos/repos.c Tue Aug 16 09:38:37 2011
@@ -364,6 +364,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating start-commit hook"));
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   }  /* end start-commit hook */
 
   /* Pre-commit hook. */
@@ -454,6 +456,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating pre-commit hook"));
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   }  /* end pre-commit hook */
 
 
@@ -530,6 +534,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating pre-revprop-change hook"));
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   }  /* end pre-revprop-change hook */
 
 
@@ -620,6 +626,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               "Creating pre-lock hook");
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   }  /* end pre-lock hook */
 
 
@@ -702,6 +710,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               "Creating pre-unlock hook");
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   }  /* end pre-unlock hook */
 
 
@@ -762,6 +772,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating post-commit hook"));
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   } /* end post-commit hook */
 
 
@@ -823,6 +835,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               "Creating post-lock hook");
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   } /* end post-lock hook */
 
 
@@ -882,6 +896,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               "Creating post-unlock hook");
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   } /* end post-unlock hook */
 
 
@@ -948,6 +964,8 @@ PREWRITTEN_HOOKS_TEXT
 
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating post-revprop-change hook"));
+
+    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
   } /* end post-revprop-change hook */
 
   return SVN_NO_ERROR;

Propchange: subversion/branches/svn-bisect/subversion/libsvn_subr/adler32.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 16 09:38:37 2011
@@ -2,4 +2,4 @@
 /subversion/branches/diff-optimizations-bytes/subversion/libsvn_subr/adler32.c:1037353-1067789
 /subversion/branches/performance/subversion/libsvn_subr/adler32.c:1067697-1078365
 /subversion/branches/revprop-packing/subversion/libsvn_subr/adler32.c:1143907,1143971,1144017,1144568,1146145
-/subversion/trunk/subversion/libsvn_subr/adler32.c:1140046-1148712
+/subversion/trunk/subversion/libsvn_subr/adler32.c:1140046-1158163

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/auth.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/auth.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/auth.c Tue Aug 16 09:38:37 2011
@@ -382,11 +382,10 @@ svn_auth_ssl_server_cert_info_dup
 }
 
 svn_error_t *
-svn_auth_get_platform_specific_provider
-  (svn_auth_provider_object_t **provider,
-   const char *provider_name,
-   const char *provider_type,
-   apr_pool_t *pool)
+svn_auth_get_platform_specific_provider(svn_auth_provider_object_t **provider,
+                                        const char *provider_name,
+                                        const char *provider_type,
+                                        apr_pool_t *pool)
 {
   *provider = NULL;
 
@@ -447,6 +446,13 @@ svn_auth_get_platform_specific_provider
     }
   else
     {
+#if defined(SVN_HAVE_GPG_AGENT)
+      if (strcmp(provider_name, "gpg_agent") == 0 &&
+          strcmp(provider_type, "simple") == 0)
+        {
+          svn_auth_get_gpg_agent_simple_provider(provider, pool);
+        }
+#endif
 #ifdef SVN_HAVE_KEYCHAIN_SERVICES
       if (strcmp(provider_name, "keychain") == 0 &&
           strcmp(provider_type, "simple") == 0)
@@ -483,27 +489,30 @@ svn_auth_get_platform_specific_provider
 }
 
 svn_error_t *
-svn_auth_get_platform_specific_client_providers
-  (apr_array_header_t **providers,
-   svn_config_t *config,
-   apr_pool_t *pool)
+svn_auth_get_platform_specific_client_providers(apr_array_header_t **providers,
+                                                svn_config_t *config,
+                                                apr_pool_t *pool)
 {
   svn_auth_provider_object_t *provider;
   const char *password_stores_config_option;
   apr_array_header_t *password_stores;
   int i;
 
+#define SVN__DEFAULT_AUTH_PROVIDER_LIST \
+         "gnome-keyring,kwallet,keychain,gpg-agent,windows-cryptoapi"
+
   if (config)
     {
-      svn_config_get(config,
-                     &password_stores_config_option,
-                     SVN_CONFIG_SECTION_AUTH,
-                     SVN_CONFIG_OPTION_PASSWORD_STORES,
-                     "gnome-keyring,kwallet,keychain,windows-cryptoapi");
+      svn_config_get
+        (config,
+         &password_stores_config_option,
+         SVN_CONFIG_SECTION_AUTH,
+         SVN_CONFIG_OPTION_PASSWORD_STORES,
+         SVN__DEFAULT_AUTH_PROVIDER_LIST);
     }
   else
     {
-      password_stores_config_option = "gnome-keyring,kwallet,keychain,windows-cryptoapi";
+      password_stores_config_option = SVN__DEFAULT_AUTH_PROVIDER_LIST;
     }
 
   *providers = apr_array_make(pool, 12, sizeof(svn_auth_provider_object_t *));
@@ -539,6 +548,20 @@ svn_auth_get_platform_specific_client_pr
           continue;
         }
 
+      /* GPG-AGENT */
+      if (apr_strnatcmp(password_store, "gpg-agent") == 0)
+        {
+          SVN_ERR(svn_auth_get_platform_specific_provider(&provider,
+                                                          "gpg_agent",
+                                                          "simple",
+                                                          pool));
+
+          if (provider)
+            APR_ARRAY_PUSH(*providers, svn_auth_provider_object_t *) = provider;
+
+          continue;
+        }
+
       /* KWallet */
       if (apr_strnatcmp(password_store, "kwallet") == 0)
         {

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/cmdline.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/cmdline.c Tue Aug 16 09:38:37 2011
@@ -459,8 +459,8 @@ svn_cmdline_create_auth_baton(svn_auth_b
   apr_array_header_t *providers;
 
   /* Populate the registered providers with the platform-specific providers */
-  SVN_ERR(svn_auth_get_platform_specific_client_providers
-            (&providers, cfg, pool));
+  SVN_ERR(svn_auth_get_platform_specific_client_providers(&providers,
+                                                          cfg, pool));
 
   /* If we have a cancellation function, cram it and the stuff it
      needs into the prompt baton. */

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/config_file.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/config_file.c Tue Aug 16 09:38:37 2011
@@ -954,6 +954,7 @@ svn_config_ensure(const char *config_dir
         "### Valid password stores:"                                         NL
         "###   gnome-keyring        (Unix-like systems)"                     NL
         "###   kwallet              (Unix-like systems)"                     NL
+        "###   gpg-agent            (Unix-like systems)"                     NL
         "###   keychain             (Mac OS X)"                              NL
         "###   windows-cryptoapi    (Windows)"                               NL
 #ifdef SVN_HAVE_KEYCHAIN_SERVICES
@@ -961,7 +962,7 @@ svn_config_ensure(const char *config_dir
 #elif defined(WIN32) && !defined(__MINGW32__)
         "# password-stores = windows-cryptoapi"                              NL
 #else
-        "# password-stores = gnome-keyring,kwallet"                          NL
+        "# password-stores = gpg-agent,gnome-keyring,kwallet"                NL
 #endif
         "### To disable all password stores, use an empty list:"             NL
         "# password-stores ="                                                NL

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/deprecated.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/deprecated.c Tue Aug 16 09:38:37 2011
@@ -1126,3 +1126,12 @@ svn_xml_make_header(svn_stringbuf_t **st
 {
   svn_xml_make_header2(str, NULL, pool);
 }
+
+svn_error_t *
+svn_rangelist_merge(apr_array_header_t **rangelist,
+                    const apr_array_header_t *changes,
+                    apr_pool_t *pool)
+{
+  return svn_error_trace(svn_rangelist_merge2(*rangelist, changes,
+                                              pool, pool));
+}

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/dso.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/dso.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/dso.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/dso.c Tue Aug 16 09:38:37 2011
@@ -105,9 +105,12 @@ svn_dso_load(apr_dso_handle_t **dso, con
       status = apr_dso_load(dso, fname, dso_pool);
       if (status)
         {
-#if 0
+#ifdef SVN_DEBUG_DSO
           char buf[1024];
-          fprintf(stderr, "%s\n", apr_dso_error(*dso, buf, 1024));
+          fprintf(stderr,
+                  "Dynamic loading of '%s' failed with the following error:\n%s\n",
+                  fname,
+                  apr_dso_error(*dso, buf, 1024));
 #endif
           *dso = NULL;
 

Propchange: subversion/branches/svn-bisect/subversion/libsvn_subr/hash.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 16 09:38:37 2011
@@ -53,4 +53,4 @@
 /subversion/branches/tree-conflicts/subversion/libsvn_subr/hash.c:868291-873154
 /subversion/branches/tree-conflicts-notify/subversion/libsvn_subr/hash.c:873926-874008
 /subversion/branches/uris-as-urls/subversion/libsvn_subr/hash.c:1060426-1064427
-/subversion/trunk/subversion/libsvn_subr/hash.c:1140046-1148712
+/subversion/trunk/subversion/libsvn_subr/hash.c:1140046-1158163

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/io.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/io.c Tue Aug 16 09:38:37 2011
@@ -2118,12 +2118,6 @@ svn_io_remove_file2(const char *path,
   apr_status_t apr_err;
   const char *path_apr;
 
-#if defined(WIN32) || defined(__OS2__)
-  /* Set the file writable but only on Windows & OS/2, because Windows and OS/2
-     will not allow us to remove files that are read-only. */
-  SVN_ERR(svn_io_set_file_read_write(path, TRUE, scratch_pool));
-#endif /* WIN32 */
-
   SVN_ERR(cstring_from_utf8(&path_apr, path, scratch_pool));
 
   apr_err = apr_file_remove(path_apr, scratch_pool);
@@ -2132,6 +2126,19 @@ svn_io_remove_file2(const char *path,
     return SVN_NO_ERROR;
 
 #ifdef WIN32
+  /* If the target is read only NTFS reports EACCESS and FAT/FAT32
+     reports EEXIST */
+  if (APR_STATUS_IS_EACCES(apr_err) || APR_STATUS_IS_EEXIST(apr_err))
+    {
+      /* Set the destination file writable because Windows will not
+         allow us to delete when path is read-only */
+      SVN_ERR(svn_io_set_file_read_write(path, ignore_enoent, scratch_pool));
+      apr_err = apr_file_remove(path_apr, scratch_pool);
+
+      if (!apr_err)
+        return SVN_NO_ERROR;
+    }
+
     {
       apr_status_t os_err = APR_TO_OS_ERROR(apr_err);
       /* Check to make sure we aren't trying to delete a directory */
@@ -2489,10 +2496,17 @@ svn_io_start_cmd2(apr_proc_t *cmd_proc,
 
   /* Forward request for pipes to APR. */
   if (infile_pipe || outfile_pipe || errfile_pipe)
-    apr_procattr_io_set(cmdproc_attr,
-                        infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
-                        outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
-                        errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
+    {
+      apr_err = apr_procattr_io_set(cmdproc_attr,
+                                    infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
+                                    outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
+                                    errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
+
+      if (apr_err)
+        return svn_error_wrap_apr(apr_err,
+                                  _("Can't set process '%s' stdio pipes"),
+                                  cmd);
+    }
 
   /* Have the child print any problems executing its program to errfile. */
   apr_err = apr_pool_userdata_set(errfile, ERRFILE_KEY, NULL, pool);

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/mergeinfo.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/mergeinfo.c Tue Aug 16 09:38:37 2011
@@ -37,6 +37,7 @@
 #include "private/svn_string_private.h"
 #include "svn_private_config.h"
 #include "svn_hash.h"
+#include "private/svn_dep_compat.h"
 
 /* Attempt to combine two ranges, IN1 and IN2. If they are adjacent or
    overlapping, and their inheritability allows them to be combined, put
@@ -671,7 +672,7 @@ parse_revision_line(const char **input, 
      absolute path key. */
   existing_rangelist = apr_hash_get(hash, pathname->data, APR_HASH_KEY_STRING);
   if (existing_rangelist)
-    SVN_ERR(svn_rangelist_merge(&rangelist, existing_rangelist, pool));
+    SVN_ERR(svn_rangelist_merge2(rangelist, existing_rangelist, pool, pool));
 
   apr_hash_set(hash, pathname->data, APR_HASH_KEY_STRING, rangelist);
 
@@ -707,23 +708,26 @@ svn_mergeinfo_parse(svn_mergeinfo_t *mer
   return err;
 }
 
-
 svn_error_t *
-svn_rangelist_merge(apr_array_header_t **rangelist,
-                    const apr_array_header_t *changes,
-                    apr_pool_t *pool)
+svn_rangelist_merge2(apr_array_header_t *rangelist,
+                     const apr_array_header_t *changes,
+                     apr_pool_t *result_pool,
+                     apr_pool_t *scratch_pool)
 {
   int i, j;
-  apr_array_header_t *output = apr_array_make(pool, 1,
-                                              sizeof(svn_merge_range_t *));
+  apr_array_header_t *original_rangelist;
+  
+  original_rangelist = apr_array_copy(scratch_pool, rangelist);
+  apr_array_clear(rangelist);
+
   i = 0;
   j = 0;
-  while (i < (*rangelist)->nelts && j < changes->nelts)
+  while (i < (original_rangelist)->nelts && j < changes->nelts)
     {
       svn_merge_range_t *elt1, *elt2;
       int res;
 
-      elt1 = APR_ARRAY_IDX(*rangelist, i, svn_merge_range_t *);
+      elt1 = APR_ARRAY_IDX(original_rangelist, i, svn_merge_range_t *);
       elt2 = APR_ARRAY_IDX(changes, j, svn_merge_range_t *);
 
       res = svn_sort_compare_ranges(&elt1, &elt2);
@@ -734,46 +738,45 @@ svn_rangelist_merge(apr_array_header_t *
              result. */
           if (elt1->inheritable || elt2->inheritable)
             elt1->inheritable = TRUE;
-          SVN_ERR(combine_with_lastrange(elt1, output,
-                                         TRUE, pool, pool));
+          SVN_ERR(combine_with_lastrange(elt1, rangelist, TRUE, result_pool,
+                                         scratch_pool));
           i++;
           j++;
         }
       else if (res < 0)
         {
-          SVN_ERR(combine_with_lastrange(elt1, output,
-                                         TRUE, pool, pool));
+          SVN_ERR(combine_with_lastrange(elt1, rangelist, TRUE, result_pool,
+                                         scratch_pool));
           i++;
         }
       else
         {
-          SVN_ERR(combine_with_lastrange(elt2, output,
-                                         TRUE, pool, pool));
+          SVN_ERR(combine_with_lastrange(elt2, rangelist, TRUE, result_pool,
+                                         scratch_pool));
           j++;
         }
     }
   /* Copy back any remaining elements.
      Only one of these loops should end up running, if anything. */
 
-  SVN_ERR_ASSERT(!(i < (*rangelist)->nelts && j < changes->nelts));
+  SVN_ERR_ASSERT(!(i < (original_rangelist)->nelts && j < changes->nelts));
 
-  for (; i < (*rangelist)->nelts; i++)
+  for (; i < (original_rangelist)->nelts; i++)
     {
-      svn_merge_range_t *elt = APR_ARRAY_IDX(*rangelist, i,
+      svn_merge_range_t *elt = APR_ARRAY_IDX(original_rangelist, i,
                                              svn_merge_range_t *);
-      SVN_ERR(combine_with_lastrange(elt, output,
-                                     TRUE, pool, pool));
+      SVN_ERR(combine_with_lastrange(elt, rangelist, TRUE, result_pool,
+                                     scratch_pool));
     }
 
 
   for (; j < changes->nelts; j++)
     {
       svn_merge_range_t *elt = APR_ARRAY_IDX(changes, j, svn_merge_range_t *);
-      SVN_ERR(combine_with_lastrange(elt, output,
-                                     TRUE, pool, pool));
+      SVN_ERR(combine_with_lastrange(elt, rangelist,
+                                     TRUE, result_pool, scratch_pool));
     }
 
-  *rangelist = output;
   return SVN_NO_ERROR;
 }
 
@@ -1297,6 +1300,7 @@ svn_mergeinfo_merge(svn_mergeinfo_t merg
 {
   apr_array_header_t *sorted1, *sorted2;
   int i, j;
+  apr_pool_t *iterpool;
 
   if (!apr_hash_count(changes))
     return SVN_NO_ERROR;
@@ -1306,11 +1310,14 @@ svn_mergeinfo_merge(svn_mergeinfo_t merg
 
   i = 0;
   j = 0;
+  iterpool = svn_pool_create(pool);
   while (i < sorted1->nelts && j < sorted2->nelts)
     {
       svn_sort__item_t elt1, elt2;
       int res;
 
+      svn_pool_clear(iterpool);
+
       elt1 = APR_ARRAY_IDX(sorted1, i, svn_sort__item_t);
       elt2 = APR_ARRAY_IDX(sorted2, j, svn_sort__item_t);
       res = svn_sort_compare_items_as_paths(&elt1, &elt2);
@@ -1322,8 +1329,7 @@ svn_mergeinfo_merge(svn_mergeinfo_t merg
           rl1 = elt1.value;
           rl2 = elt2.value;
 
-          SVN_ERR(svn_rangelist_merge(&rl1, rl2,
-                                      pool));
+          SVN_ERR(svn_rangelist_merge2(rl1, rl2, pool, iterpool));
           apr_hash_set(mergeinfo, elt1.key, elt1.klen, rl1);
           i++;
           j++;
@@ -1338,6 +1344,7 @@ svn_mergeinfo_merge(svn_mergeinfo_t merg
           j++;
         }
     }
+  svn_pool_destroy(iterpool);
 
   /* Copy back any remaining elements from the second hash. */
   for (; j < sorted2->nelts; j++)

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/simple_providers.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/simple_providers.c Tue Aug 16 09:38:37 2011
@@ -358,7 +358,8 @@ svn_auth__simple_save_creds_helper(svn_b
            (strcmp(passtype, SVN_AUTH__WINCRYPT_PASSWORD_TYPE) == 0
             || strcmp(passtype, SVN_AUTH__KEYCHAIN_PASSWORD_TYPE) == 0
             || strcmp(passtype, SVN_AUTH__KWALLET_PASSWORD_TYPE) == 0
-            || strcmp(passtype, SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE) == 0) )
+            || strcmp(passtype, SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE) == 0
+            || strcmp(passtype, SVN_AUTH__GPG_AGENT_PASSWORD_TYPE) == 0))
         {
           may_save_password = TRUE;
         }

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/subst.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/subst.c Tue Aug 16 09:38:37 2011
@@ -1267,15 +1267,16 @@ static svn_error_t *
 translated_stream_close(void *baton)
 {
   struct translated_stream_baton *b = baton;
+  svn_error_t *err = NULL;
 
   if (b->written)
-    SVN_ERR(translate_chunk(b->stream, b->out_baton, NULL, 0, b->iterpool));
+    err = translate_chunk(b->stream, b->out_baton, NULL, 0, b->iterpool);
 
-  SVN_ERR(svn_stream_close(b->stream));
+  err = svn_error_compose_create(err, svn_stream_close(b->stream));
 
   svn_pool_destroy(b->iterpool);
 
-  return SVN_NO_ERROR;
+  return svn_error_trace(err);
 }
 
 

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/svn_cache_config.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/svn_cache_config.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/svn_cache_config.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/svn_cache_config.c Tue Aug 16 09:38:37 2011
@@ -113,6 +113,7 @@ svn_cache__get_global_membuffer_cache(vo
       apr_pool_create_ex(&pool, NULL, NULL, allocator);
       if (pool == NULL)
         return NULL;
+      apr_allocator_owner_set(allocator, pool);
 
       err = svn_cache__membuffer_cache_create(
           &new_cache,

Modified: subversion/branches/svn-bisect/subversion/libsvn_subr/svn_string.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_subr/svn_string.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_subr/svn_string.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_subr/svn_string.c Tue Aug 16 09:38:37 2011
@@ -839,3 +839,16 @@ svn_cstring_atoi(int *n, const char *str
   *n = (int)val;
   return SVN_NO_ERROR;
 }
+
+
+apr_status_t
+svn__strtoff(apr_off_t *offset, const char *buf, char **end, int base)
+{
+#if !APR_VERSION_AT_LEAST(1,0,0)
+  errno = 0;
+  *offset = strtol(buf, end, base);
+  return APR_FROM_OS_ERROR(errno);
+#else
+  return apr_strtoff(offset, buf, end, base);
+#endif
+}

Propchange: subversion/branches/svn-bisect/subversion/libsvn_subr/svn_temp_serializer.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 16 09:38:37 2011
@@ -1,2 +1,2 @@
 /subversion/branches/revprop-packing/subversion/libsvn_subr/svn_temp_serializer.c:1143907,1143971,1144017,1144568,1146145
-/subversion/trunk/subversion/libsvn_subr/svn_temp_serializer.c:1067687-1072301,1140046-1148712
+/subversion/trunk/subversion/libsvn_subr/svn_temp_serializer.c:1067687-1072301,1140046-1158163

Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/adm_crawler.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/adm_crawler.c Tue Aug 16 09:38:37 2011
@@ -124,9 +124,9 @@ svn_wc_restore(svn_wc_context_t *wc_ctx,
 
   if (status == svn_wc__db_status_added)
     SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL, NULL,
-                                         NULL, NULL, NULL,
-                                         wc_ctx->db, local_abspath,
-                                         scratch_pool, scratch_pool));
+                                     NULL, NULL, NULL, NULL, NULL,
+                                     wc_ctx->db, local_abspath,
+                                     scratch_pool, scratch_pool));
 
   if (status != svn_wc__db_status_normal
       && status != svn_wc__db_status_copied
@@ -385,7 +385,7 @@ report_revisions_and_depths(svn_wc__db_t
           if (wrk_status == svn_wc__db_status_added)
             SVN_ERR(svn_wc__db_scan_addition(&wrk_status, NULL, NULL, NULL,
                                              NULL, NULL, NULL, NULL, NULL,
-                                             db, this_abspath,
+                                             NULL, NULL, db, this_abspath,
                                              iterpool, iterpool));
 
           if (wrk_status == svn_wc__db_status_normal
@@ -736,7 +736,7 @@ svn_wc_crawl_revisions5(svn_wc_context_t
 
       if (wrk_status == svn_wc__db_status_added)
         SVN_ERR(svn_wc__db_scan_addition(&wrk_status, NULL, NULL, NULL, NULL,
-                                         NULL, NULL, NULL, NULL,
+                                         NULL, NULL, NULL, NULL, NULL, NULL,
                                          db, local_abspath,
                                          scratch_pool, scratch_pool));
 
@@ -1112,21 +1112,12 @@ svn_wc__internal_transmit_text_deltas(co
                         NULL, NULL,
                         scratch_pool, scratch_pool);
 
-  /* Close the two streams to force writing the digest,
-     if we already have an error, ignore this one. */
-  if (err)
-    {
-      svn_error_clear(svn_stream_close(base_stream));
-      svn_error_clear(svn_stream_close(local_stream));
-    }
-  else
-    {
-      SVN_ERR(svn_stream_close(base_stream));
-      SVN_ERR(svn_stream_close(local_stream));
-    }
+  /* Close the two streams to force writing the digest */
+  err = svn_error_compose_create(err, svn_stream_close(base_stream));
+  err = svn_error_compose_create(err, svn_stream_close(local_stream));
 
-  /* If we have an error, it may be caused by a corrupt text base.
-     Check the checksum and discard `err' if they don't match. */
+  /* If we have an error, it may be caused by a corrupt text base,
+     so check the checksum. */
   if (expected_md5_checksum && verify_checksum
       && !svn_checksum_match(expected_md5_checksum, verify_checksum))
     {
@@ -1142,19 +1133,20 @@ svn_wc__internal_transmit_text_deltas(co
          investigate.  Other commands could be affected,
          too, such as `svn diff'.  */
 
-      /* Deliberately ignore errors; the error about the
-         checksum mismatch is more important to return. */
-      svn_error_clear(err);
       if (tempfile)
-        svn_error_clear(svn_io_remove_file2(*tempfile, TRUE, scratch_pool));
+        err = svn_error_compose_create(
+                      err,
+                      svn_io_remove_file2(*tempfile, TRUE, scratch_pool));
 
-      return svn_error_create(SVN_ERR_WC_CORRUPT_TEXT_BASE,
-            svn_checksum_mismatch_err(expected_md5_checksum, verify_checksum,
+      err = svn_error_compose_create(
+              svn_checksum_mismatch_err(expected_md5_checksum, verify_checksum,
                             scratch_pool,
                             _("Checksum mismatch for text base of '%s'"),
                             svn_dirent_local_style(local_abspath,
                                                    scratch_pool)),
-            NULL);
+              err);
+
+      return svn_error_create(SVN_ERR_WC_CORRUPT_TEXT_BASE, err, NULL);
     }
 
   /* Now, handle that delta transmission error if any, so we can stop

Modified: subversion/branches/svn-bisect/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-bisect/subversion/libsvn_wc/adm_files.c?rev=1158171&r1=1158170&r2=1158171&view=diff
==============================================================================
--- subversion/branches/svn-bisect/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/branches/svn-bisect/subversion/libsvn_wc/adm_files.c Tue Aug 16 09:38:37 2011
@@ -484,8 +484,8 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
                                              &db_repos_relpath,
                                              &db_repos_root_url,
                                              &db_repos_uuid,
-                                             NULL, NULL, NULL, NULL,
-                                             db, local_abspath,
+                                             NULL, NULL, NULL, NULL, NULL,
+                                             NULL, db, local_abspath,
                                              scratch_pool, scratch_pool));
           else
             SVN_ERR(svn_wc__db_scan_base_repos(&db_repos_relpath,