Author: rhuijben
Date: Tue May 10 00:02:30 2011
New Revision: 1101275
URL: http://svn.apache.org/viewvc?rev=1101275&view=rev
Log:
Add more format 29 implementations for file externals.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_external_record_fileinfo): New function.
* subversion/libsvn_wc/wc_db.c
(insert_external_node): Add missing code for inserting work items.
(db_external_remove): New function.
(svn_wc__db_external_remove): Implement using db_external_remove.
(svn_wc__db_external_record_fileinfo): New function.
(svn_wc__db_external_read_pristine_props): Implement for format 29.
* subversion/libsvn_wc/wc-queries.sql
(STMT_UPDATE_EXTERNAL_FILEINFO): New query.
(STMT_DELETE_EXTERNAL): New query.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1101275&r1=1101274&r2=1101275&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue May 10 00:02:30
2011
@@ -849,6 +849,14 @@ FROM externals WHERE wc_id = ?1 AND pare
SELECT local_relpath
FROM externals WHERE wc_id = ?1 AND def_local_relpath = ?2
+-- STMT_UPDATE_EXTERNAL_FILEINFO
+UPDATE externals SET recorded_size = ?3, recorded_mod_time = ?4
+WHERE wc_id = ?1 AND local_relpath = ?2
+
+-- STMT_DELETE_EXTERNAL
+DELETE FROM externals
+WHERE wc_id = ?1 AND local_relpath = ?2
+
/* ------------------------------------------------------------------------- */
/* these are used in entries.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=1101275&r1=1101274&r2=1101275&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue May 10 00:02:30 2011
@@ -2675,6 +2675,9 @@ insert_external_node(void *baton,
SVN_ERR(svn_sqlite__bind_revnum(stmt, 15, ieb->recorded_revision));
SVN_ERR(svn_sqlite__insert(NULL, stmt));
+ /* ### TODO: Implement keeping recorded info */
+
+ SVN_ERR(add_work_items(wcroot->sdb, ieb->work_items, scratch_pool));
return SVN_NO_ERROR;
#endif
@@ -2897,6 +2900,21 @@ svn_wc__db_external_add_dir(svn_wc__db_t
&ieb, scratch_pool));
}
+static svn_error_t *
+db_external_remove(void *baton, svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath, apr_pool_t *scratch_pool)
+{
+ svn_sqlite__stmt_t *stmt;
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_DELETE_EXTERNAL));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ /* ### What about actual? */
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_wc__db_external_remove(svn_wc__db_t *db,
const char *local_abspath,
@@ -2926,9 +2944,44 @@ svn_wc__db_external_remove(svn_wc__db_t
return SVN_NO_ERROR;
#else
- NOT_IMPLEMENTED();
+ SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_external_remove, NULL,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
#endif
}
+
+svn_error_t *
+svn_wc__db_external_record_fileinfo(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *wri_abspath,
+ svn_filesize_t recorded_size,
+ apr_time_t recorded_mod_time,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_wcroot_t *wcroot;
+ const char *local_relpath;
+ svn_sqlite__stmt_t *stmt;
+ int affected_rows;
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
+ SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,
+ local_abspath, scratch_pool, scratch_pool));
+ VERIFY_USABLE_WCROOT(wcroot);
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_UPDATE_EXTERNAL_FILEINFO));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isii", wcroot->wc_id, local_relpath,
+ recorded_size,
+ recorded_mod_time));
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+ SVN_ERR_ASSERT(affected_rows == 1);
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_wc__db_external_read(svn_wc__db_kind_t *kind,
svn_revnum_t *revision,
@@ -3166,6 +3219,11 @@ svn_wc__db_external_read_pristine_props(
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
+#if SVN_WC__VERSION >= SVN_WC__HAS_EXTERNALS_STORE
+ svn_sqlite__stmt_t *stmt;
+ svn_boolean_t have_row;
+ svn_error_t *err;
+#endif
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -3186,7 +3244,40 @@ svn_wc__db_external_read_pristine_props(
result_pool,
scratch_pool));
#else
- NOT_IMPLEMENTED();
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_EXTERNAL_INFO));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
+
+ if (have_row)
+ {
+ svn_wc__db_kind_t kind = svn_sqlite__column_token(stmt, 0, kind_map);
+
+ if (kind != svn_wc__db_kind_file
+ && kind != svn_wc__db_kind_symlink)
+ {
+ err = svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+ _("The node '%s' is not a file external."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
+ else
+ err = svn_sqlite__column_properties(props, stmt, 6, result_pool,
+ scratch_pool);
+
+ if (props && !*props)
+ *props = apr_hash_make(result_pool);
+ }
+ else
+ {
+ err = svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+ _("The node '%s' is not an external."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
+
+ return svn_error_return(svn_error_compose_create(err,
+ svn_sqlite__reset(stmt)));
#endif
}
@@ -11751,7 +11842,8 @@ has_local_mods(svn_boolean_t *is_modifie
{
SVN_ERR(svn_wc__internal_file_modified_p(is_modified, NULL,
NULL, db, node_abspath,
- FALSE, TRUE, iterpool));
+ FALSE, TRUE, NULL,
+ iterpool));
if (*is_modified)
break;
}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1101275&r1=1101274&r2=1101275&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue May 10 00:02:30 2011
@@ -1108,6 +1108,16 @@ svn_wc__db_external_add_dir(svn_wc__db_t
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
+/* Record the specified size and timestamp for the file external LOCAL_ABSPATH
+ in the working copy identified by WRI_ABSPATH */
+svn_error_t *
+svn_wc__db_external_record_fileinfo(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *wri_abspath,
+ svn_filesize_t recorded_size,
+ apr_time_t recorded_mod_time,
+ apr_pool_t *scratch_pool);
+
/* Remove a registered external LOCAL_ABSPATH from the working copy identified
by WRI_ABSPATH.
*/