You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2011/01/21 17:43:50 UTC

svn commit: r1061895 - in /subversion/branches/uris-as-urls/subversion/svn: checkout-cmd.c cl.h diff-cmd.c export-cmd.c info-cmd.c log-cmd.c merge-cmd.c switch-cmd.c util.c

Author: cmpilato
Date: Fri Jan 21 16:43:49 2011
New Revision: 1061895

URL: http://svn.apache.org/viewvc?rev=1061895&view=rev
Log:
On the 'uris-as-urls' branch, review and correct some use of the
svn_uri_* APIs.  (One step of many similar ones.)

* subversion/svn/merge-cmd.c
  (svn_cl__merge): Review, correct (as needed), and rename uses of the
    svn_uri_* API.

* subversion/svn/switch-cmd.c
  (svn_cl__switch): Same as above.

* subversion/svn/checkout-cmd.c
  (svn_cl__checkout): Same as above.

* subversion/svn/info-cmd.c
  (svn_cl__info): Same as above.

* subversion/svn/log-cmd.c
  (log_entry_receiver): Same as above.

* subversion/svn/diff-cmd.c
  (summarize_regular): Same as above, but also fixes preexisting URI
    encoding bugs.
  (summarize_xml, svn_cl__diff): Replace uses of svn_cl__path_join()
    with more explicit code.

* subversion/svn/export-cmd.c
  (svn_cl__export): Same as above, but also fixes a preexisting URI
    encoding bug.

* subversion/svn/cl.h,
  (svn_cl__path_join): Remove as unused.

* subversion/svn/util.c
  (svn_cl__path_join): Remove as unused.
  (svn_cl__opt_parse_path): Track renamed svn_uri_canonicalize() function.

Modified:
    subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c
    subversion/branches/uris-as-urls/subversion/svn/cl.h
    subversion/branches/uris-as-urls/subversion/svn/diff-cmd.c
    subversion/branches/uris-as-urls/subversion/svn/export-cmd.c
    subversion/branches/uris-as-urls/subversion/svn/info-cmd.c
    subversion/branches/uris-as-urls/subversion/svn/log-cmd.c
    subversion/branches/uris-as-urls/subversion/svn/merge-cmd.c
    subversion/branches/uris-as-urls/subversion/svn/switch-cmd.c
    subversion/branches/uris-as-urls/subversion/svn/util.c

