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 2012/05/14 17:06:35 UTC

svn commit: r1338239 - in /subversion/trunk/subversion/libsvn_client: blame.c cat.c client.h export.c list.c log.c mergeinfo.c prop_commands.c ra.c

Author: julianfoad
Date: Mon May 14 15:06:34 2012
New Revision: 1338239

URL: http://svn.apache.org/viewvc?rev=1338239&view=rev
Log:
Convert the remaining callers of svn_client__ra_session_from_path() to use
svn_client__ra_session_from_path2(), which returns the resolved location as
a path-rev structure.  Remove svn_client__ra_session_from_path().

The revving of the function name was only useful for the period over which
this conversion took place, and the "2" suffix can be dropped from the new
function's name after this commit.

* subversion/libsvn_client/client.h,
  subversion/libsvn_client/ra.c
  (svn_client__ra_session_from_path): Delete.

* subversion/libsvn_client/blame.c
  (svn_client_blame5): Use svn_client__ra_session_from_path2() instead.

* subversion/libsvn_client/cat.c
  (svn_client_cat2): Same.

* subversion/libsvn_client/export.c
  (svn_client_export5): Same.

* subversion/libsvn_client/list.c
  (svn_client_list2): Same.

* subversion/libsvn_client/log.c
  (svn_client__get_copy_source, svn_client_log5): Same.

* subversion/libsvn_client/mergeinfo.c
  (get_mergeinfo): Same.

* subversion/libsvn_client/prop_commands.c
  (svn_client_propget4, svn_client_proplist3): Same.

Modified:
    subversion/trunk/subversion/libsvn_client/blame.c
    subversion/trunk/subversion/libsvn_client/cat.c
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/export.c
    subversion/trunk/subversion/libsvn_client/list.c
    subversion/trunk/subversion/libsvn_client/log.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/prop_commands.c
    subversion/trunk/subversion/libsvn_client/ra.c

