You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/04/09 02:53:36 UTC
svn commit: r932205 - in /subversion/trunk/subversion:
include/private/svn_wc_private.h libsvn_wc/entries.c libsvn_wc/node.c
libsvn_wc/wc.h libsvn_wc/wc_db.c libsvn_wc/wc_db.h
Author: gstein
Date: Fri Apr 9 00:53:36 2010
New Revision: 932205
URL: http://svn.apache.org/viewvc?rev=932205&view=rev
Log:
Provide a wc_db temporary function for fetching serialized file externals,
and update entries.c to use this (rather than fetching manually). Add a
node query function to determine whether a given node is a file external
(typically, all we need to know).
* subversion/libsvn_wc/wc_db.h:
(svn_wc__db_temp_get_file_external): new declaration
* subversion/libsvn_wc/wc_db.c:
(svn_wc__db_temp_get_file_external): new implementation. be wary that
our current database state can be erroneous, so we don't want to raise
an error just yet.
* subversion/libsvn_wc/entries.c:
(check_file_external): rebuild the implementation, and update the params
to reflect the data we need.
(read_entries_new): pass new params to check_file_external()
* subversion/libsvn_wc/wc.h:
(svn_wc__internal_is_file_external): new declaration
* subversion/libsvn_wc/node.c:
(svn_wc__internal_is_file_external): new implementation, based on the
wc_db API.
(svn_wc__node_is_file_external): wrapper around above
* subversion/include/private/svn_wc_private.h:
(svn_wc__node_is_file_external): new declaration
Modified:
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_wc/entries.c
subversion/trunk/subversion/libsvn_wc/node.c
subversion/trunk/subversion/libsvn_wc/wc.h
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=932205&r1=932204&r2=932205&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Fri Apr 9 00:53:36 2010
@@ -502,6 +502,18 @@ svn_wc__node_get_lock_token(const char *
apr_pool_t *scratch_pool);
+/* Return TRUE in *FILE_EXTERNAL if the node LOCAL_ABSPATH is a file
+ external.
+
+ If the node does not exist in BASE, then SVN_ERR_WC_PATH_NOT_FOUND
+ will be returned. */
+svn_error_t *
+svn_wc__node_is_file_external(svn_boolean_t *file_external,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool);
+
+
/**
* Recursively acquire write locks for @a local_abspath if
* @a anchor_abspath is NULL. If @a anchor_abspath is not NULL then
Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=932205&r1=932204&r2=932205&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Fri Apr 9 00:53:36 2010
@@ -198,31 +198,27 @@ fetch_wc_id(apr_int64_t *wc_id, svn_sqli
entry. The entry will be modified in place. */
static svn_error_t *
check_file_external(svn_wc_entry_t *entry,
- svn_sqlite__db_t *sdb,
- apr_pool_t *result_pool)
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
+ const char *serialized;
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_SELECT_FILE_EXTERNAL));
- SVN_ERR(svn_sqlite__bindf(stmt, "is",
- (apr_uint64_t)1 /* wc_id */,
- entry->name));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
- if (!svn_sqlite__column_is_null(stmt, 0))
+ SVN_ERR(svn_wc__db_temp_get_file_external(&serialized,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+ if (serialized != NULL)
{
SVN_ERR(svn_wc__unserialize_file_external(
&entry->file_external_path,
&entry->file_external_peg_rev,
&entry->file_external_rev,
- svn_sqlite__column_text(stmt, 0, NULL),
+ serialized,
result_pool));
-
}
- return svn_error_return(svn_sqlite__reset(stmt));
+ return SVN_NO_ERROR;
}
@@ -1110,7 +1106,8 @@ read_entries_new(apr_hash_t **result_ent
### right now this is ugly, since we have no good way querying
### for a file external OR retrieving properties. ugh. */
if (entry->kind == svn_node_file)
- SVN_ERR(check_file_external(entry, sdb, result_pool));
+ SVN_ERR(check_file_external(entry, db, entry_abspath, result_pool,
+ iterpool));
entry->working_size = translated_size;
Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=932205&r1=932204&r2=932205&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Fri Apr 9 00:53:36 2010
@@ -645,3 +645,33 @@ svn_wc__node_get_lock_token(const char *
return SVN_NO_ERROR;
}
+
+
+svn_error_t *
+svn_wc__internal_is_file_external(svn_boolean_t *file_external,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool)
+{
+ const char *serialized;
+
+ SVN_ERR(svn_wc__db_temp_get_file_external(&serialized,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+ *file_external = (serialized != NULL);
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_wc__node_is_file_external(svn_boolean_t *file_external,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_return(svn_wc__internal_is_file_external(file_external,
+ wc_ctx->db,
+ local_abspath,
+ scratch_pool));
+}
Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=932205&r1=932204&r2=932205&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Fri Apr 9 00:53:36 2010
@@ -602,6 +602,13 @@ svn_wc__internal_node_get_url(const char
apr_pool_t *scratch_pool);
+svn_error_t *
+svn_wc__internal_is_file_external(svn_boolean_t *file_external,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool);
+
+
/* Upgrade the wc sqlite database given in SDB for the wc located at
WCROOT_ABSPATH. It's current/starting format is given by START_FORMAT.
After the upgrade is complete (to as far as the automatic upgrade will
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=932205&r1=932204&r2=932205&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Apr 9 00:53:36 2010
@@ -7094,7 +7094,10 @@ svn_wc__db_temp_elide_copyfrom(svn_wc__d
/* Now we need to determine if the child's values are derivable from
the parent values. */
- /* If the revision numbers are not the same, then easy exit. */
+ /* If the revision numbers are not the same, then easy exit.
+
+ Note that we *can* have a mixed-rev copied subtree. We don't want
+ to elide the copyfrom information for these cases. */
if (original_revision != parent_revision)
return SVN_NO_ERROR;
@@ -7131,3 +7134,41 @@ svn_wc__db_temp_elide_copyfrom(svn_wc__d
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,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t have_row;
+
+ SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
+ STMT_SELECT_FILE_EXTERNAL, scratch_pool));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+
+ /* ### file externals are pretty bogus right now. they have just a
+ ### WORKING_NODE for a while, eventually settling into just a BASE_NODE.
+ ### until we get all that fixed, let's just not worry about raising
+ ### an error, and just say it isn't a file external. */
+#if 1
+ if (!have_row)
+ *serialized_file_external = NULL;
+ else
+ /* see below: *serialized_file_external = ... */
+#else
+ if (!have_row)
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND,
+ svn_sqlite__reset(stmt),
+ _("'%s' has no BASE_NODE"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+#endif
+
+ *serialized_file_external = svn_sqlite__column_text(stmt, 0, result_pool);
+
+ return svn_error_return(svn_sqlite__reset(stmt));
+}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=932205&r1=932204&r2=932205&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Apr 9 00:53:36 2010
@@ -2122,6 +2122,16 @@ svn_wc__db_temp_elide_copyfrom(svn_wc__d
apr_pool_t *scratch_pool);
+/* Return the serialized file external info (from BASE) for LOCAL_ABSPATH.
+ Stores NULL into SERIALIZED_FILE_EXTERNAL if this node is NOT a file
+ external. If a BASE node does not exist: SVN_ERR_WC_PATH_NOT_FOUND. */
+svn_error_t *
+svn_wc__db_temp_get_file_external(const char **serialized_file_external,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/* @} */