Modified: subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c (original)
+++ subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c Fri Jan 21 16:43:49 2011
@@ -93,9 +93,8 @@ svn_cl__checkout(apr_getopt_t *os,
 
           /* Discard the peg-revision, if one was provided. */
           SVN_ERR(svn_opt_parse_path(&pegrev, &local_dir, local_dir, pool));
-
-          local_dir = svn_uri_basename(local_dir, pool);
-          local_dir = svn_path_uri_decode(local_dir, pool);
+          local_dir = svn_path_uri_decode(svn_url_basename(local_dir, pool),
+                                          pool);
         }
       else
         {
@@ -136,7 +135,7 @@ svn_cl__checkout(apr_getopt_t *os,
       SVN_ERR(svn_opt_parse_path(&peg_revision, &true_url, repos_url,
                                  subpool));
 
-      true_url = svn_uri_canonicalize(true_url, subpool);
+      true_url = svn_url_canonicalize(true_url, subpool);
 
       /* Use sub-directory of destination if checking-out multiple URLs */
       if (targets->nelts == 2)
@@ -145,9 +144,12 @@ svn_cl__checkout(apr_getopt_t *os,
         }
       else
         {
-          target_dir = svn_uri_basename(true_url, subpool);
-          target_dir = svn_path_uri_decode(target_dir, subpool);
-          target_dir = svn_dirent_join(local_dir, target_dir, subpool);
+          target_dir =
+            svn_dirent_join(local_dir,
+                            svn_path_uri_decode(svn_url_basename(true_url,
+                                                                 subpool),
+                                                subpool),
+                            subpool);
         }
 
       /* Checkout doesn't accept an unspecified revision, so default to

Modified: subversion/branches/uris-as-urls/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/cl.h?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/cl.h (original)
+++ subversion/branches/uris-as-urls/subversion/svn/cl.h Fri Jan 21 16:43:49 2011
@@ -754,18 +754,6 @@ svn_cl__node_description(const svn_wc_co
                          const char *wc_repos_root_URL,
                          apr_pool_t *pool);
 
-/* Join a BASE path with a COMPONENT, allocating the result in POOL.
- * COMPONENT need not be a single single component: it can be any path,
- * absolute or relative to BASE.
- *
- * This function exists to gather the cases when it could not be determined
- * if BASE is an uri, dirent or relative.
- */
-const char *
-svn_cl__path_join(const char *base,
-                  const char *component,
-                  apr_pool_t *pool);
-
 /* Return, in @a *true_targets_p, a copy of @a targets with peg revision
  * specifiers snipped off the end of each element.
  *

Modified: subversion/branches/uris-as-urls/subversion/svn/diff-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/diff-cmd.c?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/diff-cmd.c (original)
+++ subversion/branches/uris-as-urls/subversion/svn/diff-cmd.c Fri Jan 21 16:43:49 2011
@@ -93,11 +93,18 @@ summarize_xml(const svn_client_diff_summ
 
   /* Tack on the target path, so we can differentiate between different parts
    * of the output when we're given multiple targets. */
-  path = svn_cl__path_join(path, summary->path, pool);
+  if (svn_path_is_url(path))
+    {
+      path = svn_path_url_add_component2(path, summary->path, pool);
+    }
+  else
+    {
+      path = svn_dirent_join(path, summary->path, pool);
 
-  /* Convert non-urls to local style, so that things like "" show up as "." */
-  if (! svn_path_is_url(path))
-    path = svn_dirent_local_style(path, pool);
+      /* Convert non-urls to local style, so that things like "" 
+         show up as "." */
+      path = svn_dirent_local_style(path, pool);
+    }
 
   svn_xml_make_open_tag(&sb, pool, svn_xml_protect_pcdata, "path",
                         "kind", svn_cl__node_kind_str_xml(summary->node_kind),
@@ -122,11 +129,18 @@ summarize_regular(const svn_client_diff_
 
   /* Tack on the target path, so we can differentiate between different parts
    * of the output when we're given multiple targets. */
-  path = svn_uri_join(path, summary->path, pool);
+  if (svn_path_is_url(path))
+    {
+      path = svn_path_url_add_component2(path, summary->path, pool);
+    }
+  else
+    {
+      path = svn_dirent_join(path, summary->path, pool);
 
-  /* Convert non-urls to local style, so that things like "" show up as "." */
-  if (! svn_path_is_url(path))
-    path = svn_dirent_local_style(path, pool);
+      /* Convert non-urls to local style, so that things like "" 
+         show up as "." */
+      path = svn_dirent_local_style(path, pool);
+    }
 
   /* Note: This output format tries to look like the output of 'svn status',
    *       thus the blank spaces where information that is not relevant to
@@ -311,8 +325,15 @@ svn_cl__diff(apr_getopt_t *os,
                                      _("Path '%s' not relative to base URLs"),
                                      path);
 
-          target1 = svn_cl__path_join(old_target, path, iterpool);
-          target2 = svn_cl__path_join(new_target, path, iterpool);
+          path = svn_relpath_canonicalize(path, iterpool);
+          if (svn_path_is_url(old_target))
+            target1 = svn_path_url_add_component2(old_target, path, iterpool);
+          else
+            target1 = svn_dirent_join(old_target, path, iterpool);
+          if (svn_path_is_url(old_target))
+            target2 = svn_path_url_add_component2(new_target, path, iterpool);
+          else
+            target2 = svn_dirent_join(new_target, path, iterpool);
 
           if (opt_state->summarize)
             SVN_ERR(svn_client_diff_summarize2

Modified: subversion/branches/uris-as-urls/subversion/svn/export-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/export-cmd.c?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/export-cmd.c (original)
+++ subversion/branches/uris-as-urls/subversion/svn/export-cmd.c Fri Jan 21 16:43:49 2011
@@ -74,7 +74,10 @@ svn_cl__export(apr_getopt_t *os,
      the `to' path.  Else, a `to' path was supplied. */
   if (targets->nelts == 1)
     {
-      to = svn_path_uri_decode(svn_uri_basename(truefrom, pool), pool);
+      if (svn_path_is_url(truefrom))
+        to = svn_path_uri_decode(svn_url_basename(truefrom, pool), pool);
+      else
+        to = svn_dirent_basename(truefrom, pool);
     }
   else
     {

Modified: subversion/branches/uris-as-urls/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/info-cmd.c?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/info-cmd.c (original)
+++ subversion/branches/uris-as-urls/subversion/svn/info-cmd.c Fri Jan 21 16:43:49 2011
@@ -545,7 +545,7 @@ svn_cl__info(apr_getopt_t *os,
       /* If no peg-rev was attached to a URL target, then assume HEAD. */
       if (svn_path_is_url(truepath))
         {
-          truepath = svn_uri_canonicalize(truepath, subpool);
+          truepath = svn_url_canonicalize(truepath, subpool);
 
           if (peg_revision.kind == svn_opt_revision_unspecified)
             peg_revision.kind = svn_opt_revision_head;

Modified: subversion/branches/uris-as-urls/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/log-cmd.c?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/log-cmd.c (original)
+++ subversion/branches/uris-as-urls/subversion/svn/log-cmd.c Fri Jan 21 16:43:49 2011
@@ -322,7 +322,7 @@ log_entry_receiver(void *baton,
 
               svn_error_clear(err);
 
-              parent = svn_uri_dirname(lb->target_url, pool);
+              parent = svn_url_dirname(lb->target_url, pool);
               iterpool = svn_pool_create(pool);
               while (strcmp(parent, lb->target_url) != 0)
                 {
@@ -351,7 +351,7 @@ log_entry_receiver(void *baton,
                       if (err->apr_err == SVN_ERR_FS_NOT_FOUND)
                         {
                           svn_error_clear(err);
-                          parent = svn_uri_dirname(parent, pool);
+                          parent = svn_url_dirname(parent, pool);
                           continue;
                         }
                       if (err->apr_err == SVN_ERR_RA_ILLEGAL_URL ||

Modified: subversion/branches/uris-as-urls/subversion/svn/merge-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/merge-cmd.c?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/merge-cmd.c (original)
+++ subversion/branches/uris-as-urls/subversion/svn/merge-cmd.c Fri Jan 21 16:43:49 2011
@@ -245,8 +245,8 @@ svn_cl__merge(apr_getopt_t *os,
       if (svn_path_is_url(sourcepath1))
         {
           const char *sp1_basename, *sp2_basename;
-          sp1_basename = svn_uri_basename(sourcepath1, pool);
-          sp2_basename = svn_uri_basename(sourcepath2, pool);
+          sp1_basename = svn_url_basename(sourcepath1, pool);
+          sp2_basename = svn_url_basename(sourcepath2, pool);
 
           if (strcmp(sp1_basename, sp2_basename) == 0)
             {

Modified: subversion/branches/uris-as-urls/subversion/svn/switch-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/switch-cmd.c?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/switch-cmd.c (original)
+++ subversion/branches/uris-as-urls/subversion/svn/switch-cmd.c Fri Jan 21 16:43:49 2011
@@ -151,7 +151,7 @@ svn_cl__switch(apr_getopt_t *os,
                              target);
 
   /* Canonicalize the URL. */
-  switch_url = svn_uri_canonicalize(switch_url, scratch_pool);
+  switch_url = svn_url_canonicalize(switch_url, scratch_pool);
 
   /* Deal with depthstuffs. */
   if (opt_state->set_depth != svn_depth_unknown)

Modified: subversion/branches/uris-as-urls/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-urls/subversion/svn/util.c?rev=1061895&r1=1061894&r2=1061895&view=diff
==============================================================================
--- subversion/branches/uris-as-urls/subversion/svn/util.c (original)
+++ subversion/branches/uris-as-urls/subversion/svn/util.c Fri Jan 21 16:43:49 2011
@@ -1296,17 +1296,6 @@ svn_cl__node_description(const svn_wc_co
                       node->peg_rev);
 }
 
-const char *
-svn_cl__path_join(const char *base,
-                  const char *component,
-                  apr_pool_t *pool)
-{
-  if (svn_path_is_url(base))
-    return svn_uri_join(base, component, pool);
-  else
-    return svn_dirent_join(base, component, pool);
-}
-
 svn_error_t *
 svn_cl__eat_peg_revisions(apr_array_header_t **true_targets_p,
                           const apr_array_header_t *targets,
@@ -1342,7 +1331,7 @@ svn_cl__opt_parse_path(svn_opt_revision_
   SVN_ERR(svn_opt_parse_path(rev, truepath, path, pool));
 
   if (svn_path_is_url(*truepath))
-    *truepath = svn_uri_canonicalize(*truepath, pool);
+    *truepath = svn_url_canonicalize(*truepath, pool);
   else
     *truepath = svn_dirent_canonicalize(*truepath, pool);
 



Re: svn commit: r1061895 - in /subversion/branches/uris-as-urls/subversion/svn: checkout-cmd.c cl.h diff-cmd.c export-cmd.c info-cmd.c log-cmd.c merge-cmd.c switch-cmd.c util.c

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 01/21/2011 04:24 PM, Bert Huijben wrote:

> I think the uri-decode should be handled in svn_url_basename (and
> _is_child, etc.) for the caller. That way they always return a valid
> relpath and the callers can stop handling the encode/decode.

I'll add this as a TODO in my BRANCH-README.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


RE: svn commit: r1061895 - in /subversion/branches/uris-as-urls/subversion/svn: checkout-cmd.c cl.h diff-cmd.c export-cmd.c info-cmd.c log-cmd.c merge-cmd.c switch-cmd.c util.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: cmpilato@apache.org [mailto:cmpilato@apache.org]
> Sent: vrijdag 21 januari 2011 17:44
> To: commits@subversion.apache.org
> Subject: svn commit: r1061895 - in /subversion/branches/uris-as-
> urls/subversion/svn: checkout-cmd.c cl.h diff-cmd.c export-cmd.c info-cmd.c
> log-cmd.c merge-cmd.c switch-cmd.c util.c
> 
> Author: cmpilato
> Date: Fri Jan 21 16:43:49 2011
> New Revision: 1061895
> 
> URL: http://svn.apache.org/viewvc?rev=1061895&view=rev
> Log:
> On the 'uris-as-urls' branch, review and correct some use of the
> svn_uri_* APIs.  (One step of many similar ones.)
> 
> * subversion/svn/merge-cmd.c
>   (svn_cl__merge): Review, correct (as needed), and rename uses of the
>     svn_uri_* API.
> 
> * subversion/svn/switch-cmd.c
>   (svn_cl__switch): Same as above.
> 
> * subversion/svn/checkout-cmd.c
>   (svn_cl__checkout): Same as above.
> 
> * subversion/svn/info-cmd.c
>   (svn_cl__info): Same as above.
> 
> * subversion/svn/log-cmd.c
>   (log_entry_receiver): Same as above.
> 
> * subversion/svn/diff-cmd.c
>   (summarize_regular): Same as above, but also fixes preexisting URI
>     encoding bugs.
>   (summarize_xml, svn_cl__diff): Replace uses of svn_cl__path_join()
>     with more explicit code.
> 
> * subversion/svn/export-cmd.c
>   (svn_cl__export): Same as above, but also fixes a preexisting URI
>     encoding bug.
> 
> * subversion/svn/cl.h,
>   (svn_cl__path_join): Remove as unused.
> 
> * subversion/svn/util.c
>   (svn_cl__path_join): Remove as unused.
>   (svn_cl__opt_parse_path): Track renamed svn_uri_canonicalize() function.
> 
> Modified:
>     subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c
>     subversion/branches/uris-as-urls/subversion/svn/cl.h
>     subversion/branches/uris-as-urls/subversion/svn/diff-cmd.c
>     subversion/branches/uris-as-urls/subversion/svn/export-cmd.c
>     subversion/branches/uris-as-urls/subversion/svn/info-cmd.c
>     subversion/branches/uris-as-urls/subversion/svn/log-cmd.c
>     subversion/branches/uris-as-urls/subversion/svn/merge-cmd.c
>     subversion/branches/uris-as-urls/subversion/svn/switch-cmd.c
>     subversion/branches/uris-as-urls/subversion/svn/util.c
> 
> Modified: subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c
> URL: http://svn.apache.org/viewvc/subversion/branches/uris-as-
> urls/subversion/svn/checkout-
> cmd.c?rev=1061895&r1=1061894&r2=1061895&view=diff
> ==========================================================
> ====================
> --- subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c
> (original)
> +++ subversion/branches/uris-as-urls/subversion/svn/checkout-cmd.c Fri
> Jan 21 16:43:49 2011
> @@ -93,9 +93,8 @@ svn_cl__checkout(apr_getopt_t *os,
> 
>            /* Discard the peg-revision, if one was provided. */
>            SVN_ERR(svn_opt_parse_path(&pegrev, &local_dir, local_dir, pool));
> -
> -          local_dir = svn_uri_basename(local_dir, pool);
> -          local_dir = svn_path_uri_decode(local_dir, pool);
> +          local_dir = svn_path_uri_decode(svn_url_basename(local_dir, pool),
> +                                          pool);

I think the uri-decode should be handled in svn_url_basename (and _is_child, etc.) for the caller. That way they always return a valid relpath and the callers can stop handling the encode/decode.

	Bert