Modified: subversion/trunk/subversion/libsvn_client/blame.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/blame.c?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/blame.c (original)
+++ subversion/trunk/subversion/libsvn_client/blame.c Mon May 14 15:06:34 2012
@@ -593,6 +593,7 @@ svn_client_blame5(const char *target,
   struct file_rev_baton frb;
   svn_ra_session_t *ra_session;
   svn_revnum_t start_revnum, end_revnum;
+  svn_client__pathrev_t *end_loc;
   struct blame *walk, *walk_merged = NULL;
   apr_pool_t *iterpool;
   svn_stream_t *last_stream;
@@ -610,9 +611,10 @@ svn_client_blame5(const char *target,
     SVN_ERR(svn_dirent_get_absolute(&target_abspath_or_url, target, pool));
 
   /* Get an RA plugin for this filesystem object. */
-  SVN_ERR(svn_client__ra_session_from_path(&ra_session, &end_revnum, NULL,
-                                           target, NULL, peg_revision, end,
-                                           ctx, pool));
+  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &end_loc,
+                                            target, NULL, peg_revision, end,
+                                            ctx, pool));
+  end_revnum = end_loc->rev;
 
   SVN_ERR(svn_client__get_revision_number(&start_revnum, NULL, ctx->wc_ctx,
                                           target_abspath_or_url, ra_session,

Modified: subversion/trunk/subversion/libsvn_client/cat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cat.c?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cat.c (original)
+++ subversion/trunk/subversion/libsvn_client/cat.c Mon May 14 15:06:34 2012
@@ -183,11 +183,10 @@ svn_client_cat2(svn_stream_t *out,
                 apr_pool_t *pool)
 {
   svn_ra_session_t *ra_session;
-  svn_revnum_t rev;
+  svn_client__pathrev_t *loc;
   svn_string_t *eol_style;
   svn_string_t *keywords;
   apr_hash_t *props;
-  const char *url;
   svn_stream_t *output = out;
   svn_error_t *err;
 
@@ -227,20 +226,21 @@ svn_client_cat2(svn_stream_t *out,
     }
 
   /* Get an RA plugin for this filesystem object. */
-  SVN_ERR(svn_client__ra_session_from_path(&ra_session, &rev,
-                                           &url, path_or_url, NULL,
-                                           peg_revision,
-                                           revision, ctx, pool));
+  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
+                                            path_or_url, NULL,
+                                            peg_revision,
+                                            revision, ctx, pool));
 
   /* Grab some properties we need to know in order to figure out if anything
      special needs to be done with this file. */
-  err = svn_ra_get_file(ra_session, "", rev, NULL, NULL, &props, pool);
+  err = svn_ra_get_file(ra_session, "", loc->rev, NULL, NULL, &props, pool);
   if (err)
     {
       if (err->apr_err == SVN_ERR_FS_NOT_FILE)
         {
           return svn_error_createf(SVN_ERR_CLIENT_IS_DIRECTORY, err,
-                                   _("URL '%s' refers to a directory"), url);
+                                   _("URL '%s' refers to a directory"),
+                                   loc->url);
         }
       else
         {
@@ -284,7 +284,7 @@ svn_client_cat2(svn_stream_t *out,
           SVN_ERR(svn_subst_build_keywords2
                   (&kw, keywords->data,
                    cmt_rev->data,
-                   url,
+                   loc->url,
                    when,
                    cmt_author ? cmt_author->data : NULL,
                    pool));
@@ -297,7 +297,7 @@ svn_client_cat2(svn_stream_t *out,
                                            eol_str, FALSE, kw, TRUE, pool);
     }
 
-  SVN_ERR(svn_ra_get_file(ra_session, "", rev, output, NULL, NULL, pool));
+  SVN_ERR(svn_ra_get_file(ra_session, "", loc->rev, output, NULL, NULL, pool));
 
   if (out != output)
     /* Close the interjected stream */

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Mon May 14 15:06:34 2012
@@ -227,29 +227,15 @@ svn_client__get_youngest_common_ancestor
    for a URL or 'working' for a WC path.  If REVISION->kind is
    'unspecified', the operative revision is the peg revision.
 
-   Store the resulting ra_session in *RA_SESSION_P.  Store the actual
-   revision number of the object in *REV_P, and the final resulting
-   URL in *URL_P. REV_P and/or URL_P may be NULL if not wanted.
+   Store the resulting ra_session in *RA_SESSION_P.  Store the final
+   resolved location of the object in *RESOLVED_LOC_P.  RESOLVED_LOC_P
+   may be NULL if not wanted.
 
    Use authentication baton cached in CTX to authenticate against the
    repository.
 
    Use POOL for all allocations. */
 svn_error_t *
-svn_client__ra_session_from_path(svn_ra_session_t **ra_session_p,
-                                 svn_revnum_t *rev_p,
-                                 const char **url_p,
-                                 const char *path_or_url,
-                                 const char *base_dir_abspath,
-                                 const svn_opt_revision_t *peg_revision,
-                                 const svn_opt_revision_t *revision,
-                                 svn_client_ctx_t *ctx,
-                                 apr_pool_t *pool);
-
-/* Like svn_client__ra_session_from_path() but returning a path-rev
- * instead of separate URL and rev outputs.  RESOLVED_LOC_P may be NULL
- * if not wanted. */
-svn_error_t *
 svn_client__ra_session_from_path2(svn_ra_session_t **ra_session_p,
                                  svn_client__pathrev_t **resolved_loc_p,
                                  const char *path_or_url,

Modified: subversion/trunk/subversion/libsvn_client/export.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/export.c (original)
+++ subversion/trunk/subversion/libsvn_client/export.c Mon May 14 15:06:34 2012
@@ -1103,20 +1103,19 @@ svn_client_export5(svn_revnum_t *result_
 
   if (from_is_url || ! SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(revision->kind))
     {
-      svn_revnum_t revnum;
-      const char *url;
+      svn_client__pathrev_t *loc;
       svn_ra_session_t *ra_session;
       svn_node_kind_t kind;
       struct edit_baton *eb = apr_pcalloc(pool, sizeof(*eb));
 
       /* Get the RA connection. */
-      SVN_ERR(svn_client__ra_session_from_path(&ra_session, &revnum,
-                                               &url, from_path_or_url, NULL,
-                                               peg_revision,
-                                               revision, ctx, pool));
+      SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
+                                                from_path_or_url, NULL,
+                                                peg_revision,
+                                                revision, ctx, pool));
 
       eb->root_path = to_path;
-      eb->root_url = url;
+      eb->root_url = loc->url;
       eb->force = overwrite;
       eb->target_revision = &edit_revision;
       eb->externals = apr_hash_make(pool);
@@ -1127,7 +1126,7 @@ svn_client_export5(svn_revnum_t *result_
       eb->notify_func = ctx->notify_func2;
       eb->notify_baton = ctx->notify_baton2;
 
-      SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, pool));
+      SVN_ERR(svn_ra_check_path(ra_session, "", loc->rev, &kind, pool));
 
       if (kind == svn_node_file)
         {
@@ -1183,7 +1182,7 @@ svn_client_export5(svn_revnum_t *result_
           /* Step outside the editor-likeness for a moment, to actually talk
            * to the repository. */
           /* ### note: the stream will not be closed */
-          SVN_ERR(svn_ra_get_file(ra_session, "", revnum,
+          SVN_ERR(svn_ra_get_file(ra_session, "", loc->rev,
                                   fb->tmp_stream,
                                   NULL, &props, pool));
 
@@ -1242,13 +1241,13 @@ svn_client_export5(svn_revnum_t *result_
           /* Manufacture a basic 'report' to the update reporter. */
           SVN_ERR(svn_ra_do_update2(ra_session,
                                     &reporter, &report_baton,
-                                    revnum,
+                                    loc->rev,
                                     "", /* no sub-target */
                                     depth,
                                     FALSE, /* don't want copyfrom-args */
                                     export_editor, edit_baton, pool));
 
-          SVN_ERR(reporter->set_path(report_baton, "", revnum,
+          SVN_ERR(reporter->set_path(report_baton, "", loc->rev,
                                      /* Depth is irrelevant, as we're
                                         passing start_empty=TRUE anyway. */
                                      svn_depth_infinity,

Modified: subversion/trunk/subversion/libsvn_client/list.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/list.c?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/list.c (original)
+++ subversion/trunk/subversion/libsvn_client/list.c Mon May 14 15:06:34 2012
@@ -237,9 +237,8 @@ svn_client_list2(const char *path_or_url
                  apr_pool_t *pool)
 {
   svn_ra_session_t *ra_session;
-  svn_revnum_t rev;
+  svn_client__pathrev_t *loc;
   svn_dirent_t *dirent;
-  const char *url;
   const char *fs_path;
   svn_error_t *err;
   apr_hash_t *locks;
@@ -249,20 +248,19 @@ svn_client_list2(const char *path_or_url
   dirent_fields |= SVN_DIRENT_KIND;
 
   /* Get an RA plugin for this filesystem object. */
-  SVN_ERR(svn_client__ra_session_from_path(&ra_session, &rev,
-                                           &url, path_or_url, NULL,
-                                           peg_revision,
-                                           revision, ctx, pool));
+  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
+                                            path_or_url, NULL,
+                                            peg_revision,
+                                            revision, ctx, pool));
 
-  SVN_ERR(svn_ra__get_fspath_relative_to_root(ra_session, &fs_path, url,
-                                              pool));
+  fs_path = svn_client__pathrev_fspath(loc, pool);
 
-  SVN_ERR(ra_stat_compatible(ra_session, rev, &dirent, dirent_fields,
+  SVN_ERR(ra_stat_compatible(ra_session, loc->rev, &dirent, dirent_fields,
                              ctx, pool));
   if (! dirent)
     return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
                              _("URL '%s' non-existent in revision %ld"),
-                             url, rev);
+                             loc->url, loc->rev);
 
   /* Maybe get all locks under url. */
   if (fetch_locks)
@@ -292,7 +290,7 @@ svn_client_list2(const char *path_or_url
       && (depth == svn_depth_files
           || depth == svn_depth_immediates
           || depth == svn_depth_infinity))
-    SVN_ERR(get_dir_contents(dirent_fields, "", rev, ra_session, locks,
+    SVN_ERR(get_dir_contents(dirent_fields, "", loc->rev, ra_session, locks,
                              fs_path, depth, ctx, list_func, baton, pool));
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_client/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/log.c?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/log.c (original)
+++ subversion/trunk/subversion/libsvn_client/log.c Mon May 14 15:06:34 2012
@@ -101,23 +101,22 @@ svn_client__get_copy_source(const char *
   copyfrom_info_t copyfrom_info = { 0 };
   apr_pool_t *sesspool = svn_pool_create(pool);
   svn_ra_session_t *ra_session;
-  svn_revnum_t at_rev;
-  const char *at_url;
+  svn_client__pathrev_t *at_loc;
 
   copyfrom_info.is_first = TRUE;
   copyfrom_info.path = NULL;
   copyfrom_info.rev = SVN_INVALID_REVNUM;
   copyfrom_info.pool = pool;
 
-  SVN_ERR(svn_client__ra_session_from_path(&ra_session, &at_rev, &at_url,
-                                           path_or_url, NULL,
-                                           revision, revision,
-                                           ctx, sesspool));
+  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &at_loc,
+                                            path_or_url, NULL,
+                                            revision, revision,
+                                            ctx, sesspool));
 
   /* Find the copy source.  Walk the location segments to find the revision
      at which this node was created (copied or added). */
 
-  err = svn_ra_get_location_segments(ra_session, "", at_rev, at_rev,
+  err = svn_ra_get_location_segments(ra_session, "", at_loc->rev, at_loc->rev,
                                      SVN_INVALID_REVNUM,
                                      copyfrom_info_receiver, &copyfrom_info,
                                      pool);
@@ -281,7 +280,6 @@ svn_client_log5(const apr_array_header_t
   svn_ra_session_t *ra_session;
   const char *url_or_path;
   svn_boolean_t has_log_revprops;
-  const char *actual_url;
   apr_array_header_t *condensed_targets;
   svn_opt_revision_t session_opt_rev;
   const char *ra_target;
@@ -474,6 +472,8 @@ svn_client_log5(const apr_array_header_t
 
 
   {
+    svn_client__pathrev_t *actual_loc;
+
     /* If this is a revision type that requires access to the working copy,
      * we use our initial target path to figure out where to root the RA
      * session, otherwise we use our URL. */
@@ -483,7 +483,7 @@ svn_client_log5(const apr_array_header_t
     else
       ra_target = url_or_path;
 
-    SVN_ERR(svn_client__ra_session_from_path(&ra_session, NULL, &actual_url,
+    SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &actual_loc,
                                              ra_target, NULL,
                                              &peg_rev, &session_opt_rev,
                                              ctx, pool));
@@ -497,7 +497,7 @@ svn_client_log5(const apr_array_header_t
 
       /* Create ra session on first use */
       rb.ra_session_pool = pool;
-      rb.ra_session_url = actual_url;
+      rb.ra_session_url = actual_loc->url;
     }
   }
 

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Mon May 14 15:06:34 2012
@@ -1053,12 +1053,11 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
   svn_ra_session_t *ra_session;
   const char *local_abspath;
   svn_boolean_t use_url = svn_path_is_url(path_or_url);
-  const char *peg_url;
-  svn_revnum_t peg_rev;
+  svn_client__pathrev_t *peg_loc;
 
-  SVN_ERR(svn_client__ra_session_from_path(&ra_session, &peg_rev, &peg_url,
-                                           path_or_url, NULL, peg_revision,
-                                           peg_revision, ctx, scratch_pool));
+  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &peg_loc,
+                                            path_or_url, NULL, peg_revision,
+                                            peg_revision, ctx, scratch_pool));
 
   /* If PATH_OR_URL is as working copy path determine if we will need to
      contact the repository for the requested PEG_REVISION. */
@@ -1071,8 +1070,8 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
       SVN_ERR(svn_client__wc_node_get_origin(&origin, local_abspath, ctx,
                                              scratch_pool, scratch_pool));
       if (!origin
-          || strcmp(origin->url, peg_url) != 0
-          || peg_rev != origin->rev)
+          || strcmp(origin->url, peg_loc->url) != 0
+          || peg_loc->rev != origin->rev)
       {
         use_url = TRUE; /* Don't rely on local mergeinfo */
       }
@@ -1087,8 +1086,8 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
   if (use_url)
     {
       SVN_ERR(svn_client__get_repos_mergeinfo_catalog(
-        mergeinfo_catalog, ra_session, peg_url, peg_rev, svn_mergeinfo_inherited,
-        FALSE, include_descendants,
+        mergeinfo_catalog, ra_session, peg_loc->url, peg_loc->rev,
+        svn_mergeinfo_inherited, FALSE, include_descendants,
         result_pool, scratch_pool));
     }
   else /* ! svn_path_is_url() */

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Mon May 14 15:06:34 2012
@@ -847,21 +847,22 @@ svn_client_propget4(apr_hash_t **props,
     }
   else
     {
-      const char *url;
+      svn_client__pathrev_t *loc;
       svn_ra_session_t *ra_session;
       svn_node_kind_t kind;
 
       /* Get an RA plugin for this filesystem object. */
-      SVN_ERR(svn_client__ra_session_from_path(&ra_session, &revnum,
-                                               &url, target, NULL,
-                                               peg_revision,
-                                               revision, ctx, scratch_pool));
+      SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
+                                                target, NULL,
+                                                peg_revision,
+                                                revision, ctx, scratch_pool));
 
-      SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, scratch_pool));
+      SVN_ERR(svn_ra_check_path(ra_session, "", loc->rev, &kind, scratch_pool));
 
-      SVN_ERR(remote_propget(*props, propname, url, "",
-                             kind, revnum, ra_session,
+      SVN_ERR(remote_propget(*props, propname, loc->url, "",
+                             kind, loc->rev, ra_session,
                              depth, result_pool, scratch_pool));
+      revnum = loc->rev;
     }
 
   if (actual_revnum)
@@ -1088,8 +1089,6 @@ svn_client_proplist3(const char *path_or
                      svn_client_ctx_t *ctx,
                      apr_pool_t *pool)
 {
-  const char *url;
-
   peg_revision = svn_cl__rev_default_to_head_or_working(peg_revision,
                                                         path_or_url);
   revision = svn_cl__rev_default_to_peg(revision, peg_revision);
@@ -1172,17 +1171,17 @@ svn_client_proplist3(const char *path_or
       svn_ra_session_t *ra_session;
       svn_node_kind_t kind;
       apr_pool_t *subpool = svn_pool_create(pool);
-      svn_revnum_t revnum;
+      svn_client__pathrev_t *loc;
 
       /* Get an RA session for this URL. */
-      SVN_ERR(svn_client__ra_session_from_path(&ra_session, &revnum,
-                                               &url, path_or_url, NULL,
-                                               peg_revision,
-                                               revision, ctx, pool));
+      SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc,
+                                                path_or_url, NULL,
+                                                peg_revision,
+                                                revision, ctx, pool));
 
-      SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, pool));
+      SVN_ERR(svn_ra_check_path(ra_session, "", loc->rev, &kind, pool));
 
-      SVN_ERR(remote_proplist(url, "", kind, revnum, ra_session, depth,
+      SVN_ERR(remote_proplist(loc->url, "", kind, loc->rev, ra_session, depth,
                               receiver, receiver_baton, pool, subpool));
       svn_pool_destroy(subpool);
     }

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1338239&r1=1338238&r2=1338239&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Mon May 14 15:06:34 2012
@@ -513,31 +513,6 @@ svn_client__ra_session_from_path2(svn_ra
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_client__ra_session_from_path(svn_ra_session_t **ra_session_p,
-                                 svn_revnum_t *rev_p,
-                                 const char **url_p,
-                                 const char *path_or_url,
-                                 const char *base_dir_abspath,
-                                 const svn_opt_revision_t *peg_revision,
-                                 const svn_opt_revision_t *revision,
-                                 svn_client_ctx_t *ctx,
-                                 apr_pool_t *pool)
-{
-  svn_client__pathrev_t *resolved_loc;
-
-  SVN_ERR(svn_client__ra_session_from_path2(ra_session_p, &resolved_loc,
-                                            path_or_url, base_dir_abspath,
-                                            peg_revision, revision,
-                                            ctx, pool));
-  if (rev_p)
-    *rev_p = resolved_loc->rev;
-  if (url_p)
-    *url_p = resolved_loc->url;
-
-  return SVN_NO_ERROR;
-}
-
 
 svn_error_t *
 svn_client__ensure_ra_session_url(const char **old_session_url,