subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r931581 - in /subversion/trunk/subversion: libsvn_ra/ra_loader.c libsvn_ra_neon/mergeinfo.c libsvn_ra_serf/mergeinfo.c libsvn_ra_svn/client.c
Date Wed, 07 Apr 2010 15:10:14 GMT
Author: cmpilato
Date: Wed Apr  7 15:10:13 2010
New Revision: 931581

URL: http://svn.apache.org/viewvc?rev=931581&view=rev
Log:
Move RA compatibility clean-up code out of the loader and down into
the providers that need it.

* subversion/libsvn_ra_svn/client.c
  (ra_svn_get_mergeinfo): Remove leading slashes from catalog keys.

* subversion/libsvn_ra_neon/mergeinfo.c
  (end_element): Remove leading slashes from catalog keys.

* subversion/libsvn_ra_serf/mergeinfo.c
  (end_element): Remove leading slashes from catalog keys.

* subversion/libsvn_ra/ra_loader.c
  (svn_ra_get_mergeinfo): Remove catalog patch-up code.

Suggested by: rhuijben

Modified:
    subversion/trunk/subversion/libsvn_ra/ra_loader.c
    subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c
    subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c
    subversion/trunk/subversion/libsvn_ra_svn/client.c

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.c?rev=931581&r1=931580&r2=931581&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.c Wed Apr  7 15:10:13 2010
@@ -689,8 +689,6 @@ svn_error_t *svn_ra_get_mergeinfo(svn_ra
 {
   svn_error_t *err;
   int i;
-  apr_hash_index_t *hi;
-  svn_mergeinfo_catalog_t tmp_catalog;
 
   /* Validate path format. */
   for (i = 0; i < paths->nelts; i++)
@@ -707,41 +705,9 @@ svn_error_t *svn_ra_get_mergeinfo(svn_ra
       return err;
     }
 
-  SVN_ERR(session->vtable->get_mergeinfo(session, &tmp_catalog, paths,
-                                         revision, inherit,
-                                         include_descendants, pool));
-  
-  if (tmp_catalog == NULL)
-    {
-      *catalog = NULL;
-      return SVN_NO_ERROR;
-    }
-
-  /* Even though CATALOG's keys are relative to the session URL, some
-     older servers returned some of those keys with leading slashes
-     (for subtree items, when INCLUDE_DESCENDANTS was set).  This code
-     cleans up that mess.  */
-  *catalog = apr_hash_make(pool);
-  for (hi = apr_hash_first(pool, tmp_catalog); hi; hi = apr_hash_next(hi))
-    {
-      const void *key;
-      apr_ssize_t klen;
-      void *val;
-      const char *path;
-
-      apr_hash_this(hi, &key, &klen, &val);
-      path = key;
-      if (path[0] == '/')
-        {
-          apr_hash_set(*catalog, path + 1, klen - 1, val);
-        }
-      else
-        {
-          apr_hash_set(*catalog, path, klen, val);
-        }
-    }
-
-  return SVN_NO_ERROR;
+  return session->vtable->get_mergeinfo(session, catalog, paths,
+                                        revision, inherit,
+                                        include_descendants, pool);
 }
 
 svn_error_t *svn_ra_do_update2(svn_ra_session_t *session,

Modified: subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c?rev=931581&r1=931580&r2=931581&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/mergeinfo.c Wed Apr  7 15:10:13 2010
@@ -116,12 +116,16 @@ end_element(void *baton, int state, cons
       if (mb->curr_info && mb->curr_path)
         {
           svn_mergeinfo_t path_mergeinfo;
+          const char *path;
 
           SVN_ERR_ASSERT(mb->curr_path->data);
+          path = apr_pstrdup(mb->pool, mb->curr_path->data);
           SVN_ERR((mb->err = svn_mergeinfo_parse(&path_mergeinfo,
                                                  mb->curr_info->data,
                                                  mb->pool)));
-          apr_hash_set(mb->catalog, apr_pstrdup(mb->pool, mb->curr_path->data),
+          /* Correct for naughty servers that send "relative" paths
+             with leading slashes! */
+          apr_hash_set(mb->catalog, path[0] == '/' ? path + 1 : path,
                        APR_HASH_KEY_STRING, path_mergeinfo);
         }
     }

Modified: subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c?rev=931581&r1=931580&r2=931581&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/mergeinfo.c Wed Apr  7 15:10:13 2010
@@ -119,14 +119,18 @@ end_element(svn_ra_serf__xml_parser_t *p
       if (mergeinfo_ctx->curr_info && mergeinfo_ctx->curr_path)
         {
           svn_mergeinfo_t path_mergeinfo;
+          const char *path;
 
           SVN_ERR_ASSERT(mergeinfo_ctx->curr_path->data);
+          path = apr_pstrdup(mergeinfo_ctx->pool,
+                             mergeinfo_ctx->curr_path->data);
           SVN_ERR(svn_mergeinfo_parse(&path_mergeinfo,
                                       mergeinfo_ctx->curr_info->data,
                                       mergeinfo_ctx->pool));
+          /* Correct for naughty servers that send "relative" paths
+             with leading slashes! */
           apr_hash_set(mergeinfo_ctx->result_catalog,
-                       apr_pstrdup(mergeinfo_ctx->pool,
-                                   mergeinfo_ctx->curr_path->data),
+                       path[0] == '/' ? path + 1 : path,
                        APR_HASH_KEY_STRING, path_mergeinfo);
         }
       svn_ra_serf__xml_pop_state(parser);

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=931581&r1=931580&r2=931581&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Wed Apr  7 15:10:13 2010
@@ -1156,7 +1156,10 @@ static svn_error_t *ra_svn_get_mergeinfo
           SVN_ERR(svn_ra_svn_parse_tuple(elt->u.list, pool, "cc",
                                          &path, &to_parse));
           SVN_ERR(svn_mergeinfo_parse(&for_path, to_parse, pool));
-          apr_hash_set(*catalog, path, APR_HASH_KEY_STRING, for_path);
+          /* Correct for naughty servers that send "relative" paths
+             with leading slashes! */
+          apr_hash_set(*catalog, path[0] == '/' ? path + 1 : path,
+                       APR_HASH_KEY_STRING, for_path);
         }
     }
 



Mime
View raw message