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 2009/12/04 14:35:15 UTC

svn commit: r887187 - in /subversion/trunk/subversion/libsvn_client: blame.c merge.c ra.c

Author: julianfoad
Date: Fri Dec  4 13:35:15 2009
New Revision: 887187

URL: http://svn.apache.org/viewvc?rev=887187&view=rev
Log:
Fix some instances of calling svn_dirent_get_absolute() on a URL, that were
introduced recently. (No test failures were observed from this bug.)

* subversion/libsvn_client/merge.c
  (normalize_merge_sources): Check the type of the path and invoke
    svn_dirent_get_absolute() only if it is a WC path. Rename the
    variable `source_abspath' to `source_abspath_or_url' as it holds either
    a WC abs-path or a URL.

* subversion/libsvn_client/ra.c
  (svn_client__repos_locations): As above.

* subversion/libsvn_client/blame.c
  (svn_client_blame5): As above.

Found by: Kannan R <kannanr{_AT_}collab.net>
          me
Patch by: Kannan R <kannanr{_AT_}collab.net>
          me

Modified:
    subversion/trunk/subversion/libsvn_client/blame.c
    subversion/trunk/subversion/libsvn_client/merge.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=887187&r1=887186&r2=887187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/blame.c (original)
+++ subversion/trunk/subversion/libsvn_client/blame.c Fri Dec  4 13:35:15 2009
@@ -604,14 +604,17 @@
   apr_pool_t *iterpool;
   svn_stream_t *last_stream;
   svn_stream_t *stream;
-  const char *target_abspath;
+  const char *target_abspath_or_url;
 
   if (start->kind == svn_opt_revision_unspecified
       || end->kind == svn_opt_revision_unspecified)
     return svn_error_create
       (SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
 
-  SVN_ERR(svn_dirent_get_absolute(&target_abspath, target, pool));
+  if (svn_path_is_url(target))
+    target_abspath_or_url = target;
+  else
+    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,
@@ -620,8 +623,8 @@
                                            ctx, pool));
 
   SVN_ERR(svn_client__get_revision_number(&start_revnum, NULL, ctx->wc_ctx,
-                                          target_abspath, ra_session, start,
-                                          pool));
+                                          target_abspath_or_url, ra_session,
+                                          start, pool));
 
   if (end_revnum < start_revnum)
     return svn_error_create
@@ -679,7 +682,8 @@
          working copy file with keywords unexpanded */
       svn_wc_status2_t *status;
 
