You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/05/26 05:20:56 UTC

svn commit: r948302 - in /subversion/trunk/subversion/libsvn_client: checkout.c client.h externals.c update.c

Author: hwright
Date: Wed May 26 03:20:54 2010
New Revision: 948302

URL: http://svn.apache.org/viewvc?rev=948302&view=rev
Log:
Require an absolute path for the libsvn_client-internal update API.

* subversion/libsvn_client/externals.c
  (switch_dir_external): Provide absolute path.

* subversion/libsvn_client/checkout.c
  (svn_client__checkout_internal): Same.

* subversion/libsvn_client/client.h
  (svn_client__update_internal): Update docstring and param name.

* subversion/libsvn_client/update.c
  (svn_client__update_internal): Require an absolute path, and remove
    the URL error check.
  (svn_client_update3): Produce the absolute path, and add the URL error
    check.  Rewrite the inner loop for clarity.

Modified:
    subversion/trunk/subversion/libsvn_client/checkout.c
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/update.c

Modified: subversion/trunk/subversion/libsvn_client/checkout.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/checkout.c?rev=948302&r1=948301&r2=948302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/checkout.c (original)
+++ subversion/trunk/subversion/libsvn_client/checkout.c Wed May 26 03:20:54 2010
@@ -178,7 +178,7 @@ svn_client__checkout_internal(svn_revnum
                                      repos_root, uuid, revnum, depth,
                                      pool));
           /* Have update fix the incompleteness. */
