Author: cmpilato
Date: Fri Jun 25 20:55:20 2010
New Revision: 958113

URL: http://svn.apache.org/viewvc?rev=958113&view=rev
Log:
Duplicate a utility function in a couple of places to prevent library
dependency cycles.

* subversion/libsvn_ra_svn/client.c
  (path_relative_to_root): New, copied (with mods) from
    svn_ra_get_path_relative_to_root().
  (ra_svn_get_locks): Use path_relative_to_root() instead of
    svn_ra_get_path_relative_to_root().

* subversion/libsvn_ra_neon/ra_neon.h,
* subversion/libsvn_ra_neon/session.c
  (svn_ra_neon__get_path_relative_to_root): New, copied (with mods) from
    svn_ra_get_path_relative_to_root().

* subversion/libsvn_ra_neon/get_locks.c
  (svn_ra_neon__get_locks): Use path_relative_to_root() instead of
    svn_ra_get_path_relative_to_root().

* build.conf
  (svnserve): Lose now-unnecessary dependency on libsvn_ra.


Modified:
    subversion/trunk/build.conf
    subversion/trunk/subversion/libsvn_ra_neon/get_locks.c
    subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
    subversion/trunk/subversion/libsvn_ra_neon/session.c
    subversion/trunk/subversion/libsvn_ra_svn/client.c

Modified: subversion/trunk/build.conf
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=958113&r1=958112&r2=958113&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Fri Jun 25 20:55:20 2010
@@ -147,7 +147,7 @@ type = exe
 path = subversion/svnserve
 install = bin
 manpages = subversion/svnserve/svnserve.8 subversion/svnserve/svnserve.conf.5
-libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr libsvn_ra libsvn_ra_svn
+libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr libsvn_ra_svn
        apriconv apr sasl
 msvc-libs = advapi32.lib ws2_32.lib
 

Modified: subversion/trunk/subversion/libsvn_ra_neon/get_locks.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/get_locks.c?rev=958113&r1=958112&r2=958113&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/get_locks.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/get_locks.c Fri Jun 25 20:55:20 
2010
@@ -357,7 +357,6 @@ getlocks_end_element(void *userdata, int
 }
 
 
-
 svn_error_t *
 svn_ra_neon__get_locks(svn_ra_session_t *session,
                        apr_hash_t **locks,
@@ -376,7 +375,8 @@ svn_ra_neon__get_locks(svn_ra_session_t 
      possibly be a lock, so we just return no locks. */
   url = svn_path_url_add_component2(ras->url->data, path, pool);
 
-  SVN_ERR(svn_ra_get_path_relative_to_root(session, &rel_path, url, pool));
+  SVN_ERR(svn_ra_neon__get_path_relative_to_root(session, &rel_path,
+                                                 url, pool));
 
   baton.lock_hash = apr_hash_make(pool);
   baton.path = apr_pstrcat(pool, "/", rel_path, NULL);
@@ -394,7 +394,6 @@ svn_ra_neon__get_locks(svn_ra_session_t 
                       "</S:get-locks-report>",
                       svn_depth_to_word(depth));
 
-
   err = svn_ra_neon__parsed_request(ras, "REPORT", url,
                                     body, NULL, NULL,
                                     getlocks_start_element,

Modified: subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h?rev=958113&r1=958112&r2=958113&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h Fri Jun 25 20:55:20 
2010
@@ -383,6 +383,13 @@ svn_error_t *svn_ra_neon__get_file_revs(
                                         apr_pool_t *pool);
 
 
+/* Local duplicate of svn_ra_get_path_relative_to_root(). */
+svn_error_t *svn_ra_neon__get_path_relative_to_root(svn_ra_session_t *session,
+                                                    const char **rel_path,
+                                                    const char *url,
+                                                    apr_pool_t *pool);
+
+
 /*
 ** SVN_RA_NEON__LP_*: local properties for RA/DAV
 **

Modified: subversion/trunk/subversion/libsvn_ra_neon/session.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/session.c?rev=958113&r1=958112&r2=958113&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/session.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/session.c Fri Jun 25 20:55:20 
2010
@@ -1128,6 +1128,33 @@ static svn_error_t *svn_ra_neon__get_rep
   return SVN_NO_ERROR;
 }
 
+/* Copied from svn_ra_get_path_relative_to_root() and de-vtable-ized
+   to prevent a dependency cycle. */
+svn_error_t *
+svn_ra_neon__get_path_relative_to_root(svn_ra_session_t *session,
+                                       const char **rel_path,
+                                       const char *url,
+                                       apr_pool_t *pool)
+{
+  const char *root_url;
+
+  SVN_ERR(svn_ra_neon__get_repos_root(session, &root_url, pool));
+  if (strcmp(root_url, url) == 0)
+    {
+      *rel_path = "";
+    }
+  else
+    {
+      *rel_path = svn_uri_is_child(root_url, url, pool);
+      if (! *rel_path)
+        return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
+                                 _("'%s' isn't a child of repository root "
+                                   "URL '%s'"),
+                                 url, root_url);
+      *rel_path = svn_path_uri_decode(*rel_path, pool);
+    }
+  return SVN_NO_ERROR;
+}
 
 static svn_error_t *svn_ra_neon__do_get_uuid(svn_ra_session_t *session,
                                              const char **uuid,

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=958113&r1=958112&r2=958113&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Fri Jun 25 20:55:20 2010
@@ -2207,6 +2207,33 @@ static svn_error_t *ra_svn_get_lock(svn_
   return SVN_NO_ERROR;
 }
 
+/* Copied from svn_ra_get_path_relative_to_root() and de-vtable-ized
+   to prevent a dependency cycle. */
+static svn_error_t *path_relative_to_root(svn_ra_session_t *session,
+                                          const char **rel_path,
+                                          const char *url,
+                                          apr_pool_t *pool)
+{
+  const char *root_url;
+
+  SVN_ERR(ra_svn_get_repos_root(session, &root_url, pool));
+  if (strcmp(root_url, url) == 0)
+    {
+      *rel_path = "";
+    }
+  else
+    {
+      *rel_path = svn_uri_is_child(root_url, url, pool);
+      if (! *rel_path)
+        return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
+                                 _("'%s' isn't a child of repository root "
+                                   "URL '%s'"),
+                                 url, root_url);
+      *rel_path = svn_path_uri_decode(*rel_path, pool);
+    }
+  return SVN_NO_ERROR;
+}
+
 static svn_error_t *ra_svn_get_locks(svn_ra_session_t *session,
                                      apr_hash_t **locks,
                                      const char *path,
@@ -2221,8 +2248,7 @@ static svn_error_t *ra_svn_get_locks(svn
 
   /* Figure out the repository abspath from PATH. */
   abs_path = svn_path_url_add_component2(sess->url, path, pool);
-  SVN_ERR(svn_ra_get_path_relative_to_root(session, &abs_path,
-                                           abs_path, pool));
+  SVN_ERR(path_relative_to_root(session, &abs_path, abs_path, pool));
   abs_path = apr_pstrcat(pool, "/", abs_path, NULL);
 
   SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "get-locks", "c(w)", path,


Reply via email to