[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Trace update, and cancel update editors patch

From: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2001-11-30 00:59:11 CET

Bill, your post seems to have a lot of spurious newlines. Both the
log message and the patch are affected.

Can you tweak your mailer's preferences as necessary and repost?

Thanks,
-Karl

"Bill Tutt" <rassilon@lyra.org> writes:
> Ok, here we go. First patch in a long while. Once these go in, the next
> batch of COM code can go in. Yay!
>
> Bill
>
> Log:
> UI apps need trace editors. Seemed like a shame to force folks to
> constantly rewrite this useful bit of code. So, we now take postpone the
> actual printing to stdout in the cmdline client to a callback function.
> (for the trace-update editor only atm, trace-commit to follow shortly)
> The diff below shows trace-update still in the cmdline client directory.
> The intent of the patch, and the MSVC++ .dsp patch shows the intent is
> to move the trace-update and trace-commit editors into libsvn_client.
> Additoinally, it's a shame that all editors constantly need to
> recalculate the current editor state. Why can't every editor just have
> access to the appropriate data? Of course, it'd be even handier if you
> could cache the data up front, that way you wouldn't be constantly
> recalculating the identical data with different editors using common
> code. But that isn't happening now. :)
>
> Additionally, UI apps need asynchronous access to SVN, and therefore
> need a cancelation editor. The diff below supplies the cancel-update
> editor, and adds it to libsvn_client. The cancelation editor
> functionality can't be in the trace editor because the trace editor is
> composed after the respective operation. The cancelation editor needs to
> be composed before the respective operation. Being able to prevent a
> network operation is a good thing.
>
> When these patches are approved, I can commit the current state of the
> COM layer. That diff isn't included since I need to remove and readd all
> of the VB source files as bianry files until line-ending conversions are
> implemented.
>
> * include/svn_client.h: (svn_client_trance_ui_fns): Prototype
> trace_ui_fns
> vtable. (svn_client_get_trace_update_editor,
> svn_client_get_cancel_editor):
> New helper function for svn_client.
> * include/svn_error_codes.h: (SVN_ERR_USER_CANCELED): New error code for
> cancelation editors.
> * libsvn_client/cancel-update.c: New file. Implements cancelation
> editor.
> * libsvn_client/libsvn_client.dsp: Add cancel-update.c. Add
> trace-update.c.
> * clients/cmdline/checkout-cmd.c: (svn_cl__checkout) Use modified
> trace-update editor.
> * clients/cmdline/cl.h: (svn_cl__get_trace_update_editor) Remove old
> trace_update_editor helper prototype. (svn_cl__print_message) Add
> prototype.
> Prints trace message to stdout.
> * clients/cmdline/copy-cmd.c: (svn_cl__copy): Use new trace-update
> editor.
> * clients/cmdline/subversion_client.dsp: Add mkdir-cmd.c Remove
> trace-update.c.
> * clients/cmdline/update-cmd.c: (svn_cl__update): Use new trace-update
> editor.
> * libsvn_client/trace-update.c: (edit_baton): Rename baton to
> trace_edit_baton.
> MSVC's debugger didn't like it when there was more than one
> identically
> named struct (bad user expericence issues..) Add trace_ui vtable
> memeber
> and a baton for the callback.
> (all editor functions): Call trace_ui->print_message instead of
> printf.
> (svn_cl__get_trace_update_editor): Renamed to
> svn_client_get_trace_update_editor and tweaked for new baton fields.
> * clients/cmdline/util.c: (svn_cl__print_message): Added.
>
> diff -r -u -p include/svn_client.h
> c:\svn\subversion-NEW\subversion\include/svn_client.h
> --- include/svn_client.h Wed Nov 28 20:44:52 2001
> +++ c:\svn\subversion-NEW\subversion\include/svn_client.h Wed Nov
> 28 22:12:04 2001
> @@ -220,6 +220,7 @@ svn_client_add (svn_stringbuf_t *path,
> svn_boolean_t recursive,
> apr_pool_t *pool);
>
> +
> /* If PATH is a URL, use the AUTH_BATON and MESSAGE to immediately
> attempt to commit the creation of the directory URL in the
> repository.
>
> @@ -539,6 +540,31 @@ svn_client_proplist (apr_array_header_t
> svn_boolean_t recurse,
> apr_pool_t *pool);
>
> +/* Common trace update functions. Fill in a svn_client_trace_ui_fns
> structure,
> + pass it into svn_client_get_trace_update_editor, and let
> libsvn_client do
> + most of the hard work for you. Reuse is wonderful. */
> +struct svn_client_trace_ui_fns
> +{
> + void (*print_message)(void *ui_baton, svn_stringbuf_t *);
> +};
> +
> +svn_error_t *
> +svn_client_get_trace_update_editor(const svn_delta_edit_fns_t **editor,
> + void **edit_baton,
> + const struct svn_client_trace_ui_fns
> *trace_ui,
> + void *ui_baton,
> + svn_stringbuf_t *initial_path,
> + apr_pool_t *pool);
> +
> +
> +svn_error_t *
> +svn_client_get_cancel_update_editor(const svn_delta_edit_fns_t
> **editor,
> + void **edit_baton,
> + svn_boolean_t
> (*should_i_cancel)(void *),
> + void *inner_baton,
> + apr_pool_t *pool);
> +
> +
> #endif /* SVN_CLIENT_H */
>
> #ifdef __cplusplus
> @@ -551,16 +577,3 @@ svn_client_proplist (apr_array_header_t
> * eval: (load-file "../svn-dev.el")
> * end:
> */
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> diff -r -u -p include/svn_error_codes.h
> c:\svn\subversion-NEW\subversion\include/svn_error_codes.h
> --- include/svn_error_codes.h Wed Nov 28 20:44:53 2001
> +++ c:\svn\subversion-NEW\subversion\include/svn_error_codes.h Wed Nov
> 28 16:06:52 2001
> @@ -360,7 +360,11 @@ SVN_ERROR_START
> "Attempted command in administrative dir")
>
> /* END Client errors */
> -
> +
> + /* BEGIN Generic UI related errors */
> + SVN_ERRDEF (SVN_ERR_USER_CANCELED,
> + "User canceled operation")
> + /* END Generic UI related errors */
>
> SVN_ERROR_END
>
> diff -N -u -p libsvn_client/cancel-update.c
> c:\svn\subversion-NEW\subversion\libsvn_client/cancel-update.c
> --- libsvn_client/cancel-update.c Wed Dec 31 16:00:00 1969
> +++ c:\svn\subversion-NEW\subversion\libsvn_client/cancel-update.c
> Wed Nov 28 22:12:24 2001
> @@ -0,0 +1,338 @@
> +/*
> + * cancel-update.c : an editor implementation that calls a
> user-supplied
> + * callback to determine if the user decided to
> cancel
> + * the pending request.
> + * (when composed to follow before the update-editor)
> + *
> + * ====================================================================
> + * Copyright (c) 2000-2001 CollabNet. All rights reserved.
> + *
> + * This software is licensed as described in the file COPYING, which
> + * you should have received as part of this distribution. The terms
> + * are also available at http://subversion.tigris.org/license-1.html.
> + * If newer versions of this license are posted there, you may use a
> + * newer version instead, at your option.
> + *
> + * This software consists of voluntary contributions made by many
> + * individuals. For exact contribution history, see the revision
> + * history and logs, available at http://subversion.tigris.org/.
> + * ====================================================================
> + */
> +
> +/* ====================================================================
> */
> +
> +
> +
>
> +/*** Includes. ***/
> +#include "svn_wc.h"
> +#include "svn_pools.h"
> +#include "svn_path.h"
> +#include "svn_string.h"
> +
> +
>
> +struct cancel_baton
> +{
> + apr_pool_t *pool;
> + svn_boolean_t (*should_i_cancel)(void *);
> + void *inner_baton;
> +};
> +
> +static svn_error_t *
> +open_root (void *cancel_baton, svn_revnum_t base_revision, void
> **root_baton)
> +{
> + struct cancel_baton *cb = cancel_baton;
> +
> + *root_baton = cancel_baton;
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +delete_entry (svn_stringbuf_t *name, void *parent_baton)
> +{
> + struct cancel_baton *cb = parent_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool, "User canceled operation.");
> + }
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +add_directory (svn_stringbuf_t *name,
> + void *parent_baton,
> + svn_stringbuf_t *copyfrom_path,
> + svn_revnum_t copyfrom_revision,
> + void **child_baton)
> +{
> + struct cancel_baton *cb = parent_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + *child_baton = cb;
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +open_directory (svn_stringbuf_t *name,
> + void *parent_baton,
> + svn_revnum_t base_revision,
> + void **child_baton)
> +{
> + struct cancel_baton *cb = parent_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + *child_baton = cb;
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +close_directory (void *dir_baton)
> +{
> + struct cancel_baton *cb = dir_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +close_file (void *file_baton)
> +{
> + struct cancel_baton *cb = file_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +close_edit (void *edit_baton)
> +{
> + struct cancel_baton *cb = (struct cancel_baton *)edit_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +window_handler (svn_txdelta_window_t *window, void *handler_baton)
> +{
> + struct cancel_baton *cb = (struct cancel_baton *)handler_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +apply_textdelta (void *file_baton,
> + svn_txdelta_window_handler_t *handler,
> + void **handler_baton)
> +{
> + struct cancel_baton *cb = file_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + *handler = window_handler;
> + *handler_baton = cb;
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +add_file (svn_stringbuf_t *name,
> + void *parent_baton,
> + svn_stringbuf_t *copyfrom_path,
> + svn_revnum_t copyfrom_revision,
> + void **file_baton)
> +{
> + struct cancel_baton *cb = parent_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + *file_baton = cb;
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +open_file (svn_stringbuf_t *name,
> + void *parent_baton,
> + svn_revnum_t ancestor_revision,
> + void **file_baton)
> +{
> + struct cancel_baton *cb = parent_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create(SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + *file_baton = cb;
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +change_file_prop (void *file_baton,
> + svn_stringbuf_t *name,
> + svn_stringbuf_t *value)
> +{
> + struct cancel_baton *cb = file_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create(SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +static svn_error_t *
> +change_dir_prop (void *parent_baton,
> + svn_stringbuf_t *name,
> + svn_stringbuf_t *value)
> +{
> + struct cancel_baton *cb = parent_baton;
> +
> + if (cb->should_i_cancel(cb->inner_baton))
> + {
> + return svn_error_create (SVN_ERR_USER_CANCELED,
> + 0,
> + 0,
> + cb->pool,
> + "User canceled operation.");
> + }
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
>
> +svn_error_t *
> +svn_client_get_cancel_update_editor(const svn_delta_edit_fns_t
> **editor,
> + void **edit_baton,
> + svn_boolean_t
> (*should_i_cancel)(void *),
> + void *inner_baton,
> + apr_pool_t *pool)
> +{
> + /* Allocate an edit baton to be stored in every directory baton.
> + Set it up for the directory baton we create here, which is the
> + root baton. */
> + struct cancel_baton *cb = apr_pcalloc (pool, sizeof (*cb));
> + svn_delta_edit_fns_t *cancel_editor = svn_delta_default_editor
> (pool);
> +
> + /* Set up the edit context. */
> + cb->pool = svn_pool_create (pool);
> + cb->inner_baton = inner_baton;
> + cb->should_i_cancel = should_i_cancel;
> +
> + /* Set up the editor. */
> + cancel_editor->open_root = open_root;
> + cancel_editor->delete_entry = delete_entry;
> + cancel_editor->add_directory = add_directory;
> + cancel_editor->open_directory = open_directory;
> + cancel_editor->change_dir_prop = change_dir_prop;
> + cancel_editor->close_directory = close_directory;
> + cancel_editor->add_file = add_file;
> + cancel_editor->open_file = open_file;
> + cancel_editor->apply_textdelta = apply_textdelta;
> + cancel_editor->change_file_prop = change_file_prop;
> + cancel_editor->close_file = close_file;
> + cancel_editor->close_edit = close_edit;
> +
> + *edit_baton = cb;
> + *editor = cancel_editor;
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> +
>
> +/*
> + * local variables:
> + * eval: (load-file "../../svn-dev.el")
> + * end:
> + */
> diff -N -u -p libsvn_client/libsvn_client.dsp
> c:\svn\subversion-NEW\subversion\libsvn_client/libsvn_client.dsp
> --- libsvn_client/libsvn_client.dsp Wed Nov 28 22:38:50 2001
> +++ c:\svn\subversion-NEW\subversion\libsvn_client/libsvn_client.dsp
> Wed Nov 28 16:27:14 2001
> @@ -99,6 +99,10 @@ SOURCE=.\auth.c
>
> # End Source File
>
> # Begin Source File
>
>
>
> +SOURCE=".\cancel-update.c"
>
> +# End Source File
>
> +# Begin Source File
>
> +
>
> SOURCE=.\checkout.c
>
> # End Source File
>
> # Begin Source File
>
> @@ -136,6 +140,10 @@ SOURCE=.\revert.c
>
> # Begin Source File
>
>
>
> SOURCE=.\status.c
>
> +# End Source File
>
> +# Begin Source File
>
> +
>
> +SOURCE="..\clients\cmdline\trace-update.c"
>
> # End Source File
>
> # Begin Source File
>
>
>
> diff -N -r -u -p cmdline/checkout-cmd.c
> c:\svn\subversion-NEW\subversion\clients\cmdline/checkout-cmd.c
> --- cmdline/checkout-cmd.c Wed Nov 28 20:42:48 2001
> +++ c:\svn\subversion-NEW\subversion\clients\cmdline/checkout-cmd.c
> Wed Nov 28 22:01:00 2001
> @@ -43,9 +43,11 @@ svn_cl__checkout (apr_getopt_t *os,
> svn_error_t *err;
> int i;
> svn_client_auth_baton_t *auth_baton;
> + struct svn_client_trace_ui_fns trace_ui;
> +
> + trace_ui.print_message = &svn_cl__print_message;
>
> err = svn_cl__parse_all_args (os, opt_state, "checkout", pool);
> -
> if (err)
> return err;
>
> @@ -109,10 +111,12 @@ svn_cl__checkout (apr_getopt_t *os,
> else
> local_dir = opt_state->target;
>
> - err = svn_cl__get_trace_update_editor (&trace_editor,
> - &trace_edit_baton,
> - local_dir,
> - pool);
> + err = svn_client_get_trace_update_editor (&trace_editor,
> + &trace_edit_baton,
> + &trace_ui,
> + NULL,
> + local_dir,
> + pool);
> if (err)
> return err;
>
> diff -N -r -u -p cmdline/cl.h
> c:\svn\subversion-NEW\subversion\clients\cmdline/cl.h
> --- cmdline/cl.h Wed Nov 28 20:42:48 2001
> +++ c:\svn\subversion-NEW\subversion\clients\cmdline/cl.h Wed Nov
> 28 22:20:38 2001
> @@ -224,13 +224,6 @@ svn_error_t *svn_cl__print_dir_diff (svn
> svn_boolean_t recurse,
> apr_pool_t *pool);
>
> -/* Returns an editor that prints out events in an update or checkout.
> */
> -svn_error_t *
> -svn_cl__get_trace_update_editor (const svn_delta_edit_fns_t **editor,
> - void **edit_baton,
> - svn_stringbuf_t *initial_path,
> - apr_pool_t *pool);
> -
> /* Returns an editor that prints out events in a commit. */
> svn_error_t *
> svn_cl__get_trace_commit_editor (const svn_delta_edit_fns_t **editor,
> @@ -243,6 +236,10 @@ svn_cl__get_trace_commit_editor (const s
> specific to the command-line client. */
> void svn_cl__init_feedback_vtable (apr_pool_t *top_pool);
>
> +/* Print the passed in stringbuf to stdout. Called by
> + * the svn_client_trace_editor. */
> +void
> +svn_cl__print_message(void *ui_baton, svn_stringbuf_t *msg);
>
> /* Our implementation of the 'auth info callback' routine,
> as defined in svn_client.h. This callback is passed to any
> diff -N -r -u -p cmdline/copy-cmd.c
> c:\svn\subversion-NEW\subversion\clients\cmdline/copy-cmd.c
> --- cmdline/copy-cmd.c Wed Nov 28 20:42:44 2001
> +++ c:\svn\subversion-NEW\subversion\clients\cmdline/copy-cmd.c Wed Nov
> 28 22:06:47 2001
> @@ -47,6 +47,9 @@ svn_cl__copy (apr_getopt_t *os,
> const svn_delta_edit_fns_t *trace_editor;
> void *trace_edit_baton;
> svn_boolean_t src_is_url, dst_is_url;
> + struct svn_client_trace_ui_fns trace_ui;
> +
> + trace_ui.print_message = &svn_cl__print_message;
>
> targets = svn_cl__args_to_target_array (os, pool);
>
> @@ -86,11 +89,15 @@ svn_cl__copy (apr_getopt_t *os,
> dst_path,
> pool));
> else if ((src_is_url) && (! dst_is_url))
> - /* URL->WC : Use checkout trace editor. */
> - SVN_ERR (svn_cl__get_trace_update_editor (&trace_editor,
> - &trace_edit_baton,
> - dst_path,
> - pool));
> + {
> + /* URL->WC : Use checkout trace editor. */
> + SVN_ERR (svn_client_get_trace_update_editor (&trace_editor,
> + &trace_edit_baton,
> + &trace_ui,
> + NULL,
> + dst_path,
> + pool));
> + }
> else
> /* URL->URL : No trace editor needed. */
> ;
> diff -N -r -u -p cmdline/subversion_client.dsp
> c:\svn\subversion-NEW\subversion\clients\cmdline/subversion_client.dsp
> --- cmdline/subversion_client.dsp Wed Nov 28 20:42:50 2001
> +++
> c:\svn\subversion-NEW\subversion\clients\cmdline/subversion_client.dsp
> Wed Nov 28 21:06:42 2001
> @@ -142,7 +142,11 @@ SOURCE=.\main.c
>
> # End Source File
>
> # Begin Source File
>
>
>
> -SOURCE=.\move-cmd.c
>
> +SOURCE=".\mkdir-cmd.c"
>
> +# End Source File
>
> +# Begin Source File
>
> +
>
> +SOURCE=".\move-cmd.c"
>
> # End Source File
>
> # Begin Source File
>
>
>
> @@ -178,10 +182,6 @@ SOURCE=".\status-cmd.c"
>
> # End Source File
>
> # Begin Source File
>
>
>
> -SOURCE=".\switch-cmd.c"
>
> -# End Source File
>
> -# Begin Source File
>
> -
>
> SOURCE=.\status.c
>
> # End Source File
>
> # Begin Source File
>
> @@ -190,11 +190,11 @@ SOURCE=..\win32\svn.rc
>
> # End Source File
>
> # Begin Source File
>
>
>
> -SOURCE=".\trace-commit.c"
>
> +SOURCE=".\switch-cmd.c"
>
> # End Source File
>
> # Begin Source File
>
>
>
> -SOURCE=".\trace-update.c"
>
> +SOURCE=".\trace-commit.c"
>
> # End Source File
>
> # Begin Source File
>
>
>
> diff -N -r -u -p cmdline/trace-update.c
> c:\svn\subversion-NEW\subversion\clients\cmdline/trace-update.c
> --- cmdline/trace-update.c Wed Nov 28 20:42:48 2001
> +++ c:\svn\subversion-NEW\subversion\clients\cmdline/trace-update.c
> Wed Nov 28 22:24:28 2001
> @@ -28,40 +28,44 @@
> #include "svn_string.h"
> #include "cl.h"
>
> -
>
>
> -struct edit_baton
> +struct trace_edit_baton
> {
> apr_pool_t *pool;
> + const struct svn_client_trace_ui_fns *trace_ui;
> + void *ui_baton;
> svn_stringbuf_t *initial_path;
> };
>
>
> -struct dir_baton
> +struct trace_dir_baton
> {
> - struct edit_baton *edit_baton;
> - struct dir_baton *parent_dir_baton;
> + struct trace_edit_baton *edit_baton;
> + struct trace_dir_baton *parent_dir_baton;
> svn_stringbuf_t *path;
> svn_boolean_t added;
> svn_boolean_t prop_changed;
> };
>
> -
> struct file_baton
> {
> - struct dir_baton *parent_dir_baton;
> + struct trace_dir_baton *parent_dir_baton;
> svn_stringbuf_t *path;
> svn_boolean_t added;
> svn_boolean_t text_changed;
> svn_boolean_t prop_changed;
> };
>
> +struct handler_baton
> +{
> + struct trace_edit_baton *edit_baton;
> +};
>
> static svn_error_t *
> open_root (void *edit_baton, svn_revnum_t base_revision, void
> **root_baton)
> {
> - struct edit_baton *eb = edit_baton;
> - struct dir_baton *rb = apr_pcalloc (eb->pool, sizeof (*rb));
> + struct trace_edit_baton *eb = edit_baton;
> + struct trace_dir_baton *rb = apr_pcalloc (eb->pool, sizeof (*rb));
>
> rb->edit_baton = eb;
> rb->parent_dir_baton = NULL;
> @@ -76,12 +80,16 @@ open_root (void *edit_baton, svn_revnum_
> static svn_error_t *
> delete_entry (svn_stringbuf_t *name, void *parent_baton)
> {
> - struct dir_baton *d = parent_baton;
> + svn_stringbuf_t *printable_name;
>
> + struct trace_dir_baton *d = parent_baton;
>
> - svn_stringbuf_t *printable_name = svn_stringbuf_dup (d->path,
> d->edit_baton->pool);
> + printable_name = svn_stringbuf_dup (d->path, d->edit_baton->pool);
> svn_path_add_component (printable_name, name, svn_path_local_style);
>
> - printf ("D %s\n", printable_name->data);
> + d->edit_baton->trace_ui->print_message(
>
> + d->edit_baton->ui_baton,
> + svn_stringbuf_createf(d->edit_baton->pool,
> + "D %s\n", printable_name->data));
> return SVN_NO_ERROR;
> }
>
> @@ -93,17 +101,20 @@ add_directory (svn_stringbuf_t *name,
> svn_revnum_t copyfrom_revision,
> void **child_baton)
> {
> - struct dir_baton *parent_d = parent_baton;
> - struct dir_baton *child_d
> - = apr_pcalloc (parent_d->edit_baton->pool, sizeof (*child_d));
> + struct trace_dir_baton *parent_d = parent_baton;
> + struct trace_dir_baton *child_d;
>
> + child_d = apr_pcalloc (parent_d->edit_baton->pool, sizeof
> (*child_d));
> child_d->edit_baton = parent_d->edit_baton;
> child_d->parent_dir_baton = parent_d;
> child_d->path = svn_stringbuf_dup (parent_d->path,
> child_d->edit_baton->pool);
> svn_path_add_component (child_d->path, name, svn_path_local_style);
> child_d->added = TRUE;
>
> - printf ("A %s\n", child_d->path->data);
> + parent_d->edit_baton->trace_ui->print_message(
>
> + parent_d->edit_baton->ui_baton,
> + svn_stringbuf_createf(parent_d->edit_baton->pool,
> + "A %s\n", child_d->path->data));
> *child_baton = child_d;
>
> return SVN_NO_ERROR;
> @@ -116,10 +127,10 @@ open_directory (svn_stringbuf_t *name,
> svn_revnum_t base_revision,
> void **child_baton)
> {
> - struct dir_baton *parent_d = parent_baton;
> - struct dir_baton *child_d
> - = apr_pcalloc (parent_d->edit_baton->pool, sizeof (*child_d));
> + struct trace_dir_baton *parent_d = parent_baton;
> + struct trace_dir_baton *child_d;
>
> + child_d = apr_pcalloc (parent_d->edit_baton->pool, sizeof
> (*child_d));
> child_d->edit_baton = parent_d->edit_baton;
> child_d->parent_dir_baton = parent_d;
> child_d->path = svn_stringbuf_dup (parent_d->path,
> child_d->edit_baton->pool);
> @@ -127,7 +138,7 @@ open_directory (svn_stringbuf_t *name,
>
> *child_baton = child_d;
>
> - /* Don't print anything for a directory open -- this event is
> + /* Don't print anything for a directory replace -- this event is
> implied by printing events beneath it. */
>
> return SVN_NO_ERROR;
> @@ -137,8 +148,9 @@ open_directory (svn_stringbuf_t *name,
> static svn_error_t *
> close_directory (void *dir_baton)
> {
> - struct dir_baton *d = dir_baton;
> + struct trace_dir_baton *d = dir_baton;
> char statchar_buf[3] = "_ ";
> + struct trace_edit_baton *eb = d->edit_baton;
>
> if (d->prop_changed)
> {
> @@ -168,7 +180,12 @@ close_directory (void *dir_baton)
> else
> statchar_buf[1] = 'U';
>
> - printf ("%s %s\n", statchar_buf, d->path->data);
> + eb->trace_ui->print_message(
> + eb->ui_baton,
> + svn_stringbuf_createf(eb->pool,
> + "%s %s\n",
> + statchar_buf,
> + d->path->data));
> }
>
> return SVN_NO_ERROR;
> @@ -180,6 +197,7 @@ close_file (void *file_baton)
> {
> svn_error_t *err;
> struct file_baton *fb = file_baton;
> + struct edit_baton *eb = fb->parent_dir_baton->edit_baton;
> char statchar_buf[3] = "_ ";
>
> if (fb->added)
> @@ -235,7 +253,12 @@ close_file (void *file_baton)
> }
> }
>
> - printf ("%s %s\n", statchar_buf, fb->path->data);
> + eb->trace_ui->print_message(
> + eb->ui_baton,
> + svn_stringbuf_createf(eb->pool,
> + "%s %s\n",
> + statchar_buf,
> + fb->path->data));
>
> return SVN_NO_ERROR;
> }
> @@ -244,13 +267,17 @@ close_file (void *file_baton)
> static svn_error_t *
> close_edit (void *edit_baton)
> {
> + struct trace_edit_baton *eb = (struct trace_edit_baton *)edit_baton;
> +
> return SVN_NO_ERROR;
> }
>
>
> static svn_error_t *
> -window_handler (svn_txdelta_window_t *window, void *handler_pair)
> +window_handler (svn_txdelta_window_t *window, void *handler_baton)
> {
> + struct handler_baton *hb = (struct handler_baton *)handler_baton;
> +
> return SVN_NO_ERROR;
> }
>
> @@ -260,9 +287,15 @@ apply_textdelta (void *file_baton,
> svn_txdelta_window_handler_t *handler,
> void **handler_baton)
> {
> + struct handler_baton *hb;
> struct file_baton *fb = file_baton;
> + struct trace_edit_baton *eb = fb->parent_dir_baton->edit_baton;
> +
> + hb = apr_pcalloc(eb->pool, sizeof(*hb));
>
> + hb->edit_baton = eb;
> fb->text_changed = TRUE;
> *handler = window_handler;
> + *handler_baton = hb;
> return SVN_NO_ERROR;
> }
>
> @@ -274,12 +307,14 @@ add_file (svn_stringbuf_t *name,
> svn_revnum_t copyfrom_revision,
> void **file_baton)
> {
> - struct dir_baton *parent_d = parent_baton;
> - struct file_baton *child_fb
> - = apr_pcalloc (parent_d->edit_baton->pool, sizeof (*child_fb));
> + struct trace_dir_baton *parent_d = parent_baton;
> + struct file_baton *child_fb;
> + struct trace_edit_baton *eb = parent_d->edit_baton;
> +
> + child_fb = apr_pcalloc (eb->pool, sizeof (*child_fb));
>
> child_fb->parent_dir_baton = parent_d;
> - child_fb->path = svn_stringbuf_dup (parent_d->path,
> parent_d->edit_baton->pool);
> + child_fb->path = svn_stringbuf_dup (parent_d->path, eb->pool);
> svn_path_add_component (child_fb->path, name, svn_path_local_style);
> child_fb->added = TRUE;
>
> @@ -295,12 +330,14 @@ open_file (svn_stringbuf_t *name,
> svn_revnum_t ancestor_revision,
> void **file_baton)
> {
> - struct dir_baton *parent_d = parent_baton;
> - struct file_baton *child_fb
> - = apr_pcalloc (parent_d->edit_baton->pool, sizeof (*child_fb));
> + struct file_baton *child_fb;
> + struct trace_dir_baton *parent_d = parent_baton;
> + struct trace_edit_baton *eb = parent_d->edit_baton;
> +
> + child_fb = apr_pcalloc(eb->pool, sizeof (*child_fb));
>
> child_fb->parent_dir_baton = parent_d;
> - child_fb->path = svn_stringbuf_dup (parent_d->path,
> parent_d->edit_baton->pool);
> + child_fb->path = svn_stringbuf_dup (parent_d->path, eb->pool);
> svn_path_add_component (child_fb->path, name, svn_path_local_style);
>
> *file_baton = child_fb;
> @@ -315,8 +352,9 @@ change_file_prop (void *file_baton,
> svn_stringbuf_t *value)
> {
> struct file_baton *fb = file_baton;
> + struct trace_edit_baton *eb = fb->parent_dir_baton->edit_baton;
>
> - if (! svn_wc_is_wc_prop (name))
> + if (!svn_wc_is_wc_prop(name))
> fb->prop_changed = TRUE;
>
> return SVN_NO_ERROR;
> @@ -328,7 +366,8 @@ change_dir_prop (void *parent_baton,
> svn_stringbuf_t *name,
> svn_stringbuf_t *value)
> {
> - struct dir_baton *d = parent_baton;
> + struct trace_dir_baton *d = parent_baton;
> + struct trace_edit_baton *eb = d->edit_baton;
>
> if (! svn_wc_is_wc_prop (name))
> d->prop_changed = TRUE;
> @@ -336,24 +375,26 @@ change_dir_prop (void *parent_baton,
> return SVN_NO_ERROR;
> }
>
> -
> -
>
>
> svn_error_t *
> -svn_cl__get_trace_update_editor (const svn_delta_edit_fns_t **editor,
> - void **edit_baton,
> - svn_stringbuf_t *initial_path,
> - apr_pool_t *pool)
> +svn_client_get_trace_update_editor(const svn_delta_edit_fns_t **editor,
> + void **edit_baton,
> + const struct svn_client_trace_ui_fns
> *trace_ui,
> + void *ui_baton,
> + svn_stringbuf_t *initial_path,
> + apr_pool_t *pool)
> {
> /* Allocate an edit baton to be stored in every directory baton.
> Set it up for the directory baton we create here, which is the
> root baton. */
> - struct edit_baton *eb = apr_pcalloc (pool, sizeof (*eb));
> + struct trace_edit_baton *eb = apr_pcalloc (pool, sizeof (*eb));
> svn_delta_edit_fns_t *trace_editor = svn_delta_default_editor (pool);
>
> /* Set up the edit context. */
> eb->pool = svn_pool_create (pool);
> eb->initial_path = svn_stringbuf_dup (initial_path, eb->pool);
> + eb->ui_baton = ui_baton;
> + eb->trace_ui = trace_ui;
>
> /* Set up the editor. */
> trace_editor->open_root = open_root;
> diff -N -r -u -p cmdline/update-cmd.c
> c:\svn\subversion-NEW\subversion\clients\cmdline/update-cmd.c
> --- cmdline/update-cmd.c Wed Nov 28 20:42:51 2001
> +++ c:\svn\subversion-NEW\subversion\clients\cmdline/update-cmd.c
> Wed Nov 28 22:07:21 2001
> @@ -42,6 +42,9 @@ svn_cl__update (apr_getopt_t *os,
> apr_array_header_t *condensed_targets;
> int i;
> svn_client_auth_baton_t *auth_baton;
> + struct svn_client_trace_ui_fns trace_ui;
> +
> + trace_ui.print_message = &svn_cl__print_message;
>
> targets = svn_cl__args_to_target_array (os, pool);
>
> @@ -70,9 +73,11 @@ svn_cl__update (apr_getopt_t *os,
> &entry,
> pool));
>
> - SVN_ERR (svn_cl__get_trace_update_editor (&trace_editor,
> - &trace_edit_baton,
> - parent_dir, pool));
> + SVN_ERR (svn_client_get_trace_update_editor (&trace_editor,
> + &trace_edit_baton,
> + &trace_ui,
> + NULL,
> + parent_dir, pool));
>
> SVN_ERR (svn_client_update (NULL, NULL,
> trace_editor, trace_edit_baton,
> diff -N -r -u -p cmdline/util.c
> c:\svn\subversion-NEW\subversion\clients\cmdline/util.c
> --- cmdline/util.c Wed Nov 28 20:42:46 2001
> +++ c:\svn\subversion-NEW\subversion\clients\cmdline/util.c Wed Nov
> 28 22:01:35 2001
> @@ -237,6 +237,15 @@ svn_cl__get_canonical_command (const cha
> return cmd_desc;
> }
>
> +/* Used by the trace_update editor in libsvn_client
> + */
> +void
> +svn_cl__print_message(void *ui_baton,
> + svn_stringbuf_t *msg)
> +{
> + fputs(msg->data, stdout);
> +}
> +
>
>
>
> /*
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:49 2006

This is an archived mail posted to the Subversion Dev mailing list.