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/09/01 17:10:17 UTC

svn commit: r991563 - in /subversion/trunk/subversion/libsvn_wc: wc_db.c wc_db.h

Author: julianfoad
Date: Wed Sep  1 15:10:17 2010
New Revision: 991563

URL: http://svn.apache.org/viewvc?rev=991563&view=rev
Log:
Remove 'svn_wc__db_kind_subdir' and disable some more 'parent stub' handling
as none of this is required in single-DB mode.

* subversion/libsvn_wc/wc_db.c
  (kind_map): Remove 'svn_wc__db_kind_subdir'.
  (svn_wc__db_base_add_absent_node): Don't add a parent stub.
  (svn_wc__db_temp_base_add_subdir): Delete, as it was unused.
  (svn_wc__db_base_get_info, svn_wc__db_base_get_info_from_parent,
   svn_wc__db_read_info): Don't handle 'svn_wc__db_kind_subdir'.
  (svn_wc__db_scan_addition): Don't check 'svn_wc__db_kind_subdir'.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_kind_t): Remove 'svn_wc__db_kind_subdir'.
  (svn_wc__db_temp_base_add_subdir): Delete, as it was unused.
Index: subversion/libsvn_wc/wc_db.c
===================================================================
--- subversion/libsvn_wc/wc_db.c	(revision 991548)
+++ subversion/libsvn_wc/wc_db.c	(working copy)
@@ -2058,30 +2005,34 @@ svn_wc__db_base_get_info(svn_wc__db_stat
     {
       svn_wc__db_kind_t node_kind = svn_sqlite__column_token(stmt, 3,
                                                              kind_map);
 
       if (kind)
         {
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir)
             *kind = svn_wc__db_kind_dir;
           else
+#endif
             *kind = node_kind;
         }
       if (status)
         {
           *status = svn_sqlite__column_token(stmt, 2, presence_map);
 
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir
               && *status == svn_wc__db_status_normal)
             {
               /* We're looking at the subdir record in the *parent* directory,
                  which implies per-dir .svn subdirs. We should be looking
                  at the subdir itself; therefore, it is missing or obstructed
                  in some way. Inform the caller.  */
               *status = svn_wc__db_status_obstructed;
             }
+#endif
         }
       if (revision)
         {
           *revision = svn_sqlite__column_revnum(stmt, 4);
         }
       if (repos_relpath)
@@ -2241,30 +2192,34 @@ svn_wc__db_base_get_info_from_parent(svn
     {
       svn_wc__db_kind_t node_kind = svn_sqlite__column_token(stmt, 3,
                                                              kind_map);
 
       if (kind)
         {
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir)
             *kind = svn_wc__db_kind_dir;
           else
+#endif
             *kind = node_kind;
         }
       if (status)
         {
           *status = svn_sqlite__column_token(stmt, 2, presence_map);
 
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir
               && *status == svn_wc__db_status_normal)
             {
               /* We're looking at the subdir record in the *parent* directory,
                  which implies per-dir .svn subdirs. We should be looking
                  at the subdir itself; therefore, it is missing or obstructed
                  in some way. Inform the caller.  */
               *status = svn_wc__db_status_obstructed;
             }
+#endif
         }
       if (revision)
         {
           *revision = svn_sqlite__column_revnum(stmt, 4);
         }
       if (repos_relpath)
