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 2010/11/10 12:00:44 UTC

svn commit: r1033411 - in /subversion/trunk/subversion/svn: cat-cmd.c cl.h list-cmd.c util.c

Author: julianfoad
Date: Wed Nov 10 11:00:44 2010
New Revision: 1033411

URL: http://svn.apache.org/viewvc?rev=1033411&view=rev
Log:
Add a wrapper function svn_cl__opt_parse_path() for svn_opt_parse_path(),
that canonicalizes the resulting dirent/URL.

Make use of new function in "ls" and "cat" commands.

* subversion/svn/cl.h,
  subversion/svn/util.c
  (svn_cl__opt_parse_path): New function.

* subversion/svn/list-cmd.c (svn_cl__list),
  subversion/svn/cat-cmd.c (svn_cl__cat):
    Use svn_cl__opt_parse_path() instead of svn_opt_parse_path() followed
    by canonicalizing.

Suggested by: julianfoad
Patch by: Noorul Islam K M <noorul{_AT_}collab.net>

Modified:
    subversion/trunk/subversion/svn/cat-cmd.c
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/list-cmd.c
    subversion/trunk/subversion/svn/util.c

Modified: subversion/trunk/subversion/svn/cat-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cat-cmd.c?rev=1033411&r1=1033410&r2=1033411&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cat-cmd.c (original)
+++ subversion/trunk/subversion/svn/cat-cmd.c Wed Nov 10 11:00:44 2010
@@ -27,7 +27,6 @@
 
 /*** Includes. ***/
 
-#include "svn_path.h"
 #include "svn_pools.h"
 #include "svn_client.h"
 #include "svn_error.h"
@@ -69,13 +68,8 @@ svn_cl__cat(apr_getopt_t *os,
       SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
 
       /* Get peg revisions. */
-      SVN_ERR(svn_opt_parse_path(&peg_revision, &truepath, target,
-                                 subpool));
-
-      if (svn_path_is_url(truepath))
-        truepath = svn_uri_canonicalize(truepath, subpool);
-      else
-        truepath = svn_dirent_canonicalize(truepath, subpool);
+      SVN_ERR(svn_cl__opt_parse_path(&peg_revision, &truepath, target,
+                                     subpool));
 
       SVN_ERR(svn_cl__try(svn_client_cat2(out, truepath, &peg_revision,
                                           &(opt_state->start_revision),

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1033411&r1=1033410&r2=1033411&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Wed Nov 10 11:00:44 2010
@@ -810,6 +810,13 @@ svn_cl__eat_peg_revisions(apr_array_head
                           const apr_array_header_t *targets,
                           apr_pool_t *pool);
 
+/* Like svn_opt_parse_path(), but canonicalizes dirent/URL */
+svn_error_t *
+svn_cl__opt_parse_path(svn_opt_revision_t *rev,
+                       const char **truepath,
+                       const char *path,
+                       apr_pool_t *pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/svn/list-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/list-cmd.c?rev=1033411&r1=1033410&r2=1033411&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/list-cmd.c (original)
+++ subversion/trunk/subversion/svn/list-cmd.c Wed Nov 10 11:00:44 2010
@@ -268,13 +268,8 @@ svn_cl__list(apr_getopt_t *os,
       SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
 
       /* Get peg revisions. */
-      SVN_ERR(svn_opt_parse_path(&peg_revision, &truepath, target,
-                                 subpool));
-
-      if (svn_path_is_url(truepath))
-        truepath = svn_uri_canonicalize(truepath, subpool);
-      else
-        truepath = svn_dirent_canonicalize(truepath, subpool);
+      SVN_ERR(svn_cl__opt_parse_path(&peg_revision, &truepath, target,
+                                     subpool));
 
       if (opt_state->xml)
         {

Modified: subversion/trunk/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/util.c?rev=1033411&r1=1033410&r2=1033411&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/util.c (original)
+++ subversion/trunk/subversion/svn/util.c Wed Nov 10 11:00:44 2010
@@ -1324,3 +1324,19 @@ svn_cl__eat_peg_revisions(apr_array_head
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_cl__opt_parse_path(svn_opt_revision_t *rev,
+                       const char **truepath,
+                       const char *path /* UTF-8! */,
+                       apr_pool_t *pool)
+{
+  SVN_ERR(svn_opt_parse_path(rev, truepath, path, pool));
+  
+  if (svn_path_is_url(*truepath))
+    *truepath = svn_uri_canonicalize(*truepath, pool);
+  else
+    *truepath = svn_dirent_canonicalize(*truepath, pool);
+
+  return SVN_NO_ERROR;
+}