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/05/10 20:21:45 UTC
svn commit: r942838 - in /subversion/trunk/subversion/libsvn_wc: wc_db.c
wc_db.h
Author: gstein
Date: Mon May 10 18:21:44 2010
New Revision: 942838
URL: http://svn.apache.org/viewvc?rev=942838&view=rev
Log:
Add initial implementations for wc_db functions to support URL -> WC copies.
* subversion/libsvn_wc/wc_db.h:
(svn_wc__db_op_copy_url): removed, per prior comments
(svn_wc__db_op_copy_dir, svn_wc__db_op_copy_file,
svn_wc__db_op_copy_symlink): new declarations
* subversion/libsvn_wc/wc_db.c:
(svn_wc__db_op_copy_dir, svn_wc__db_op_copy_file,
svn_wc__db_op_copy_symlink): new implementations. most of their
functionality was already present with insert_working_node and its
supporting baton.
(svn_wc__db_to_relpath): assert the path is absolute
(svn_wc__db_from_relpath): we probably want to assert the provided path
is canonical. open Q is whether the abspath we built this from was in
canonical form.
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=942838&r1=942837&r2=942838&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon May 10 18:21:44 2010
@@ -1766,6 +1766,8 @@ svn_wc__db_to_relpath(const char **local
{
svn_wc__db_pdh_t *pdh;
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+
SVN_ERR(parse_local_abspath(&pdh, local_relpath, db, local_abspath,
svn_sqlite__mode_readonly,
result_pool, scratch_pool));
@@ -1786,6 +1788,10 @@ svn_wc__db_from_relpath(const char **loc
svn_wc__db_pdh_t *pdh;
const char *unused_relpath;
+#if 0
+ SVN_ERR_ASSERT(svn_relpath_is_canonical(local_abspath));
+#endif
+
SVN_ERR(parse_local_abspath(&pdh, &unused_relpath, db, wri_abspath,
svn_sqlite__mode_readonly,
scratch_pool, scratch_pool));
@@ -2734,21 +2740,229 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
svn_error_t *
-svn_wc__db_op_copy_url(svn_wc__db_t *db,
+svn_wc__db_op_copy_dir(svn_wc__db_t *db,
const char *local_abspath,
- const char *copyfrom_repos_relpath,
- const char *copyfrom_root_url,
- const char *copyfrom_uuid,
- svn_revnum_t copyfrom_revision,
+ const apr_hash_t *props,
+ svn_revnum_t changed_rev,
+ apr_time_t changed_date,
+ const char *changed_author,
+ const char *original_repos_relpath,
+ const char *original_root_url,
+ const char *original_uuid,
+ svn_revnum_t original_revision,
+ const apr_array_header_t *children,
+ svn_depth_t depth,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
+ svn_wc__db_pdh_t *pdh;
+ const char *local_relpath;
+ insert_working_baton_t iwb;
+ apr_int64_t original_repos_id;
+
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
- SVN_ERR_ASSERT(copyfrom_repos_relpath != NULL);
- SVN_ERR_ASSERT(svn_uri_is_absolute(copyfrom_root_url));
- SVN_ERR_ASSERT(copyfrom_uuid != NULL);
- SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(copyfrom_revision));
+ SVN_ERR_ASSERT(props != NULL);
+ /* ### any assertions for CHANGED_* ? */
+ /* ### any assertions for ORIGINAL_* ? */
+#if 0
+ SVN_ERR_ASSERT(children != NULL);
+#endif
+ SVN_ERR_ASSERT(conflict == NULL); /* ### can't handle yet */
- NOT_IMPLEMENTED();
+ SVN_ERR(parse_local_abspath(&pdh, &local_relpath, db, local_abspath,
+ svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ SVN_ERR(create_repos_id(&original_repos_id,
+ original_root_url, original_uuid,
+ pdh->wcroot->sdb, scratch_pool));
+
+ blank_iwb(&iwb);
+
+ iwb.presence = svn_wc__db_status_normal;
+ iwb.kind = svn_wc__db_kind_dir;
+ iwb.wc_id = pdh->wcroot->wc_id;
+ iwb.local_relpath = local_relpath;
+
+ iwb.props = props;
+ iwb.changed_rev = changed_rev;
+ iwb.changed_date = changed_date;
+ iwb.changed_author = changed_author;
+ iwb.original_repos_id = original_repos_id;
+ iwb.original_repos_relpath = original_repos_relpath;
+ iwb.original_revnum = original_revision;
+ iwb.moved_here = FALSE;
+
+ iwb.children = children;
+ iwb.depth = depth;
+
+ iwb.work_items = work_items;
+
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ insert_working_node, &iwb,
+ scratch_pool));
+ flush_entries(pdh);
+
+ /* Add a parent stub. */
+ {
+ svn_error_t *err;
+
+ err = navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readwrite,
+ scratch_pool);
+ if (err)
+ {
+ /* Prolly fell off the top of the wcroot. Just call it a day. */
+ svn_error_clear(err);
+ return SVN_NO_ERROR;
+ }
+
+ blank_iwb(&iwb);
+
+ iwb.presence = svn_wc__db_status_normal;
+ iwb.kind = svn_wc__db_kind_subdir;
+ iwb.wc_id = pdh->wcroot->wc_id;
+ iwb.local_relpath = svn_dirent_basename(local_abspath, scratch_pool);
+
+ /* No children or work items, so a txn is not needed. */
+ SVN_ERR(insert_working_node(&iwb, pdh->wcroot->sdb, scratch_pool));
+ flush_entries(pdh);
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_wc__db_op_copy_file(svn_wc__db_t *db,
+ const char *local_abspath,
+ const apr_hash_t *props,
+ svn_revnum_t changed_rev,
+ apr_time_t changed_date,
+ const char *changed_author,
+ const char *original_repos_relpath,
+ const char *original_root_url,
+ const char *original_uuid,
+ svn_revnum_t original_revision,
+ const svn_checksum_t *checksum,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *local_relpath;
+ insert_working_baton_t iwb;
+ apr_int64_t original_repos_id;
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+ SVN_ERR_ASSERT(props != NULL);
+ /* ### any assertions for CHANGED_* ? */
+ /* ### any assertions for ORIGINAL_* ? */
+ SVN_ERR_ASSERT(checksum != NULL);
+ SVN_ERR_ASSERT(conflict == NULL); /* ### can't handle yet */
+
+ SVN_ERR(parse_local_abspath(&pdh, &local_relpath, db, local_abspath,
+ svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ SVN_ERR(create_repos_id(&original_repos_id,
+ original_root_url, original_uuid,
+ pdh->wcroot->sdb, scratch_pool));
+
+ blank_iwb(&iwb);
+
+ iwb.presence = svn_wc__db_status_normal;
+ iwb.kind = svn_wc__db_kind_file;
+ iwb.wc_id = pdh->wcroot->wc_id;
+ iwb.local_relpath = local_relpath;
+
+ iwb.props = props;
+ iwb.changed_rev = changed_rev;
+ iwb.changed_date = changed_date;
+ iwb.changed_author = changed_author;
+ iwb.original_repos_id = original_repos_id;
+ iwb.original_repos_relpath = original_repos_relpath;
+ iwb.original_revnum = original_revision;
+ iwb.moved_here = FALSE;
+
+ iwb.checksum = checksum;
+
+ iwb.work_items = work_items;
+
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ insert_working_node, &iwb,
+ scratch_pool));
+ flush_entries(pdh);
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_wc__db_op_copy_symlink(svn_wc__db_t *db,
+ const char *local_abspath,
+ const apr_hash_t *props,
+ svn_revnum_t changed_rev,
+ apr_time_t changed_date,
+ const char *changed_author,
+ const char *original_repos_relpath,
+ const char *original_root_url,
+ const char *original_uuid,
+ svn_revnum_t original_revision,
+ const char *target,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *local_relpath;
+ insert_working_baton_t iwb;
+ apr_int64_t original_repos_id;
+
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
+ SVN_ERR_ASSERT(props != NULL);
+ /* ### any assertions for CHANGED_* ? */
+ /* ### any assertions for ORIGINAL_* ? */
+ SVN_ERR_ASSERT(target != NULL);
+ SVN_ERR_ASSERT(conflict == NULL); /* ### can't handle yet */
+
+ SVN_ERR(parse_local_abspath(&pdh, &local_relpath, db, local_abspath,
+ svn_sqlite__mode_readwrite,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ SVN_ERR(create_repos_id(&original_repos_id,
+ original_root_url, original_uuid,
+ pdh->wcroot->sdb, scratch_pool));
+
+ blank_iwb(&iwb);
+
+ iwb.presence = svn_wc__db_status_normal;
+ iwb.kind = svn_wc__db_kind_symlink;
+ iwb.wc_id = pdh->wcroot->wc_id;
+ iwb.local_relpath = local_relpath;
+
+ iwb.props = props;
+ iwb.changed_rev = changed_rev;
+ iwb.changed_date = changed_date;
+ iwb.changed_author = changed_author;
+ iwb.original_repos_id = original_repos_id;
+ iwb.original_repos_relpath = original_repos_relpath;
+ iwb.original_revnum = original_revision;
+ iwb.moved_here = FALSE;
+
+ iwb.target = target;
+
+ iwb.work_items = work_items;
+
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ insert_working_node, &iwb,
+ scratch_pool));
+ flush_entries(pdh);
+
+ return SVN_NO_ERROR;
}
@@ -2791,7 +3005,7 @@ svn_wc__db_op_add_directory(svn_wc__db_t
scratch_pool);
if (err)
{
- /* Prolly fell off teh top of the wcroot. Just call it a day. */
+ /* Prolly fell off the top of the wcroot. Just call it a day. */
svn_error_clear(err);
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=942838&r1=942837&r2=942838&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Mon May 10 18:21:44 2010
@@ -1002,27 +1002,71 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
apr_pool_t *scratch_pool);
-/* ### svn cp URL WCPATH ... copies pure repos into wc. only this "root"
- ### metadata is present. caller needs to "set" all information recursively.
- ### and caller definitely has to populate ACTUAL. */
-/* ### mark node as absent? adding children or props: auto-convert away
- ### from absent? ... or not "absent" but an "incomplete" status? */
-/* ### this needs to be split out into four functions to add nodes of each
- ### kind. records copyfrom_* history, changed_* values, incomplete
- ### children, properties, checksum values, etc. clients should construct
- ### the full copied tree (maybe DEPTH can be used to avoid creating
- ### nodes for all children?). for the child nodes, their copyfrom_*
- ### information should be NULL. */
+/* Record a copy at LOCAL_ABSPATH from a repository directory.
+
+ This copy is NOT recursive. It simply establishes this one node.
+ CHILDREN must be provided, and incomplete nodes will be constructed
+ for them.
+
+ ### arguments docco. */
svn_error_t *
-svn_wc__db_op_copy_url(svn_wc__db_t *db,
+svn_wc__db_op_copy_dir(svn_wc__db_t *db,
const char *local_abspath,
- const char *copyfrom_repos_relpath,
- const char *copyfrom_root_url,
- const char *copyfrom_uuid,
- svn_revnum_t copyfrom_revision,
+ const apr_hash_t *props,
+ svn_revnum_t changed_rev,
+ apr_time_t changed_date,
+ const char *changed_author,
+ const char *original_repos_relpath,
+ const char *original_root_url,
+ const char *original_uuid,
+ svn_revnum_t original_revision,
+ const apr_array_header_t *children,
+ svn_depth_t depth,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
+/* Record a copy at LOCAL_ABSPATH from a repository file.
+
+ ### arguments docco. */
+svn_error_t *
+svn_wc__db_op_copy_file(svn_wc__db_t *db,
+ const char *local_abspath,
+ const apr_hash_t *props,
+ svn_revnum_t changed_rev,
+ apr_time_t changed_date,
+ const char *changed_author,
+ const char *original_repos_relpath,
+ const char *original_root_url,
+ const char *original_uuid,
+ svn_revnum_t original_revision,
+ const svn_checksum_t *checksum,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool);
+
+
+svn_error_t *
+svn_wc__db_op_copy_symlink(svn_wc__db_t *db,
+ const char *local_abspath,
+ const apr_hash_t *props,
+ svn_revnum_t changed_rev,
+ apr_time_t changed_date,
+ const char *changed_author,
+ const char *original_repos_relpath,
+ const char *original_root_url,
+ const char *original_uuid,
+ svn_revnum_t original_revision,
+ const char *target,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool);
+
+
+/* ### do we need svn_wc__db_op_copy_absent() ?? */
+
+
/* ### add a new versioned directory. a list of children is NOT passed
### since they are added in future, distinct calls to db_op_add_*.
### this is freshly added, so it has no properties. */