@@ -2981,13 +2936,16 @@ temp_cross_db_copy(svn_wc__db_t *db,
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
   svn_depth_t depth;
 
   SVN_ERR_ASSERT(kind == svn_wc__db_kind_file
                  || kind == svn_wc__db_kind_dir
-                 || kind == svn_wc__db_kind_subdir);
+#ifndef SVN_WC__SINGLE_DB
+                 || kind == svn_wc__db_kind_subdir
+#endif
+                 );
 
   SVN_ERR(svn_wc__db_read_info(NULL /* status */,
                                NULL /* kind */,
                                NULL /* revision */,
                                NULL /* repos_relpath */,
                                NULL /* repos_root_url */,
@@ -5122,22 +5080,24 @@ svn_wc__db_read_info(svn_wc__db_status_t
                  ### both set to 'incomplete'.  */
               SVN_ERR_ASSERT((*status != svn_wc__db_status_absent
                               && *status != svn_wc__db_status_excluded
                               /* && *status != svn_wc__db_status_incomplete */)
                              || !*have_work);
 
+#ifndef SVN_WC__SINGLE_DB
               if (node_kind == svn_wc__db_kind_subdir
                   && *status == svn_wc__db_status_normal)
                 {
                   /* We should have read a row from the subdir wc.db. It
                      must be obstructed in some way.
 
                      It is also possible that a WORKING node will override
                      this value with a proper status.  */
                   *status = svn_wc__db_status_obstructed;
                 }
+#endif
             }
 
           if (*have_work)
             {
               svn_wc__db_status_t work_status;
 
@@ -5161,43 +5121,49 @@ svn_wc__db_read_info(svn_wc__db_status_t
                        || work_status == svn_wc__db_status_base_deleted)
                 {
                   /* The caller should scan upwards to detect whether this
                      deletion has occurred because this node has been moved
                      away, or it is a regular deletion. Also note that the
                      deletion could be of the BASE tree, or a child of
-                     something that has been copied/moved here.
+                     something that has been copied/moved here. */
 
-                     If we're looking at the data in the parent, then
+#ifndef SVN_WC__SINGLE_DB
+                  /* If we're looking at the data in the parent, then
                      something has obstructed the child data. Inform
                      the caller.  */
                   if (node_kind == svn_wc__db_kind_subdir)
                     *status = svn_wc__db_status_obstructed_delete;
                   else
+#endif
                     *status = svn_wc__db_status_deleted;
                 }
               else /* normal */
                 {
                   /* The caller should scan upwards to detect whether this
                      addition has occurred because of a simple addition,
-                     a copy, or is the destination of a move.
+                     a copy, or is the destination of a move. */
 
-                     If we're looking at the data in the parent, then
+#ifndef SVN_WC__SINGLE_DB
+                  /* If we're looking at the data in the parent, then
                      something has obstructed the child data. Inform
                      the caller.  */
                   if (node_kind == svn_wc__db_kind_subdir)
                     *status = svn_wc__db_status_obstructed_add;
                   else
+#endif
                     *status = svn_wc__db_status_added;
                 }
             }
         }
       if (kind)
         {
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir)
             *kind = svn_wc__db_kind_dir;
           else
+#endif
             *kind = node_kind;
         }
       if (revision)
         {
           if (*have_work)
             *revision = SVN_INVALID_REVNUM;
@@ -5269,13 +5235,16 @@ svn_wc__db_read_info(svn_wc__db_status_t
           else
             *last_mod_time = svn_sqlite__column_int64(stmt_base, 12);
         }
       if (depth)
         {
           if (node_kind != svn_wc__db_kind_dir
-                && node_kind != svn_wc__db_kind_subdir)
+#ifndef SVN_WC__SINGLE_DB
+                && node_kind != svn_wc__db_kind_subdir
+#endif
+              )
             {
               *depth = svn_depth_unknown;
             }
           else
             {
               const char *depth_str;
@@ -6616,23 +6585,25 @@ svn_wc__db_scan_addition(svn_wc__db_stat
             return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS,
                                      svn_sqlite__reset(stmt),
                                      _("Expected node '%s' to be added."),
                                      svn_dirent_local_style(local_abspath,
                                                             scratch_pool));
 
+#ifndef SVN_WC__SINGLE_DB
           /* ### in per-dir operation, it is possible that we just fetched
              ### the parent stub. examine the KIND field.
              ###
              ### scan_addition is NOT allowed for an obstructed_add status
              ### from read_info. there may be key information in the
              ### subdir record (eg. copyfrom_*).  */
           {
             svn_wc__db_kind_t kind = svn_sqlite__column_token(stmt, 1,
                                                               kind_map);
             SVN_ERR_ASSERT(kind != svn_wc__db_kind_subdir);
           }
+#endif
 
           /* Provide the default status; we'll override as appropriate. */
           if (status)
             *status = svn_wc__db_status_added;
         }
 

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

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=991563&r1=991562&r2=991563&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Sep  1 15:10:17 2010
@@ -202,7 +202,9 @@ static const svn_token_map_t kind_map[] 
   { "file", svn_wc__db_kind_file },
   { "dir", svn_wc__db_kind_dir },
   { "symlink", svn_wc__db_kind_symlink },
+#ifndef SVN_WC__SINGLE_DB
   { "subdir", svn_wc__db_kind_subdir },
+#endif
   { "unknown", svn_wc__db_kind_unknown },
   { NULL }
 };
