subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r958698 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c wc_db.c
Date Mon, 28 Jun 2010 20:04:23 GMT
Author: rhuijben
Date: Mon Jun 28 20:04:22 2010
New Revision: 958698

URL: http://svn.apache.org/viewvc?rev=958698&view=rev
Log:
Allow svn_wc__db_add_directory() to attach a directory to its parent, to
allow removing another use case of entries from svn_wc_add4().

* subversion/libsvn_wc/adm_ops.c
  (svn_wc_add4): Move for copyfrom_url in repos_root out
    of the entries handling. Directly remove incomplete entry from new
    directory when we only need the directory for local additions. Use
    svn_wc__db_op_add_directory() for directory additions.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_op_add_directory): Hook directory to parent directory
     instead of just ignoring the parent when the directories are not
     attached. Ignoring the parent is never valid as a top level wcroot
     can never be added.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=958698&r1=958697&r2=958698&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon Jun 28 20:04:22 2010
@@ -1276,6 +1276,12 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
                                              db, parent_abspath,
                                              scratch_pool, scratch_pool));
       }
+
+    if (copyfrom_url
+        && !svn_uri_is_ancestor(repos_root_url, copyfrom_url))
+      return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                               _("The URL '%s' has a different repository "
+                                 "root than its parent"), copyfrom_url);
   }
 
   /* Verify that we can actually integrate the inner working copy */
@@ -1332,6 +1338,11 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
                                           repos_root_url, repos_root_url,
                                           repos_uuid, 0,
                                           depth, scratch_pool));
+
+      /* ### The entries based code still needs the incomplete base record,
+         ### remove it for the direct db code. */
+      if (!copyfrom_url)
+        SVN_ERR(svn_wc__db_base_remove(db, local_abspath, scratch_pool));
     }
 #endif
 
@@ -1388,6 +1399,11 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
                                          scratch_pool));
         }
     }
+  else if (!copyfrom_url)
+    {
+      SVN_ERR(svn_wc__db_op_add_directory(db, local_abspath, NULL,
+                                          scratch_pool));
+    }
   else
     {
       svn_wc_entry_t tmp_entry;
@@ -1408,7 +1424,7 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
 
       /* Init the modify flags. */
       tmp_entry.schedule = svn_wc_schedule_add;
-      tmp_entry.kind = kind;
+      tmp_entry.kind = svn_node_dir;
       modify_flags = SVN_WC__ENTRY_MODIFY_SCHEDULE | SVN_WC__ENTRY_MODIFY_KIND;
 
       /* If a copy ancestor was given, make sure the copyfrom URL is in the same
@@ -1416,12 +1432,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
          entry */
       if (copyfrom_url)
         {
-          if (repos_root_url
-              && ! svn_uri_is_ancestor(repos_root_url, copyfrom_url))
-            return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
-                                     _("The URL '%s' has a different "
-                                       "repository root than its parent"),
-                                     copyfrom_url);
           tmp_entry.copyfrom_url = copyfrom_url;
           tmp_entry.copyfrom_rev = copyfrom_rev;
           tmp_entry.copied = TRUE;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=958698&r1=958697&r2=958698&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Jun 28 20:04:22 2010
@@ -3071,12 +3071,20 @@ svn_wc__db_op_add_directory(svn_wc__db_t
 
       err = navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readwrite,
                                scratch_pool);
-      if (err)
+      if (err && err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
         {
-          /* Prolly fell off the top of the wcroot. Just call it a day.  */
+          /* Not registered in the parent; register as addition */
           svn_error_clear(err);
-          return SVN_NO_ERROR;
+
+          SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+                              svn_dirent_dirname(local_abspath, scratch_pool),
+                              svn_sqlite__mode_readwrite, scratch_pool,
+                              scratch_pool));
+
+          VERIFY_USABLE_PDH(pdh);
         }
+      else
+        SVN_ERR(err);
 
       blank_iwb(&iwb);
 



Mime
View raw message