-      SVN_ERR(svn_wc_status3(&status, ctx->wc_ctx, target_abspath, pool, pool));
+      SVN_ERR(svn_wc_status3(&status, ctx->wc_ctx, target_abspath_or_url, pool,
+                             pool));
 
       if (status->text_status != svn_wc_status_normal)
         {
@@ -690,8 +694,8 @@
           const char *temppath;
           apr_hash_t *kw = NULL;
 
-          SVN_ERR(svn_wc_prop_list2(&props, ctx->wc_ctx, target_abspath, pool,
-                                    pool));
+          SVN_ERR(svn_wc_prop_list2(&props, ctx->wc_ctx, target_abspath_or_url,
+                                    pool, pool));
           SVN_ERR(svn_stream_open_readonly(&wcfile, target, pool, pool));
 
           keywords = apr_hash_get(props, SVN_PROP_KEYWORDS,

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=887187&r1=887186&r2=887187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Fri Dec  4 13:35:15 2009
@@ -5952,26 +5952,23 @@
   svn_revnum_t trim_revision = SVN_INVALID_REVNUM;
   svn_opt_revision_t youngest_opt_rev;
   apr_array_header_t *merge_range_ts, *segments;
-  const char *source_abspath;
+  const char *source_abspath_or_url;
   apr_pool_t *subpool;
   int i;
   youngest_opt_rev.kind = svn_opt_revision_head;
 
-  /* ### FIXME:  SOURCE might be a URL, yet we're doing a bunch of
-     ### working-copy-path operations on it!!  We probably don't run
-     ### into trouble because it happens to be the case that these
-     ### operations are just as sloppy/forgiving as we are about
-     ### handling URL inputs where local paths are expected, but
-     ### that's a shaky limb to stand on.  */
-
-  SVN_ERR(svn_dirent_get_absolute(&source_abspath, source, pool));
+  if(!svn_path_is_url(source))
+    SVN_ERR(svn_dirent_get_absolute(&source_abspath_or_url, source, pool));
+  else
+    source_abspath_or_url = source;
 
   /* Initialize our return variable. */
   *merge_sources_p = apr_array_make(pool, 1, sizeof(merge_source_t *));
 
   /* Resolve our PEG_REVISION to a real number. */
   SVN_ERR(svn_client__get_revision_number(&peg_revnum, &youngest_rev,
-                                          ctx->wc_ctx, source_abspath,
+                                          ctx->wc_ctx,
+                                          source_abspath_or_url,
                                           ra_session, peg_revision, pool));
   if (! SVN_IS_VALID_REVNUM(peg_revnum))
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
@@ -6013,11 +6010,13 @@
           _("PREV, BASE, or COMMITTED revision keywords are invalid for URL"));
 
       SVN_ERR(svn_client__get_revision_number(&range_start_rev, &youngest_rev,
-                                              ctx->wc_ctx, source_abspath,
+                                              ctx->wc_ctx,
+                                              source_abspath_or_url,
                                               ra_session, range_start,
                                               subpool));
       SVN_ERR(svn_client__get_revision_number(&range_end_rev, &youngest_rev,
-                                              ctx->wc_ctx, source_abspath,
+                                              ctx->wc_ctx,
+                                              source_abspath_or_url,
                                               ra_session, range_end,
                                               subpool));
 

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=887187&r1=887186&r2=887187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Fri Dec  4 13:35:15 2009
@@ -547,7 +547,7 @@
   const char *url;
   const char *start_path = NULL;
   const char *end_path = NULL;
-  const char *local_abspath;
+  const char *local_abspath_or_url;
   svn_revnum_t peg_revnum = SVN_INVALID_REVNUM;
   svn_revnum_t start_revnum, end_revnum;
   svn_revnum_t youngest_rev = SVN_INVALID_REVNUM;
@@ -555,8 +555,6 @@
   apr_hash_t *rev_locs;
   apr_pool_t *subpool = svn_pool_create(pool);
 
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, subpool));
-
   /* Ensure that we are given some real revision data to work with.
      (It's okay if the END is unspecified -- in that case, we'll just
      set it to the same thing as START.)  */
@@ -571,7 +569,9 @@
     {
       const svn_wc_entry_t *entry;
 
-      SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, local_abspath,
+      SVN_ERR(svn_dirent_get_absolute(&local_abspath_or_url, path, subpool));
+      SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx,
+                                          local_abspath_or_url,
                                           svn_node_unknown, FALSE, FALSE,
                                           pool, pool));
       if (entry->copyfrom_url && revision->kind == svn_opt_revision_working)
@@ -597,6 +597,7 @@
     }
   else
     {
+      local_abspath_or_url = path;
       url = path;
     }
 
@@ -613,17 +614,17 @@
   /* Resolve the opt_revision_ts. */
   if (peg_revnum == SVN_INVALID_REVNUM)
     SVN_ERR(svn_client__get_revision_number(&peg_revnum, &youngest_rev,
-                                            ctx->wc_ctx, local_abspath,
+                                            ctx->wc_ctx, local_abspath_or_url,
                                             ra_session, revision, pool));
 
   SVN_ERR(svn_client__get_revision_number(&start_revnum, &youngest_rev,
-                                          ctx->wc_ctx, local_abspath,
+                                          ctx->wc_ctx, local_abspath_or_url,
                                           ra_session, start, pool));
   if (end->kind == svn_opt_revision_unspecified)
     end_revnum = start_revnum;
   else
     SVN_ERR(svn_client__get_revision_number(&end_revnum, &youngest_rev,
-                                            ctx->wc_ctx, local_abspath,
+                                            ctx->wc_ctx, local_abspath_or_url,
                                             ra_session, end, pool));
 
   /* Set the output revision variables. */