@@ -1853,6 +1855,8 @@ svn_wc__db_base_add_absent_node(svn_wc__
 
   flush_entries(pdh);
 
+#ifndef SVN_WC__SINGLE_DB
+  /* Add a parent stub.  */
   if (*local_relpath == '\0')
     {
       SVN_ERR(navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readwrite,
@@ -1879,66 +1883,9 @@ svn_wc__db_base_add_absent_node(svn_wc__
 
       flush_entries(pdh);
     }
-  return SVN_NO_ERROR;
-}
-
-
-/* ### temp API.  Remove before release. */
-svn_error_t *
-svn_wc__db_temp_base_add_subdir(svn_wc__db_t *db,
-                                const char *local_abspath,
-                                const char *repos_relpath,
-                                const char *repos_root_url,
-                                const char *repos_uuid,
-                                svn_revnum_t revision,
-                                const apr_hash_t *props,
-                                svn_revnum_t changed_rev,
-                                apr_time_t changed_date,
-                                const char *changed_author,
-                                svn_depth_t depth,
-                                apr_pool_t *scratch_pool)
-{
-  svn_wc__db_pdh_t *pdh;
-  const char *local_relpath;
-  apr_int64_t repos_id;
-  insert_base_baton_t ibb;
-
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-  SVN_ERR_ASSERT(repos_relpath != NULL);
-  SVN_ERR_ASSERT(svn_uri_is_absolute(repos_root_url));
-  SVN_ERR_ASSERT(repos_uuid != NULL);
-  SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
-  SVN_ERR_ASSERT(props != NULL);
-  SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(changed_rev));
-
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
-                              local_abspath, svn_sqlite__mode_readwrite,
-                              scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
-
-  SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid,
-                          pdh->wcroot->sdb, scratch_pool));
-
-  ibb.status = svn_wc__db_status_normal;
-  ibb.kind = svn_wc__db_kind_subdir;
-  ibb.wc_id = pdh->wcroot->wc_id;
-  ibb.local_relpath = local_relpath;
-  ibb.repos_id = repos_id;
-  ibb.repos_relpath = repos_relpath;
-  ibb.revision = revision;
-
-  ibb.props = NULL;
-  ibb.changed_rev = changed_rev;
-  ibb.changed_date = changed_date;
-  ibb.changed_author = changed_author;
-
-  ibb.children = NULL;
-  ibb.depth = depth;
-
-  /* ### no children, conflicts, or work items to install in a txn... */
+#endif
 
-  return svn_error_return(insert_base_node(&ibb, pdh->wcroot->sdb,
-                                           scratch_pool));
+  return SVN_NO_ERROR;
 }
 
 
