You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/04/04 16:01:55 UTC

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

Author: rhuijben
Date: Mon Apr  4 14:01:54 2011
New Revision: 1088628

URL: http://svn.apache.org/viewvc?rev=1088628&view=rev
Log:
Add a wc_db helper function that retrieves all the information that is
necessary to install/compare a working copy file to/from its pristine
version.

This function will be used to speed up several install compare functions that
currently use multiple transactions to gather this information.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_read_node_install_info): New function.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_read_node_install_info): New function.

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=1088628&r1=1088627&r2=1088628&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon Apr  4 14:01:54 2011
@@ -5354,6 +5354,65 @@ svn_wc__db_read_children_walker_info(apr
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc__db_read_node_install_info(const char **wcroot_abspath,
+                                  svn_wc__db_status_t *status,
+                                  svn_wc__db_kind_t *kind,
+                                  const svn_checksum_t **sha1_checksum,
+                                  const char **target,
+                                  apr_hash_t **pristine_props,
+                                  svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  apr_pool_t *result_pool,
+                                  apr_pool_t *scratch_pool)
+{
+  svn_wc__db_wcroot_t *wcroot;
+  const char *local_relpath;
+  svn_sqlite__stmt_t *stmt;
+  svn_error_t *err = NULL;
+
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
+                              local_abspath, scratch_pool, scratch_pool));
+  VERIFY_USABLE_WCROOT(wcroot);
+
+  if (wcroot_abspath != NULL)
+    *wcroot_abspath = apr_pstrdup(result_pool, wcroot->abspath);
+
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+                                    STMT_SELECT_NODE_INFO));
+
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+
+  SVN_ERR(svn_sqlite__step_row(stmt)); /* Row must exist */
+
+  if (status)
+    {
+      apr_int64_t op_depth = svn_sqlite__column_int64(stmt, 0);
+
+      *status = svn_sqlite__column_token(stmt, 3, presence_map);
+
+      if (op_depth > 0)
+        err = convert_to_working_status(status, *status);
+    }
+
+  if (kind)
+    *kind = svn_sqlite__column_token(stmt, 4, kind_map);
+
+  if (!err && sha1_checksum)
+    err = svn_sqlite__column_checksum(sha1_checksum, stmt, 6, result_pool);
+
+  if (target)
+    *target = svn_sqlite__column_text(stmt, 12, result_pool);
+
+  if (!err && pristine_props)
+    err = svn_sqlite__column_properties(pristine_props, stmt, 14, result_pool,
+                                        scratch_pool);
+
+  return svn_error_compose_create(err,
+                                  svn_sqlite__reset(stmt));
+}
+
+
 
 struct read_url_baton_t {
   const char **url;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1088628&r1=1088627&r2=1088628&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Mon Apr  4 14:01:54 2011
@@ -1573,6 +1573,24 @@ struct svn_wc__db_walker_info_t {
   svn_wc__db_kind_t kind;
 };
 
+/* Gets the information required to install a pristine file to the working copy
+
+   Set WCROOT_ABSPATH to the working copy root, STATUS to the presence of the
+   node, KIND to the node kind, SHA1_CHECKSUM to the checksum of the node
+   (a valid reference into the pristine store) and PRISTINE_PROPS to the node's
+   pristine properties (to use for installing the file). */
+svn_error_t *
+svn_wc__db_read_node_install_info(const char **wcroot_abspath,
+                                  svn_wc__db_status_t *status,
+                                  svn_wc__db_kind_t *kind,
+                                  const svn_checksum_t **sha1_checksum,
+                                  const char **target,
+                                  apr_hash_t **pristine_props,
+                                  svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  apr_pool_t *result_pool,
+                                  apr_pool_t *scratch_pool);
+
 /* Return in *NODES a hash mapping name->struct svn_wc__db_walker_info_t for
    the children of DIR_ABSPATH. "name" is the child's name relatve to
    DIR_ABSPATH, not an absolute path. */