Hi, I'm looking to improving svn commit progress notification. I want to add notification between "Transmitting deltas" and final "Committed revision X". The final stage may take significant amount of time, especially if we implement automatic packing someday. It's better to explicitly tell user that we finalizing commit and do not stuck on "transmitting deltas".
Anyone have any ideas on the UI in svn command line. I've prepared several versions:1. [[[ $ svn ci wc -m "log msg" Sending wc\foo Transmitting file data . Finalizing commit ... Committed revision 5. ]]] [[[ $ svn ci wc -m "log msg" Sending wc\foo Transmitting file data . Finalizing commit: Committed revision 5. ]]] [[[ $ svn ci wc -m "log msg" Sending wc\foo Transmitting file data . Committing: Committed revision 5. ]]] [[[ $ svn ci wc -m "log msg" Sending wc\foo Transmitting file data . Finalizing: Committed revision 5. ]]] Any other ideas? The code changes are pretty simple. Working in progress patch attached if anyone want to play with it. [[[ Add new libsvn_client notification between transmitting deltas and finalizing commit. The final stage of commit may consume significant amount of time, especially if we have automatic packing someday. * subversion/include/svn_wc.h (svn_wc_notify_action_t): Add svn_wc_notify_commit_finalizing. * subversion/libsvn_client/add.c * subversion/libsvn_client/commit_util.c * subversion/libsvn_client/copy.c * subversion/libsvn_client/delete.c * subversion/libsvn_client/mtcc.c * subversion/libsvn_client/prop_commands.c (mkdir_urls, svn_client__do_commit, repos_to_repos_copy, single_repos_delete, svn_client_mtcc_commit, propset_on_url): Send svn_wc_notify_commit_finalizing notification before closing edit. * subversion/libsvn_client/import.c (import): Add URL argument and send svn_wc_notify_commit_finalizing notification before closing edit. (svn_client_import5): Update caller. * subversion/svn/notify.c (notify): Handle svn_wc_notify_commit_finalizing notification. * subversion/svn/util.c (svn_cl__print_commit_info): Do not print leading new line, to have pre-commit and commit message on the same line. * subversion/tests/cmdline/svntest/wc.py (State.from_commit): Ignore 'Finalizing commit' output. ]]] -- Ivan Zhakov CTO | VisualSVN | http://www.visualsvn.com
Index: subversion/include/svn_wc.h =================================================================== --- subversion/include/svn_wc.h (revision 1602903) +++ subversion/include/svn_wc.h (working copy) @@ -1268,8 +1268,11 @@ /** Running info on an external module. * @since New in 1.9. */ - svn_wc_notify_info_external + svn_wc_notify_info_external, + /** Finalizing commit. + * @since New in 1.9. */ + svn_wc_notify_commit_finalizing } svn_wc_notify_action_t; Index: subversion/libsvn_client/add.c =================================================================== --- subversion/libsvn_client/add.c (revision 1602903) +++ subversion/libsvn_client/add.c (working copy) @@ -1241,6 +1241,15 @@ svn_error_trace(editor->abort_edit(edit_baton, pool))); } + if (ctx->notify_func2) + { + svn_wc_notify_t *notify; + notify = svn_wc_create_notify_url(common, + svn_wc_notify_commit_finalizing, + pool); + ctx->notify_func2(ctx->notify_baton2, notify, pool); + } + /* Close the edit. */ return svn_error_trace(editor->close_edit(edit_baton, pool)); } Index: subversion/libsvn_client/commit_util.c =================================================================== --- subversion/libsvn_client/commit_util.c (revision 1602903) +++ subversion/libsvn_client/commit_util.c (working copy) @@ -1938,6 +1938,15 @@ svn_pool_destroy(mod->file_pool); } + if (ctx->notify_func2) + { + svn_wc_notify_t *notify; + notify = svn_wc_create_notify_url(base_url, + svn_wc_notify_commit_finalizing, + iterpool); + ctx->notify_func2(ctx->notify_baton2, notify, iterpool); + } + svn_pool_destroy(iterpool); /* Close the edit. */ Index: subversion/libsvn_client/copy.c =================================================================== --- subversion/libsvn_client/copy.c (revision 1602903) +++ subversion/libsvn_client/copy.c (working copy) @@ -1181,6 +1181,15 @@ editor->abort_edit(edit_baton, pool)); } + if (ctx->notify_func2) + { + svn_wc_notify_t *notify; + notify = svn_wc_create_notify_url(top_url, + svn_wc_notify_commit_finalizing, + pool); + ctx->notify_func2(ctx->notify_baton2, notify, pool); + } + /* Close the edit. */ return svn_error_trace(editor->close_edit(edit_baton, pool)); } Index: subversion/libsvn_client/delete.c =================================================================== --- subversion/libsvn_client/delete.c (revision 1602903) +++ subversion/libsvn_client/delete.c (working copy) @@ -258,6 +258,15 @@ editor->abort_edit(edit_baton, pool))); } + if (ctx->notify_func2) + { + svn_wc_notify_t *notify; + notify = svn_wc_create_notify_url(base_uri, + svn_wc_notify_commit_finalizing, + pool); + ctx->notify_func2(ctx->notify_baton2, notify, pool); + } + /* Close the edit. */ return svn_error_trace(editor->close_edit(edit_baton, pool)); } Index: subversion/libsvn_client/import.c =================================================================== --- subversion/libsvn_client/import.c (revision 1602903) +++ subversion/libsvn_client/import.c (working copy) @@ -641,6 +641,7 @@ */ static svn_error_t * import(const char *local_abspath, + const char *url, const apr_array_header_t *new_entries, const svn_delta_editor_t *editor, void *edit_baton, @@ -774,7 +775,18 @@ } if (import_ctx->repos_changed) - return svn_error_trace(editor->close_edit(edit_baton, pool)); + { + if (ctx->notify_func2) + { + svn_wc_notify_t *notify; + notify = svn_wc_create_notify_url(url, + svn_wc_notify_commit_finalizing, + pool); + ctx->notify_func2(ctx->notify_baton2, notify, pool); + } + + return svn_error_trace(editor->close_edit(edit_baton, pool)); + } else return svn_error_trace(editor->abort_edit(edit_baton, pool)); } @@ -978,7 +990,7 @@ /* If an error occurred during the commit, abort the edit and return the error. We don't even care if the abort itself fails. */ - if ((err = import(local_abspath, new_entries, editor, edit_baton, + if ((err = import(local_abspath, url, new_entries, editor, edit_baton, depth, base_rev, excludes, autoprops, local_ignores_arr, global_ignores, no_ignore, no_autoprops, ignore_unknown_node_types, filter_callback, Index: subversion/libsvn_client/mtcc.c =================================================================== --- subversion/libsvn_client/mtcc.c (revision 1602903) +++ subversion/libsvn_client/mtcc.c (working copy) @@ -1407,7 +1407,18 @@ root_baton, session_url, mtcc->ctx, scratch_pool); if (!err) - SVN_ERR(editor->close_edit(edit_baton, scratch_pool)); + { + if (mtcc->ctx->notify_func2) + { + svn_wc_notify_t *notify; + notify = svn_wc_create_notify_url(session_url, + svn_wc_notify_commit_finalizing, + scratch_pool); + mtcc->ctx->notify_func2(mtcc->ctx->notify_baton2, notify, + scratch_pool); + } + SVN_ERR(editor->close_edit(edit_baton, scratch_pool)); + } else err = svn_error_compose_create(err, editor->abort_edit(edit_baton, scratch_pool)); Index: subversion/libsvn_client/prop_commands.c =================================================================== --- subversion/libsvn_client/prop_commands.c (revision 1602903) +++ subversion/libsvn_client/prop_commands.c (working copy) @@ -240,6 +240,14 @@ return svn_error_trace(err); } + if (ctx->notify_func2) + { + svn_wc_notify_t *notify; + notify = svn_wc_create_notify_url(target, + svn_wc_notify_commit_finalizing, + pool); + ctx->notify_func2(ctx->notify_baton2, notify, pool); + } /* Close the edit. */ return editor->close_edit(edit_baton, pool); } Index: subversion/svn/notify.c =================================================================== --- subversion/svn/notify.c (revision 1602903) +++ subversion/svn/notify.c (working copy) @@ -24,7 +24,8 @@ /* ==================================================================== */ - + + /*** Includes. ***/ #define APR_WANT_STDIO @@ -43,7 +44,8 @@ #include "svn_private_config.h" - + + /* Baton for notify and friends. */ struct notify_baton { @@ -1150,6 +1152,12 @@ goto print_error; break; + case svn_wc_notify_commit_finalizing: + err = svn_cmdline_printf(pool, _("\nFinalizing commit ...\n")); + if (err) + goto print_error; + break; + default: break; } Index: subversion/svn/util.c =================================================================== --- subversion/svn/util.c (revision 1602903) +++ subversion/svn/util.c (working copy) @@ -76,7 +76,7 @@ apr_pool_t *pool) { if (SVN_IS_VALID_REVNUM(commit_info->revision)) - SVN_ERR(svn_cmdline_printf(pool, _("\nCommitted revision %ld%s.\n"), + SVN_ERR(svn_cmdline_printf(pool, _("Committed revision %ld%s.\n"), commit_info->revision, commit_info->revision == 42 && getenv("SVN_I_LOVE_PANGALACTIC_GARGLE_BLASTERS") Index: subversion/tests/cmdline/svntest/wc.py =================================================================== --- subversion/tests/cmdline/svntest/wc.py (revision 1602903) +++ subversion/tests/cmdline/svntest/wc.py (working copy) @@ -590,6 +590,9 @@ if line.startswith('DBG:') or line.startswith('Transmitting'): continue + if line.startswith('Finalizing commit'): + continue + match = _re_parse_commit_ext.search(line) if match: desc[to_relpath(match.group(4))] = StateItem(verb=match.group(1))