@@ -2061,15 +2008,18 @@ svn_wc__db_base_get_info(svn_wc__db_stat
 
       if (kind)
         {
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir)
             *kind = svn_wc__db_kind_dir;
           else
+#endif
             *kind = node_kind;
         }
       if (status)
         {
           *status = svn_sqlite__column_token(stmt, 2, presence_map);
 
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir
               && *status == svn_wc__db_status_normal)
             {
@@ -2079,6 +2029,7 @@ svn_wc__db_base_get_info(svn_wc__db_stat
                  in some way. Inform the caller.  */
               *status = svn_wc__db_status_obstructed;
             }
+#endif
         }
       if (revision)
         {
@@ -2244,15 +2195,18 @@ svn_wc__db_base_get_info_from_parent(svn
 
       if (kind)
         {
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir)
             *kind = svn_wc__db_kind_dir;
           else
+#endif
             *kind = node_kind;
         }
       if (status)
         {
           *status = svn_sqlite__column_token(stmt, 2, presence_map);
 
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir
               && *status == svn_wc__db_status_normal)
             {
@@ -2262,6 +2216,7 @@ svn_wc__db_base_get_info_from_parent(svn
                  in some way. Inform the caller.  */
               *status = svn_wc__db_status_obstructed;
             }
+#endif
         }
       if (revision)
         {
@@ -2984,7 +2939,10 @@ temp_cross_db_copy(svn_wc__db_t *db,
 
   SVN_ERR_ASSERT(kind == svn_wc__db_kind_file
                  || kind == svn_wc__db_kind_dir
-                 || kind == svn_wc__db_kind_subdir);
+#ifndef SVN_WC__SINGLE_DB
+                 || kind == svn_wc__db_kind_subdir
+#endif
+                 );
 
   SVN_ERR(svn_wc__db_read_info(NULL /* status */,
                                NULL /* kind */,
@@ -5125,6 +5083,7 @@ svn_wc__db_read_info(svn_wc__db_status_t
                               /* && *status != svn_wc__db_status_incomplete */)
                              || !*have_work);
 
+#ifndef SVN_WC__SINGLE_DB
               if (node_kind == svn_wc__db_kind_subdir
                   && *status == svn_wc__db_status_normal)
                 {
@@ -5135,6 +5094,7 @@ svn_wc__db_read_info(svn_wc__db_status_t
                      this value with a proper status.  */
                   *status = svn_wc__db_status_obstructed;
                 }
+#endif
             }
 
           if (*have_work)
@@ -5164,37 +5124,43 @@ svn_wc__db_read_info(svn_wc__db_status_t
                      deletion has occurred because this node has been moved
                      away, or it is a regular deletion. Also note that the
                      deletion could be of the BASE tree, or a child of
-                     something that has been copied/moved here.
+                     something that has been copied/moved here. */
 
-                     If we're looking at the data in the parent, then
+#ifndef SVN_WC__SINGLE_DB
+                  /* If we're looking at the data in the parent, then
                      something has obstructed the child data. Inform
                      the caller.  */
                   if (node_kind == svn_wc__db_kind_subdir)
                     *status = svn_wc__db_status_obstructed_delete;
                   else
+#endif
                     *status = svn_wc__db_status_deleted;
                 }
               else /* normal */
                 {
                   /* The caller should scan upwards to detect whether this
                      addition has occurred because of a simple addition,
-                     a copy, or is the destination of a move.
+                     a copy, or is the destination of a move. */
 
-                     If we're looking at the data in the parent, then
+#ifndef SVN_WC__SINGLE_DB
+                  /* If we're looking at the data in the parent, then
                      something has obstructed the child data. Inform
                      the caller.  */
                   if (node_kind == svn_wc__db_kind_subdir)
                     *status = svn_wc__db_status_obstructed_add;
                   else
+#endif
                     *status = svn_wc__db_status_added;
                 }
             }
         }
       if (kind)
         {
+#ifndef SVN_WC__SINGLE_DB
           if (node_kind == svn_wc__db_kind_subdir)
             *kind = svn_wc__db_kind_dir;
           else
+#endif
             *kind = node_kind;
         }
       if (revision)
@@ -5272,7 +5238,10 @@ svn_wc__db_read_info(svn_wc__db_status_t
       if (depth)
         {
           if (node_kind != svn_wc__db_kind_dir
-                && node_kind != svn_wc__db_kind_subdir)
+#ifndef SVN_WC__SINGLE_DB
+                && node_kind != svn_wc__db_kind_subdir
+#endif
+              )
             {
               *depth = svn_depth_unknown;
             }
@@ -6619,6 +6588,7 @@ svn_wc__db_scan_addition(svn_wc__db_stat
                                      svn_dirent_local_style(local_abspath,
                                                             scratch_pool));
 
+#ifndef SVN_WC__SINGLE_DB
           /* ### in per-dir operation, it is possible that we just fetched
              ### the parent stub. examine the KIND field.
              ###
@@ -6630,6 +6600,7 @@ svn_wc__db_scan_addition(svn_wc__db_stat
                                                               kind_map);
             SVN_ERR_ASSERT(kind != svn_wc__db_kind_subdir);
           }
+#endif
 
           /* Provide the default status; we'll override as appropriate. */
           if (status)

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=991563&r1=991562&r2=991563&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Wed Sep  1 15:10:17 2010
@@ -162,6 +162,7 @@ typedef enum {
        deletion, or incomplete status. */
     svn_wc__db_kind_unknown,
 
+#ifndef SVN_WC__SINGLE_DB
     /* This directory node is a placeholder; the actual information is
        held within the subdirectory.
 
@@ -170,6 +171,7 @@ typedef enum {
 
        ### only used with per-dir .svn subdirectories.  */
     svn_wc__db_kind_subdir
+#endif
 
 } svn_wc__db_kind_t;
 
@@ -2219,28 +2221,6 @@ svn_wc__db_temp_forget_directory(svn_wc_
                                  apr_pool_t *scratch_pool);
 
 
-/* A temporary API similar to svn_wc__db_base_add_directory() and
-   svn_wc__db_base_add_file(), in that it adds a subdirectory to the given
-   DB.  * Arguments are the same as those to svn_wc__db_base_add_directory().
-
-   Note: Since the subdir node type is a fiction created to satisfy our
-   current backward-compat hacks, this is a temporary API expected to
-   disappear with that node type does.
-*/
-svn_error_t *
-svn_wc__db_temp_base_add_subdir(svn_wc__db_t *db,
-                                const char *local_abspath,
-                                const char *repos_relpath,
-                                const char *repos_root_url,
-                                const char *repos_uuid,
-                                svn_revnum_t revision,
-                                const apr_hash_t *props,
-                                svn_revnum_t changed_rev,
-                                apr_time_t changed_date,
-                                const char *changed_author,
-                                svn_depth_t depth,
-                                apr_pool_t *scratch_pool);
-
 svn_error_t *
 svn_wc__db_temp_is_dir_deleted(svn_boolean_t *not_present,
                                svn_revnum_t *base_revision,