Author: rhuijben
Date: Sun May 8 11:16:56 2011
New Revision: 1100721
URL: http://svn.apache.org/viewvc?rev=1100721&view=rev
Log:
Following up on r1100714 enable the file external crawler for updating/
switching file externals.
* subversion/include/svn_wc.h
(svn_wc_restore): Document the result on two error condition.
* subversion/libsvn_client/externals.c
(switch_file_external): Update caller.
* subversion/libsvn_wc/adm_crawler.c
(svn_wc_restore): Return a recognizable error on a status where nodes
can't be restored instead of the same error.
Update condition to handle the statee that we can restore instead of
the statees that we can't. Allow restoring an added directory.
* subversion/libsvn_wc/externals.c
(svn_wc__crawl_file_external): Implement restoring files.
(I don't think we need it here, but it keeps things compatible)
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/externals.c
subversion/trunk/subversion/libsvn_wc/adm_crawler.c
subversion/trunk/subversion/libsvn_wc/externals.c
Modified: subversion/trunk/subversion/include/svn_wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1100721&r1=1100720&r2=1100721&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Sun May 8 11:16:56 2011
@@ -7066,7 +7066,9 @@ svn_wc_revert(const char *path,
* If @a use_commit_times is TRUE, then set restored files' timestamps
* to their last-commit-times.
*
- * ### Before Single-DB this function can only restore missing files.
+ * Returns SVN_ERROR_WC_PATH_NOT_FOUND if LOCAL_ABSPATH is not versioned and
+ * SVN_ERROR_WC_PATH_UNEXPECTED_STATUS if LOCAL_ABSPATH is in a status where
+ * it can't be restored.
*
* @since New in 1.7.
*/
Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1100721&r1=1100720&r2=1100721&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Sun May 8 11:16:56
2011
@@ -473,14 +473,12 @@ switch_file_external(const char *local_a
target, svn_depth_unknown, url,
switch_editor, switch_baton, subpool));
- SVN_ERR(svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath,
- reporter, report_baton,
- TRUE, svn_depth_infinity, FALSE, TRUE,
- use_commit_times,
- NULL, NULL,
- ctx->cancel_func, ctx->cancel_baton,
- ctx->notify_func2, ctx->notify_baton2,
- subpool));
+ SVN_ERR(svn_wc__crawl_file_external(ctx->wc_ctx, local_abspath,
+ reporter, report_baton,
+ TRUE, use_commit_times,
+ ctx->cancel_func, ctx->cancel_baton,
+ ctx->notify_func2, ctx->notify_baton2,
+ subpool));
}
cleanup:
Modified: subversion/trunk/subversion/libsvn_wc/adm_crawler.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_crawler.c?rev=1100721&r1=1100720&r2=1100721&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_crawler.c Sun May 8 11:16:56 2011
@@ -122,25 +122,21 @@ svn_wc_restore(svn_wc_context_t *wc_ctx,
wc_ctx->db, local_abspath,
scratch_pool, scratch_pool));
- switch (status)
- {
- case svn_wc__db_status_added:
- SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL, NULL,
+ if (status == svn_wc__db_status_added)
+ SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL,
wc_ctx->db, local_abspath,
scratch_pool, scratch_pool));
- if (status != svn_wc__db_status_added)
- break; /* Has pristine version */
- case svn_wc__db_status_deleted:
- case svn_wc__db_status_not_present:
- case svn_wc__db_status_absent:
- case svn_wc__db_status_excluded:
- return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
- _("The node '%s' can not be restored."),
- svn_dirent_local_style(local_abspath,
- scratch_pool));
- default:
- break;
+
+ if (status != svn_wc__db_status_normal
+ && status != svn_wc__db_status_copied
+ && status != svn_wc__db_status_moved_here
+ && !(status == svn_wc__db_status_added && kind == svn_wc__db_kind_dir))
+ {
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("The node '%s' can not be restored."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
}
if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink)
Modified: subversion/trunk/subversion/libsvn_wc/externals.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/externals.c?rev=1100721&r1=1100720&r2=1100721&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/externals.c (original)
+++ subversion/trunk/subversion/libsvn_wc/externals.c Sun May 8 11:16:56 2011
@@ -580,6 +580,26 @@ svn_wc__crawl_file_external(svn_wc_conte
}
else
{
+ if (restore_files)
+ {
+ svn_node_kind_t kind;
+ SVN_ERR(svn_io_check_path(local_abspath, &kind, scratch_pool));
+
+ if (kind == svn_node_none)
+ {
+ err = svn_wc_restore(wc_ctx, local_abspath, use_commit_times,
+ scratch_pool);
+
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
+ return svn_error_return(err);
+
+ svn_error_clear(err);
+ }
+ }
+ }
+
/* Report that we know the path */
SVN_ERR(reporter->set_path(report_baton, "", revision,
svn_depth_infinity, FALSE, NULL,