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 2010/06/18 22:22:58 UTC

svn commit: r956119 - in /subversion/trunk/subversion/libsvn_wc: lock.c status.c update_editor.c wc.h wc_db.c

Author: cmpilato
Date: Fri Jun 18 20:22:57 2010
New Revision: 956119

URL: http://svn.apache.org/viewvc?rev=956119&view=rev
Log:
Teach the WC-NG code to treat (in most cases) a "my parent is a
pre-1.7 working copy" error as merely "my parent isn't a working copy
at all" and degrade gracefully.  This allows 1.7 working copies to be
created inside of pre-1.7 working copies.

* subversion/libsvn_wc/wc.h
  (SVN_WC__ERR_IS_NOT_CURRENT_WC): New macro.

* subversion/libsvn_wc/status.c
  (internal_status): Test returned error with new
    SVN_WC__ERR_IS_NOT_CURRENT_WC() macro.

* subversion/libsvn_wc/lock.c
  (svn_wc__acquire_write_lock): Test returned error with new
    SVN_WC__ERR_IS_NOT_CURRENT_WC() macro.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_op_read_tree_conflict, svn_wc__db_temp_op_set_dir_depth,
   svn_wc__db_is_wcroot, is_wclocked): Test returned error with new
    SVN_WC__ERR_IS_NOT_CURRENT_WC() macro.

* subversion/libsvn_wc/update_editor.c
  (already_in_a_tree_conflict): Test returned error with new
    SVN_WC__ERR_IS_NOT_CURRENT_WC() macro.

Modified:
    subversion/trunk/subversion/libsvn_wc/lock.c
    subversion/trunk/subversion/libsvn_wc/status.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc.h
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/lock.c?rev=956119&r1=956118&r2=956119&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/lock.c (original)
+++ subversion/trunk/subversion/libsvn_wc/lock.c Fri Jun 18 20:22:57 2010
@@ -1564,7 +1564,7 @@ svn_wc__acquire_write_lock(const char **
       parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
       err = svn_wc__db_read_kind(&parent_kind, wc_ctx->db, parent_abspath, TRUE,
                                  scratch_pool);
-      if (err && err->apr_err == SVN_ERR_WC_NOT_DIRECTORY)
+      if (err && SVN_WC__ERR_IS_NOT_CURRENT_WC(err))
         {
           svn_error_clear(err);
           parent_kind = svn_wc__db_kind_unknown;

Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=956119&r1=956118&r2=956119&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Fri Jun 18 20:22:57 2010
@@ -2574,8 +2574,8 @@ internal_status(svn_wc_status3_t **statu
                                  NULL, db, parent_abspath, result_pool,
                                  scratch_pool);
 
-      if (err && (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY
-                  || err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND))
+      if (err && (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
+                  || SVN_WC__ERR_IS_NOT_CURRENT_WC(err)))
         {
           svn_error_clear(err);
           parent_repos_root_url = NULL;

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=956119&r1=956118&r2=956119&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Jun 18 20:22:57 2010
@@ -1936,11 +1936,9 @@ already_in_a_tree_conflict(svn_boolean_t
 
       if (err)
         {
-          if (err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY &&
-              err->apr_err != SVN_ERR_WC_UPGRADE_REQUIRED)
-            {
-              return svn_error_return(err);
-            }
+          if (! SVN_WC__ERR_IS_NOT_CURRENT_WC(err))
+            return svn_error_return(err);
+
           svn_error_clear(err);
           break;
         }

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=956119&r1=956118&r2=956119&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Fri Jun 18 20:22:57 2010
@@ -159,6 +159,14 @@ extern "C" {
 /* A version < this does not store properties in wc.db.  */
 #define SVN_WC__PROPS_IN_DB 17
 
+/* Return true iff error E indicates an "is not a working copy" type
+   of error, either because something wasn't a working copy at all, or
+   because it's a working copy from a previous version (in need of
+   upgrade). */
+#define SVN_WC__ERR_IS_NOT_CURRENT_WC(e) \
+            ((e->apr_err == SVN_ERR_WC_NOT_WORKING_COPY) || \
+             (e->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED))
+
 
 
 /*** Context handling ***/

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=956119&r1=956118&r2=956119&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jun 18 20:22:57 2010
@@ -3660,7 +3660,7 @@ svn_wc__db_op_read_tree_conflict(
   err = svn_wc__db_op_read_all_tree_conflicts(&tree_conflicts, db,
                                               parent_abspath,
                                               result_pool, scratch_pool);
-  if (err && err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
+  if (err && SVN_WC__ERR_IS_NOT_CURRENT_WC(err))
     {
        /* We walked off the top of a working copy.  */
        svn_error_clear(err);
@@ -3862,7 +3862,7 @@ svn_wc__db_temp_op_set_dir_depth(svn_wc_
                                scratch_pool);
       if (err)
         {
-          if (err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
+          if (! SVN_WC__ERR_IS_NOT_CURRENT_WC(err))
             return svn_error_return(err);
 
           /* No parent to update */
@@ -7166,7 +7166,7 @@ svn_wc__db_is_wcroot(svn_boolean_t *is_r
                                             svn_sqlite__mode_readwrite,
                                             scratch_pool);
 
-      if (err && err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
+      if (err && SVN_WC__ERR_IS_NOT_CURRENT_WC(err))
         {
           svn_error_clear(err);
           *is_root = TRUE;
@@ -7265,7 +7265,7 @@ is_wclocked(svn_boolean_t *locked,
 
   err = get_statement_for_path(&stmt, db, local_abspath,
                                STMT_SELECT_WC_LOCK, scratch_pool);
-  if (err && err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
+  if (err && SVN_WC__ERR_IS_NOT_CURRENT_WC(err))
     {
       svn_error_clear(err);
       *locked = FALSE;