Author: stsp Date: Wed Nov 16 21:03:56 2011 New Revision: 1202883 URL: http://svn.apache.org/viewvc?rev=1202883&view=rev Log: On the moves-scan-log branch, do progress reporting while scanning for moves.
It currently looks as follows: $ svn up -r 1083285 Updating '.': Scanning revision log for moves within r1083285:r1183385 (68%) This new output probably breaks 'make check' on this branch for now. * subversion/include/svn_wc.h (svn_wc_notify_action_t): Add svn_wc_notify_moves_scan_log_start, svn_wc_notify_moves_scan_log_in_progress, and svn_wc_notify_moves_scan_log_done. (svn_wc_notify_t): Add moves_scan_log_start_rev, moves_scan_log_end_rev, and moves_scan_log_current_rev. * subversion/svn/notify.c (notify): Print progress information for moves scan. * subversion/libsvn_wc/util.c (svn_wc_create_notify): Initialize new revision fields. * subversion/libsvn_client/update.c (scan_moves_log_receiver_baton): Add the update anchor_abspath, client context, and start:end revisions. (scan_moves_log_receiver): Report progress via notification callback. (get_repos_moves_baton): New. Required to pass more than just an ra_session to the scan_moves_log_receiver. (get_repos_moves): Notify about move scanning (start/stop), and initialize new fields in scan_moves_log_receiver_baton. (update_internal): Use new get_repos_moves_baton. Modified: subversion/branches/moves-scan-log/subversion/include/svn_wc.h subversion/branches/moves-scan-log/subversion/libsvn_client/update.c subversion/branches/moves-scan-log/subversion/libsvn_wc/util.c subversion/branches/moves-scan-log/subversion/svn/notify.c Modified: subversion/branches/moves-scan-log/subversion/include/svn_wc.h URL: http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/include/svn_wc.h?rev=1202883&r1=1202882&r2=1202883&view=diff ============================================================================== --- subversion/branches/moves-scan-log/subversion/include/svn_wc.h (original) +++ subversion/branches/moves-scan-log/subversion/include/svn_wc.h Wed Nov 16 21:03:56 2011 @@ -1219,7 +1219,19 @@ typedef enum svn_wc_notify_action_t /** The operation skipped the path because it was conflicted. * @since New in 1.7. */ - svn_wc_notify_skip_conflicted + svn_wc_notify_skip_conflicted, + + /** Starting to scan the revision log for server-side moves. + * @since New in 1.8. */ + svn_wc_notify_moves_scan_log_start, + + /** Progress update while scanning the revision log for server-side moves. + * @since New in 1.8. */ + svn_wc_notify_moves_scan_log_in_progress, + + /** Scanning the revision log for server-side moves finished. + * @since New in 1.8. */ + svn_wc_notify_moves_scan_log_done } svn_wc_notify_action_t; @@ -1403,6 +1415,15 @@ typedef struct svn_wc_notify_t { * @since New in 1.7 */ svn_linenum_t hunk_fuzz; + /** The revision range being scanned for server-side moves. + * @since New in 1.8 */ + svn_revnum_t moves_scan_log_start_rev; + svn_revnum_t moves_scan_log_end_rev; + + /** The revision currently being scanned for server-side moves. + * @since New in 1.8 */ + svn_revnum_t moves_scan_log_current_rev; + /* NOTE: Add new fields at the end to preserve binary compatibility. Also, if you add fields here, you have to update svn_wc_create_notify and svn_wc_dup_notify. */ Modified: subversion/branches/moves-scan-log/subversion/libsvn_client/update.c URL: http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/libsvn_client/update.c?rev=1202883&r1=1202882&r2=1202883&view=diff ============================================================================== --- subversion/branches/moves-scan-log/subversion/libsvn_client/update.c (original) +++ subversion/branches/moves-scan-log/subversion/libsvn_client/update.c Wed Nov 16 21:03:56 2011 @@ -161,6 +161,11 @@ is_empty_wc(svn_boolean_t *clean_checkou } struct scan_moves_log_receiver_baton { + const char *anchor_abspath; + svn_client_ctx_t *ctx; + svn_revnum_t start; + svn_revnum_t end; + /* The moved nodes hash to be populated. * Maps moved-from path to an array of repos_move_info_t. */ apr_hash_t *moves; @@ -179,6 +184,19 @@ scan_moves_log_receiver(void *baton, apr_pool_t *result_pool = apr_hash_pool_get(b->moves); int i; + if (b->ctx->notify_func2) + { + svn_wc_notify_t *notify; + + notify = svn_wc_create_notify(b->anchor_abspath, + svn_wc_notify_moves_scan_log_in_progress, + scratch_pool); + notify->moves_scan_log_start_rev = b->start; + notify->moves_scan_log_end_rev = b->end; + notify->moves_scan_log_current_rev = log_entry->revision; + b->ctx->notify_func2(b->ctx->notify_baton2, notify, scratch_pool); + } + /* Scan for copied and deleted nodes in this revision. */ for (hi = apr_hash_first(scratch_pool, log_entry->changed_paths2); hi; hi = apr_hash_next(hi)) @@ -277,6 +295,12 @@ scan_moves_log_receiver(void *baton, return SVN_NO_ERROR; } +struct get_repos_moves_baton { + const char *anchor_abspath; + svn_client_ctx_t *ctx; + svn_ra_session_t *ra_session; +} get_repos_moves_baton; + /* Implements svn_wc_get_repos_moves_func_t */ static svn_error_t * get_repos_moves(void *baton, @@ -286,14 +310,43 @@ get_repos_moves(void *baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - svn_ra_session_t *ra_session = baton; + struct get_repos_moves_baton *b = baton; struct scan_moves_log_receiver_baton lrb; + svn_wc_notify_t *notify; + lrb.anchor_abspath = b->anchor_abspath; + lrb.ctx = b->ctx; lrb.moves = apr_hash_make(result_pool); - SVN_ERR(svn_ra_get_log2(ra_session, NULL, start, end, 0, TRUE, FALSE, FALSE, - apr_array_make(scratch_pool, 0, - sizeof(const char *)), + lrb.start = start; + lrb.end = end; + + if (b->ctx->notify_func2) + { + notify = svn_wc_create_notify(b->anchor_abspath, + svn_wc_notify_moves_scan_log_start, + scratch_pool); + notify->moves_scan_log_start_rev = start; + notify->moves_scan_log_end_rev = end; + notify->moves_scan_log_current_rev = start; + b->ctx->notify_func2(b->ctx->notify_baton2, notify, scratch_pool); + } + + SVN_ERR(svn_ra_get_log2(b->ra_session, NULL, start, end, 0, TRUE, FALSE, + FALSE, apr_array_make(scratch_pool, 0, + sizeof(const char *)), scan_moves_log_receiver, &lrb, scratch_pool)); + + if (b->ctx->notify_func2) + { + notify = svn_wc_create_notify(b->anchor_abspath, + svn_wc_notify_moves_scan_log_done, + scratch_pool); + notify->moves_scan_log_start_rev = start; + notify->moves_scan_log_end_rev = end; + notify->moves_scan_log_current_rev = end; + b->ctx->notify_func2(b->ctx->notify_baton2, notify, scratch_pool); + } + #ifdef SVN_DEBUG { apr_hash_index_t *hi; @@ -375,6 +428,7 @@ update_internal(svn_revnum_t *result_rev svn_config_t *cfg = ctx->config ? apr_hash_get(ctx->config, SVN_CONFIG_CATEGORY_CONFIG, APR_HASH_KEY_STRING) : NULL; + struct get_repos_moves_baton grmb; /* An unknown depth can't be sticky. */ if (depth == svn_depth_unknown) @@ -532,6 +586,10 @@ update_internal(svn_revnum_t *result_rev dfb.target_revision = revnum; dfb.anchor_url = anchor_url; + grmb.ctx = ctx; + grmb.ra_session = ra_session; + grmb.anchor_abspath = anchor_abspath; + /* Fetch the update editor. If REVISION is invalid, that's okay; the RA driver will call editor->set_target_revision later on. */ SVN_ERR(svn_wc_get_update_editor5(&update_editor, &update_edit_baton, @@ -545,7 +603,7 @@ update_internal(svn_revnum_t *result_rev svn_client__dirent_fetcher, &dfb, ctx->conflict_func2, ctx->conflict_baton2, NULL, NULL, - get_repos_moves, ra_session, + get_repos_moves, &grmb, ctx->cancel_func, ctx->cancel_baton, ctx->notify_func2, ctx->notify_baton2, pool, pool)); Modified: subversion/branches/moves-scan-log/subversion/libsvn_wc/util.c URL: http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/libsvn_wc/util.c?rev=1202883&r1=1202882&r2=1202883&view=diff ============================================================================== --- subversion/branches/moves-scan-log/subversion/libsvn_wc/util.c (original) +++ subversion/branches/moves-scan-log/subversion/libsvn_wc/util.c Wed Nov 16 21:03:56 2011 @@ -90,6 +90,9 @@ svn_wc_create_notify(const char *path, ret->lock_state = svn_wc_notify_lock_state_unknown; ret->revision = SVN_INVALID_REVNUM; ret->old_revision = SVN_INVALID_REVNUM; + ret->moves_scan_log_start_rev = SVN_INVALID_REVNUM; + ret->moves_scan_log_end_rev = SVN_INVALID_REVNUM; + ret->moves_scan_log_current_rev = SVN_INVALID_REVNUM; return ret; } Modified: subversion/branches/moves-scan-log/subversion/svn/notify.c URL: http://svn.apache.org/viewvc/subversion/branches/moves-scan-log/subversion/svn/notify.c?rev=1202883&r1=1202882&r2=1202883&view=diff ============================================================================== --- subversion/branches/moves-scan-log/subversion/svn/notify.c (original) +++ subversion/branches/moves-scan-log/subversion/svn/notify.c Wed Nov 16 21:03:56 2011 @@ -983,6 +983,38 @@ notify(void *baton, const svn_wc_notify_ goto print_error; break; + case svn_wc_notify_moves_scan_log_start: + err = svn_cmdline_printf(pool, _("%sScanning revision log for moves " + "within r%ld:r%ld (%ld%%)%s"), + "", n->moves_scan_log_start_rev, + n->moves_scan_log_end_rev, (long int)0, ""); + if (err) + goto print_error; + break; + + case svn_wc_notify_moves_scan_log_in_progress: + err = svn_cmdline_printf(pool, _("%sScanning revision log for moves " + "within r%ld:r%ld (%ld%%)%s"), + "\r", n->moves_scan_log_start_rev, + n->moves_scan_log_end_rev, + ((n->moves_scan_log_current_rev - + n->moves_scan_log_start_rev) * 100) / + (n->moves_scan_log_end_rev - + n->moves_scan_log_start_rev), + ""); + if (err) + goto print_error; + break; + + case svn_wc_notify_moves_scan_log_done: + err = svn_cmdline_printf(pool, _("%sScanning revision log for moves " + "within r%ld:r%ld (%ld%%)%s"), + "", n->moves_scan_log_start_rev, + n->moves_scan_log_end_rev, (long int)100, "\n"); + if (err) + goto print_error; + break; + default: break; }