Author: pburba
Date: Fri May  6 19:58:05 2011
New Revision: 1100349

URL: http://svn.apache.org/viewvc?rev=1100349&view=rev
Log:
Follow-up to r1100321, move error for issue #3858 from libsvn_wc to
libsvn_client.

Suggested by: cmpilato

* subversion/libsvn_wc/cleanup.c

  (cleanup_internal): Revert r1100321 and move that logic to...

* subversion/libsvn_client/cleanup.c

  (svn_client_cleanup): ...here.  Also improve the error message wording a
   bit and convert the WC root path in the message to the local style (as
   suggested by gstein).

Modified:
    subversion/trunk/subversion/libsvn_client/cleanup.c
    subversion/trunk/subversion/libsvn_wc/cleanup.c

Modified: subversion/trunk/subversion/libsvn_client/cleanup.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cleanup.c?rev=1100349&r1=1100348&r2=1100349&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cleanup.c (original)
+++ subversion/trunk/subversion/libsvn_client/cleanup.c Fri May  6 19:58:05 2011
@@ -59,6 +59,24 @@ svn_client_cleanup(const char *path,
 
   err = svn_wc_cleanup3(ctx->wc_ctx, local_abspath, ctx->cancel_func,
                         ctx->cancel_baton, scratch_pool);
+  if (err && err->apr_err == SVN_ERR_WC_LOCKED)
+    {
+      const char *wcroot_abspath;
+      svn_error_t *err2 = svn_wc_get_wc_root(&wcroot_abspath, ctx->wc_ctx,
+                                             local_abspath, scratch_pool,
+                                             scratch_pool);
+      if (err2)
+        err =  svn_error_compose_create(err, err2);
+      else
+        err = svn_error_createf(SVN_ERR_WC_LOCKED, err,
+                                _("Working copy locked; trying running "
+                                  "'svn cleanup' on the root of the working "
+                                  "copy (%s) instead."),
+                                  svn_dirent_local_style(wcroot_abspath,
+                                                         scratch_pool),
+                                  scratch_pool);
+    }
+
   svn_io_sleep_for_timestamps(path, scratch_pool);
   return svn_error_return(err);
 }

Modified: subversion/trunk/subversion/libsvn_wc/cleanup.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/cleanup.c?rev=1100349&r1=1100348&r2=1100349&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/cleanup.c (original)
+++ subversion/trunk/subversion/libsvn_wc/cleanup.c Fri May  6 19:58:05 2011
@@ -142,32 +142,13 @@ cleanup_internal(svn_wc__db_t *db,
 {
   int wc_format;
   const char *cleanup_abspath;
-  svn_error_t *err;
 
   /* Can we even work with this directory?  */
   SVN_ERR(can_be_cleaned(&wc_format, db, dir_abspath, scratch_pool));
 
-  /* Issue #3835: If DIR_ABSPATH is locked indirectly via a recursive lock
-     on an ancestor, then recommend cleaning up the entire WC. */
-  err = svn_wc__db_wclock_obtain(db, dir_abspath, -1, TRUE, scratch_pool);
-  if (err)
-    {
-      if (err->apr_err == SVN_ERR_WC_LOCKED)
-        {
-          const char *wcroot_abspath;
-          svn_error_t *err2 = svn_wc__db_get_wcroot(&wcroot_abspath, db,
-                                                    dir_abspath,
-                                                    scratch_pool,
-                                                    scratch_pool);
-          if (err2)
-            return svn_error_compose_create(err, err2);
-
-          return svn_error_createf(SVN_ERR_WC_LOCKED, err,
-                                   _("Try cleanup from root of working copy "
-                                     "'%s'"), wcroot_abspath, scratch_pool);
-        }
-      return svn_error_return(err);
-    }
+  /* ### This fails if ADM_ABSPATH is locked indirectly via a
+     ### recursive lock on an ancestor. */
+  SVN_ERR(svn_wc__db_wclock_obtain(db, dir_abspath, -1, TRUE, scratch_pool));
 
   /* Run our changes before the subdirectories. We may not have to recurse
      if we blow away a subdir.  */


Reply via email to