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/10/25 19:01:47 UTC

svn commit: r1027197 - /subversion/trunk/subversion/libsvn_wc/wc_db.c

Author: julianfoad
Date: Mon Oct 25 17:01:46 2010
New Revision: 1027197

URL: http://svn.apache.org/viewvc?rev=1027197&view=rev
Log:
Create and use a local version of svn_wc__db_temp_elide_copyfrom() that
takes a PDH and relpath instead of DB and abspath.

* subversion/libsvn_wc/wc_db.c
  (elide_copyfrom): New function, extracted from ...
  (svn_wc__db_temp_elide_copyfrom): ... here, which now calls it.
  (svn_wc__db_op_copy): Use elide_copyfrom().
  (get_copyfrom): Take PDH and relpath instead of DB and abspath.

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

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1027197&r1=1027196&r2=1027197&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Oct 25 17:01:46 2010
@@ -271,6 +271,11 @@ read_info(svn_wc__db_status_t *status,
           apr_pool_t *result_pool,
           apr_pool_t *scratch_pool);
 
+static svn_error_t *
+elide_copyfrom(svn_wc__db_pdh_t *pdh,
+               const char *local_relpath,
+               apr_pool_t *scratch_pool);
+
 
 /* Return the absolute path, in local path style, of LOCAL_RELPATH in WCROOT. */
 static const char *
@@ -3045,7 +3050,7 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
     }
 
   /* ### Should do this earlier and insert the node with the right values. */
-  SVN_ERR(svn_wc__db_temp_elide_copyfrom(db, dst_abspath, scratch_pool));
+  SVN_ERR(elide_copyfrom(dst_pdh, dst_relpath, scratch_pool));
 
   SVN_ERR(add_work_items(dst_pdh->wcroot->sdb, work_items, scratch_pool));
  
@@ -8235,24 +8240,14 @@ static svn_error_t *
 get_copyfrom(apr_int64_t *copyfrom_repos_id,
              const char **copyfrom_relpath,
              svn_revnum_t *copyfrom_revnum,
-             svn_wc__db_t *db,
-             const char *local_abspath,
+             svn_wc__db_pdh_t *pdh,
+             const char *local_relpath,
              apr_pool_t *result_pool,
              apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
-  const char *local_relpath;
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
 
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-
-  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(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
                                     STMT_SELECT_WORKING_NODE));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
@@ -8269,13 +8264,13 @@ get_copyfrom(apr_int64_t *copyfrom_repos
   if (svn_sqlite__column_is_null(stmt, 10 /* copyfrom_repos_id */))
     {
       /* Resolve inherited copyfrom */
-      const char *parent_abspath, *name, *parent_copyfrom_relpath;
+      const char *parent_relpath, *name, *parent_copyfrom_relpath;
 
       SVN_ERR(svn_sqlite__reset(stmt));
-      svn_dirent_split(&parent_abspath, &name, local_abspath, scratch_pool);
+      svn_relpath_split(&parent_relpath, &name, local_relpath, scratch_pool);
       SVN_ERR(get_copyfrom(copyfrom_repos_id, &parent_copyfrom_relpath,
                            copyfrom_revnum,
-                           db, parent_abspath, scratch_pool, scratch_pool));
+                           pdh, parent_relpath, scratch_pool, scratch_pool));
       if (parent_copyfrom_relpath)
         *copyfrom_relpath = svn_relpath_join(parent_copyfrom_relpath, name,
                                              result_pool);
@@ -8294,32 +8289,23 @@ get_copyfrom(apr_int64_t *copyfrom_repos
 }
 
 
-svn_error_t *
-svn_wc__db_temp_elide_copyfrom(svn_wc__db_t *db,
-                               const char *local_abspath,
-                               apr_pool_t *scratch_pool)
+static svn_error_t *
+elide_copyfrom(svn_wc__db_pdh_t *pdh,
+               const char *local_relpath,
+               apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
-  const char *local_relpath;
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
   apr_int64_t original_repos_id;
   const char *original_repos_relpath;
   svn_revnum_t original_revision;
-  const char *parent_abspath;
+  const char *parent_local_relpath;
   const char *name;
   apr_int64_t parent_repos_id;
   const char *parent_repos_relpath;
   svn_revnum_t parent_revision;
   const char *implied_relpath;
 
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
-
-  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);
-
   /* Examine the current WORKING_NODE row's copyfrom information. If there
      is no WORKING node, then simply exit.  */
   SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
@@ -8340,11 +8326,11 @@ svn_wc__db_temp_elide_copyfrom(svn_wc__d
 
   SVN_ERR(svn_sqlite__reset(stmt));
 
-  svn_dirent_split(&parent_abspath, &name, local_abspath, scratch_pool);
+  svn_dirent_split(&parent_local_relpath, &name, local_relpath, scratch_pool);
 
   SVN_ERR(get_copyfrom(&parent_repos_id, &parent_repos_relpath,
                        &parent_revision,
-                       db, parent_abspath, scratch_pool, scratch_pool));
+                       pdh, parent_local_relpath, scratch_pool, scratch_pool));
   if (parent_revision == SVN_INVALID_REVNUM)
     return SVN_NO_ERROR;
 
@@ -8388,6 +8374,27 @@ svn_wc__db_temp_elide_copyfrom(svn_wc__d
 
 
 svn_error_t *
+svn_wc__db_temp_elide_copyfrom(svn_wc__db_t *db,
+                               const char *local_abspath,
+                               apr_pool_t *scratch_pool)
+{
+  svn_wc__db_pdh_t *pdh;
+  const char *local_relpath;
+
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+  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(elide_copyfrom(pdh, local_relpath, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
 svn_wc__db_temp_get_file_external(const char **serialized_file_external,
                                   svn_wc__db_t *db,
                                   const char *local_abspath,