You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2011/10/24 12:07:37 UTC

svn commit: r1188072 - in /subversion/branches/showing-merge-info/subversion: include/svn_client.h libsvn_client/url.c svn/mergeinfo-cmd.c

Author: julianfoad
Date: Mon Oct 24 10:07:37 2011
New Revision: 1188072

URL: http://svn.apache.org/viewvc?rev=1188072&view=rev
Log:
On the 'showing-merge-info' branch: Let svn_client__resolve_target_location()
use a supplied RA session or return the newly created RA session.

* subversion/include/svn_client.h,
  subversion/libsvn_client/url.c
  (svn_client__resolve_location, svn_client__resolve_target_location): Take
    an RA session in/out parameter.

* subversion/svn/mergeinfo-cmd.c
  (svn_cl__mergeinfo): Update calls.

Modified:
    subversion/branches/showing-merge-info/subversion/include/svn_client.h
    subversion/branches/showing-merge-info/subversion/libsvn_client/url.c
    subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c

Modified: subversion/branches/showing-merge-info/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/include/svn_client.h?rev=1188072&r1=1188071&r2=1188072&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/include/svn_client.h (original)
+++ subversion/branches/showing-merge-info/subversion/include/svn_client.h Mon Oct 24 10:07:37 2011
@@ -68,7 +68,7 @@ svn_client_version(void);
  * @{
  */
 
-
+
 /*** Authentication stuff ***/
 
 /**  The new authentication system allows the RA layer to "pull"
@@ -1045,6 +1045,7 @@ svn_client__resolve_location(const char 
                              const char **repo_uuid_p,
                              svn_revnum_t *repo_revnum_p,
                              const char **repo_relpath_p,
+                             svn_ra_session_t **ra_session_p,
                              const char *path_or_url,
                              const svn_opt_revision_t *peg_revision,
                              const svn_opt_revision_t *revision,
@@ -1052,9 +1053,14 @@ svn_client__resolve_location(const char 
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_pool);
 
-/* */
+/* @a ra_session_p is an optional in/out parameter. If an RA session is
+ * needed and @a ra_session_p and @a *ra_session_p are both non-null, use
+ * that session; otherwise open a new sesssion (allocated
+ * in @a target->pool) and if @a ra_session_p is non-null then set
+ * @a *ra_session_p to the new session. */
 svn_error_t *
 svn_client__resolve_target_location(svn_client_target_t *target,
+                                    svn_ra_session_t **ra_session_p,
                                     svn_client_ctx_t *ctx,
                                     apr_pool_t *scratch_pool);
 

Modified: subversion/branches/showing-merge-info/subversion/libsvn_client/url.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_client/url.c?rev=1188072&r1=1188071&r2=1188072&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_client/url.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_client/url.c Mon Oct 24 10:07:37 2011
@@ -116,6 +116,7 @@ svn_client__resolve_location(const char 
                              const char **repo_uuid_p,
                              svn_revnum_t *repo_revnum_p,
                              const char **repo_relpath_p,
+                             svn_ra_session_t **ra_session_p,
                              const char *path_or_url,
                              const svn_opt_revision_t *peg_revision,
                              const svn_opt_revision_t *revision,
@@ -138,37 +139,33 @@ svn_client__resolve_location(const char 
   if (repo_root_url_p)
     *repo_root_url_p = repos_root_url;
 
-  if (repo_relpath_p)
+  if (repo_relpath_p || repo_revnum_p)
     {
+      svn_ra_session_t *ra_session;
       const char *url;
 
-      SVN_ERR(svn_client_url_from_path2(&url, path_or_url,
-                                        ctx, scratch_pool, scratch_pool));
+      SVN_ERR(svn_client__ra_session_from_path(&ra_session,
+                                               repo_revnum_p,
+                                               &url,
+                                               abspath_or_url,
+                                               NULL /* base_dir_abspath */,
+                                               peg_revision, revision,
+                                               ctx, result_pool));
       if (! url)
         return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
                                  _("Path '%s' has no URL in the repository"),
                                  path_or_url);
-      *repo_relpath_p = svn_uri_skip_ancestor(repos_root_url, url,
-                                              result_pool);
-    }
-
-  if (repo_revnum_p)
-    {
-      svn_ra_session_t *ra_session = NULL;
-
-      SVN_ERR(svn_client__get_revision_number(repo_revnum_p,
-                                              NULL /* youngest */,
-                                              ctx->wc_ctx,
-                                              abspath_or_url,
-                                              ra_session,
-                                              peg_revision,
-                                              scratch_pool));
+      if (repo_relpath_p)
+        *repo_relpath_p = svn_uri_skip_ancestor(repos_root_url, url, result_pool);
+      if (ra_session_p != NULL && *ra_session_p == NULL)
+        *ra_session_p = ra_session;
     }
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
 svn_client__resolve_target_location(svn_client_target_t *target,
+                                    svn_ra_session_t **ra_session_p,
                                     svn_client_ctx_t *ctx,
                                     apr_pool_t *scratch_pool)
 {
@@ -176,6 +173,7 @@ svn_client__resolve_target_location(svn_
                                        &target->repos_uuid,
                                        &target->repos_revnum,
                                        &target->repos_relpath,
+                                       ra_session_p,
                                        target->path_or_url,
                                        &target->peg_revision,
                                        &target->revision,

Modified: subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c?rev=1188072&r1=1188071&r2=1188072&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c (original)
+++ subversion/branches/showing-merge-info/subversion/svn/mergeinfo-cmd.c Mon Oct 24 10:07:37 2011
@@ -190,7 +190,7 @@ svn_cl__mergeinfo(apr_getopt_t *os,
       target->revision.kind = svn_opt_revision_working;
     }
 
-  SVN_ERR(svn_client__resolve_target_location(target, ctx, pool));
+  SVN_ERR(svn_client__resolve_target_location(target, NULL, ctx, pool));
 
   /* Locate the source branch: the first argument or automatic. */
   if (targets->nelts >= 1)
@@ -210,7 +210,7 @@ svn_cl__mergeinfo(apr_getopt_t *os,
       SVN_ERR(find_source_branch(&source, target, ctx, pool));
     }
 
-  SVN_ERR(svn_client__resolve_target_location(source, ctx, pool));
+  SVN_ERR(svn_client__resolve_target_location(source, NULL, ctx, pool));
 
   printf("Source branch: %s\n", target_for_display(source, pool));
   printf("Target branch: %s\n", target_for_display(target, pool));