-          err = svn_client__update_internal(result_rev, path, revision,
+          err = svn_client__update_internal(result_rev, local_abspath, revision,
                                             depth, TRUE, ignore_externals,
                                             allow_unver_obstructions,
                                             use_sleep, FALSE, innercheckout,
@@ -195,7 +195,7 @@ svn_client__checkout_internal(svn_revnum
          interrupted checkout. */
       if (strcmp(entry_url, session_url) == 0)
         {
-          err = svn_client__update_internal(result_rev, path, revision,
+          err = svn_client__update_internal(result_rev, local_abspath, revision,
                                             depth, TRUE, ignore_externals,
                                             allow_unver_obstructions,
                                             use_sleep, FALSE, innercheckout,

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=948302&r1=948301&r2=948302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Wed May 26 03:20:54 2010
@@ -483,23 +483,24 @@ svn_client__make_local_parents(const cha
 
 /*** Checkout, update and switch ***/
 
-/* Update a working copy PATH to REVISION, and (if not NULL) set
+/* Update a working copy LOCAL_ABSPATH to REVISION, and (if not NULL) set
    RESULT_REV to the update revision.
 
    If DEPTH is svn_depth_unknown, then use whatever depth is already
-   set for PATH, or @c svn_depth_infinity if PATH does not exist.
+   set for LOCAL_ABSPATH, or @c svn_depth_infinity if LOCAL_ABSPATH does
+   not exist.
 
    Else if DEPTH is svn_depth_infinity, then update fully recursively
    (resetting the existing depth of the working copy if necessary).
-   Else if DEPTH is svn_depth_files, update all files under PATH (if
+   Else if DEPTH is svn_depth_files, update all files under LOCAL_ABSPATH (if
    any), but exclude any subdirectories.  Else if DEPTH is
    svn_depth_immediates, update all files and include immediate
    subdirectories (at svn_depth_empty).  Else if DEPTH is
-   svn_depth_empty, just update PATH; if PATH is a directory, that
-   means touching only its properties not its entries.
+   svn_depth_empty, just update LOCAL_ABSPATH; if LOCAL_ABSPATH is a
+   directory, that means touching only its properties not its entries.
 
    If DEPTH_IS_STICKY is set and DEPTH is not svn_depth_unknown, then
-   in addition to updating PATH, also set its sticky ambient depth
+   in addition to updating LOCAL_ABSPATH, also set its sticky ambient depth
    value to DEPTH.
 
    If IGNORE_EXTERNALS is true, do no externals processing.
@@ -510,7 +511,7 @@ svn_client__make_local_parents(const cha
    to TRUE if a sleep is required, and will not change
    *TIMESTAMP_SLEEP if no sleep is required.
 
-   If ALLOW_UNVER_OBSTRUCTIONS is TRUE, unversioned children of PATH
+   If ALLOW_UNVER_OBSTRUCTIONS is TRUE, unversioned children of LOCAL_ABSPATH
    that obstruct items added from the repos are tolerated; if FALSE,
    these obstructions cause the update to fail.
 
@@ -524,7 +525,7 @@ svn_client__make_local_parents(const cha
 */
 svn_error_t *
 svn_client__update_internal(svn_revnum_t *result_rev,
-                            const char *path,
+                            const char *local_abspath,
                             const svn_opt_revision_t *revision,
                             svn_depth_t depth,
                             svn_boolean_t depth_is_sticky,

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=948302&r1=948301&r2=948302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Wed May 26 03:20:54 2010
@@ -198,9 +198,9 @@ switch_dir_external(const char *path,
              externals definition, perform an update. */
           if (strcmp(node_url, url) == 0)
             {
-              SVN_ERR(svn_client__update_internal(NULL, path, revision,
-                                                  svn_depth_unknown, FALSE,
-                                                  FALSE, FALSE,
+              SVN_ERR(svn_client__update_internal(NULL, local_abspath,
+                                                  revision, svn_depth_unknown,
+                                                  FALSE, FALSE, FALSE,
                                                   timestamp_sleep, TRUE,
                                                   TRUE, ctx, subpool));
               svn_pool_destroy(subpool);

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=948302&r1=948301&r2=948302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Wed May 26 03:20:54 2010
@@ -307,7 +307,7 @@ update_internal(svn_revnum_t *result_rev
 
 svn_error_t *
 svn_client__update_internal(svn_revnum_t *result_rev,
-                            const char *path,
+                            const char *local_abspath,
                             const svn_opt_revision_t *revision,
                             svn_depth_t depth,
                             svn_boolean_t depth_is_sticky,
@@ -319,17 +319,10 @@ svn_client__update_internal(svn_revnum_t
                             svn_client_ctx_t *ctx,
                             apr_pool_t *pool)
 {
-  const char *local_abspath, *anchor_abspath;
+  const char *anchor_abspath;
   svn_error_t *err1, *err2;
 
-  SVN_ERR_ASSERT(path);
-
-  if (svn_path_is_url(path))
-    return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
-                             _("Path '%s' is not a directory"),
-                             path);
-
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
   if (!innerupdate)
     {
@@ -367,7 +360,6 @@ svn_client_update3(apr_array_header_t **
                    apr_pool_t *pool)
 {
   int i;
-  svn_error_t *err = SVN_NO_ERROR;
   apr_pool_t *subpool = svn_pool_create(pool);
   const char *path = NULL;
 
@@ -377,6 +369,8 @@ svn_client_update3(apr_array_header_t **
   for (i = 0; i < paths->nelts; ++i)
     {
       svn_boolean_t sleep;
+      svn_boolean_t skipped = FALSE;
+      svn_error_t *err = SVN_NO_ERROR;
       svn_revnum_t result_rev;
       path = APR_ARRAY_IDX(paths, i, const char *);
 
@@ -385,19 +379,36 @@ svn_client_update3(apr_array_header_t **
       if (ctx->cancel_func && (err = ctx->cancel_func(ctx->cancel_baton)))
         break;
 
-      err = svn_client__update_internal(&result_rev, path, revision, depth,
-                                        depth_is_sticky, ignore_externals,
-                                        allow_unver_obstructions,
-                                        &sleep, TRUE, FALSE, ctx, subpool);
-      if (err && err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
+      if (svn_path_is_url(path))
+        {
+          skipped = TRUE;
+        }
+      else
         {
-          return svn_error_return(err);
+          const char *local_abspath;
+
+          SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, subpool));
+          err = svn_client__update_internal(&result_rev, local_abspath,
+                                            revision, depth, depth_is_sticky,
+                                            ignore_externals,
+                                            allow_unver_obstructions,
+                                            &sleep, TRUE, FALSE, ctx, subpool);
+
+          if (err && err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
+            {
+              return svn_error_return(err);
+            }
+
+          if (err)
+            {
+              /* SVN_ERR_WC_NOT_WORKING_COPY: it's not versioned */
+              svn_error_clear(err);
+              skipped = TRUE;
+            }
         }
-      else if (err)
+
+      if (skipped)
         {
-          /* SVN_ERR_WC_NOT_WORKING_COPY: it's not versioned */
-          svn_error_clear(err);
-          err = SVN_NO_ERROR;
           result_rev = SVN_INVALID_REVNUM;
           if (ctx->notify_func2)
             {
@@ -428,5 +439,5 @@ svn_client_update3(apr_array_header_t **
   svn_pool_destroy(subpool);
   svn_io_sleep_for_timestamps((paths->nelts == 1) ? path : NULL, pool);
 
-  return svn_error_return(err);
+  return SVN_NO_ERROR;
 }