subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1069149 - in /subversion/trunk/subversion/libsvn_wc: wc_db.c wc_db_pdh.c wc_db_private.h
Date Wed, 09 Feb 2011 22:22:32 GMT
Author: hwright
Date: Wed Feb  9 22:22:32 2011
New Revision: 1069149

URL: http://svn.apache.org/viewvc?rev=1069149&view=rev
Log:
Allow wc_db APIs to request only a wcroot, instead of a full pdh.  Since the
introduction of single-db, many of the various APIs don't need a full PDH,
just access to the wcroot (which may then be the same between many directories).

(This change doesn't actually make the fetching to wcroot more efficient,
but it does make it possible to do so later on.)

* subversion/libsvn_wc/wc_db_pdh.c
  (svn_wc__db_wcroot_parse_local_abspath): New.

* subversion/libsvn_wc/wc_db_private.h
  (svn_wc__db_wcroot_parse_local_abspath): New.
  (VERIFY_USABLE_WCROOT): New.

* subversion/libsvn_wc/wc_db.c
  (get_statement_for_path): Use the new function to retrieve only a wcroot.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db_pdh.c
    subversion/trunk/subversion/libsvn_wc/wc_db_private.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=1069149&r1=1069148&r2=1069149&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Feb  9 22:22:32 2011
@@ -554,18 +554,18 @@ get_statement_for_path(svn_sqlite__stmt_
                        int stmt_idx,
                        apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
+  svn_wc__db_wcroot_t *wcroot;
   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,
+  SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
                               local_abspath, svn_sqlite__mode_readwrite,
                               scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
+  VERIFY_USABLE_WCROOT(wcroot);
 
-  SVN_ERR(svn_sqlite__get_statement(stmt, pdh->wcroot->sdb, stmt_idx));
-  SVN_ERR(svn_sqlite__bindf(*stmt, "is", pdh->wcroot->wc_id, local_relpath));
+  SVN_ERR(svn_sqlite__get_statement(stmt, wcroot->sdb, stmt_idx));
+  SVN_ERR(svn_sqlite__bindf(*stmt, "is", wcroot->wc_id, local_relpath));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_pdh.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_pdh.c?rev=1069149&r1=1069148&r2=1069149&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_pdh.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_pdh.c Wed Feb  9 22:22:32 2011
@@ -622,6 +622,29 @@ svn_wc__db_pdh_parse_local_abspath(svn_w
 }
 
 svn_error_t *
+svn_wc__db_wcroot_parse_local_abspath(svn_wc__db_wcroot_t **wcroot,
+                                      const char **local_relpath,
+                                      svn_wc__db_t *db,
+                                      const char *local_abspath,
+                                      svn_sqlite__mode_t smode,
+                                      apr_pool_t *result_pool,
+                                      apr_pool_t *scratch_pool)
+{
+  svn_wc__db_pdh_t *pdh;
+
+  /* Ideally, we'd only grab the PDH if requested, rather than unconditionally.
+     That is, we'd call this function from pdh_parse_local_abspath(), instead
+     of the other way around.  However, for the time being, we're going to
+     go with short and simple here. */
+  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, local_relpath, db,
+                                             local_abspath, smode, result_pool,
+                                             scratch_pool));
+  *wcroot = pdh->wcroot;
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_wc__db_pdh_navigate_to_parent(svn_wc__db_pdh_t **parent_pdh,
                                   svn_wc__db_t *db,
                                   svn_wc__db_pdh_t *child_pdh,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_private.h?rev=1069149&r1=1069148&r2=1069149&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_private.h Wed Feb  9 22:22:32 2011
@@ -159,6 +159,17 @@ svn_wc__db_pdh_parse_local_abspath(svn_w
                                    apr_pool_t *result_pool,
                                    apr_pool_t *scratch_pool);
 
+/* Similar to svn_wc__db_pdh_parse_local_abspath(), but only return the WCROOT,
+   rather than a full PDH. */
+svn_error_t *
+svn_wc__db_wcroot_parse_local_abspath(svn_wc__db_wcroot_t **wcroot,
+                                      const char **local_relpath,
+                                      svn_wc__db_t *db,
+                                      const char *local_abspath,
+                                      svn_sqlite__mode_t smode,
+                                      apr_pool_t *result_pool,
+                                      apr_pool_t *scratch_pool);
+
 /* POOL may be NULL if the lifetime of LOCAL_ABSPATH is sufficient.  */
 const char *
 svn_wc__db_pdh_compute_relpath(const svn_wc__db_pdh_t *pdh,
@@ -179,6 +190,11 @@ svn_wc__db_pdh_navigate_to_parent(svn_wc
     (pdh)->wcroot != NULL                       \
     && (pdh)->wcroot->format == SVN_WC__VERSION)
 
+/* Assert that the given WCROOT is usable.
+   NOTE: the expression is multiply-evaluated!!  */
+#define VERIFY_USABLE_WCROOT(wcroot)  SVN_ERR_ASSERT(               \
+    (wcroot) != NULL && (wcroot)->format == SVN_WC__VERSION)
+
 /* */
 svn_error_t *
 svn_wc__db_util_fetch_wc_id(apr_int64_t *wc_id,



Mime
View raw message