Those are not necessarily "callbacks". In fact, it is generally
calling *forward*. Something calls svnpatch, and then that calls
something else. Not back to the original caller, but forward to
something else. If anything, this would be "svnpatch_vtable" or
somesuch. But even then, the name "editor" describes exactly what it
is: an svn_delta_editor_t.
I disagree with this rename. I agree that "diff_editor" is probably a
misnomer (not sure which side this is: generate, or apply the patch?)
But "svnpatch_editor" might be a better name.
Cheers,
-g
On Sat, Jun 6, 2009 at 00:36, Neels Janosch Hofmeyr<neels_at_elego.de> wrote:
> Author: neels
> Date: Fri Jun 5 15:36:05 2009
> New Revision: 37943
>
> Log:
> Cosmetic: clarify naming. An svn_delta_editor_t is used as a struct to keep a
> table of callbacks for svnpatch. Thus change its name from DIFF_EDITOR to
> SVNPATCH_CALLBACKS; there are so many other "diff_editor"s around already.
>
> * subversion/libsvn_client/repos_diff.c
> (get_svnpatch_diff_editor): Rename this to...
> (get_svnpatch_callbacks): ...this. Also rename some local vars.
> (struct edit_baton, delete_entry, close_file, close_directory,
> change_file_prop, change_dir_prop, close_edit, svn_client__get_diff_editor):
> Apply rename of edit_baton->diff_editor to svnpatch_callbacks.
>
> Index: subversion/libsvn_client/repos_diff.c
> ===================================================================
> --- subversion/libsvn_client/repos_diff.c (revision 37916)
> +++ subversion/libsvn_client/repos_diff.c (working copy)
> @@ -100,7 +100,7 @@ struct edit_baton {
> apr_off_t savepoint;
>
> /* Diff editor baton */
> - svn_delta_editor_t *diff_editor;
> + svn_delta_editor_t *svnpatch_callbacks;
>
> /* A token holder, helps to build the svnpatch. */
> int next_token;
> @@ -869,7 +869,7 @@ delete_entry(const char *path,
> }
>
> if (eb->svnpatch_stream)
> - SVN_ERR(eb->diff_editor->delete_entry
> + SVN_ERR(eb->svnpatch_callbacks->delete_entry
> (path, SVN_INVALID_REVNUM, pb, pool));
>
> return SVN_NO_ERROR;
> @@ -1266,7 +1266,7 @@ close_file(void *file_baton,
>
> if (binary_file && eb->svnpatch_stream)
> SVN_ERR(transmit_svndiff(b->path_end_revision,
> - eb->diff_editor, b, pool));
> + eb->svnpatch_callbacks, b, pool));
> }
>
>
> @@ -1323,7 +1323,7 @@ close_file(void *file_baton,
> if (binary_file && !b->added)
> svnpatch_release_savepoint(b, svn_node_file);
>
> - SVN_ERR(eb->diff_editor->close_file
> + SVN_ERR(eb->svnpatch_callbacks->close_file
> (b, binary_file ? text_checksum : NULL, b->pool));
> }
>
> @@ -1435,7 +1435,7 @@ close_directory(void *dir_baton,
> }
>
> if (eb->svnpatch_stream)
> - eb->diff_editor->close_directory(b, pool);
> + eb->svnpatch_callbacks->close_directory(b, pool);
>
> return SVN_NO_ERROR;
> }
> @@ -1463,7 +1463,7 @@ change_file_prop(void *file_baton,
> /* Restrict to Regular Properties. */
> if (eb->svnpatch_stream
> && svn_property_kind(NULL, name) == svn_prop_regular_kind)
> - SVN_ERR(eb->diff_editor->change_file_prop
> + SVN_ERR(eb->svnpatch_callbacks->change_file_prop
> (b, name, value, pool));
>
> return SVN_NO_ERROR;
> @@ -1491,7 +1491,7 @@ change_dir_prop(void *dir_baton,
> /* Restrict to Regular Properties. */
> if (eb->svnpatch_stream
> && svn_property_kind(NULL, name) == svn_prop_regular_kind)
> - SVN_ERR(eb->diff_editor->change_dir_prop
> + SVN_ERR(eb->svnpatch_callbacks->change_dir_prop
> (dir_baton, name, value, pool));
>
> return SVN_NO_ERROR;
> @@ -1506,7 +1506,7 @@ close_edit(void *edit_baton,
> struct edit_baton *eb = edit_baton;
>
> if (eb->svnpatch_stream)
> - SVN_ERR(eb->diff_editor->close_edit(eb, pool));
> + SVN_ERR(eb->svnpatch_callbacks->close_edit(eb, pool));
>
> svn_pool_destroy(eb->pool);
>
> @@ -1579,22 +1579,22 @@ absent_file(const char *path,
> * drive is being performed by transmit_svndiff() against binary files
> * to generate svndiffs and txdelta Editor Commands though. */
> static void
> -get_svnpatch_diff_editor(svn_delta_editor_t **editor,
> - apr_pool_t *pool)
> +get_svnpatch_callbacks(svn_delta_editor_t **callbacks,
> + apr_pool_t *pool)
> {
> - svn_delta_editor_t *diff_editor;
> + svn_delta_editor_t *cb;
>
> - diff_editor = svn_delta_default_editor(pool);
> + cb = svn_delta_default_editor(pool);
>
> - diff_editor->delete_entry = svnpatch_delete_entry;
> - diff_editor->close_directory = svnpatch_close_directory;
> - diff_editor->apply_textdelta = svnpatch_apply_textdelta;
> - diff_editor->change_file_prop = svnpatch_change_file_prop;
> - diff_editor->change_dir_prop = svnpatch_change_dir_prop;
> - diff_editor->close_file = svnpatch_close_file;
> - diff_editor->close_edit = svnpatch_close_edit;
> + cb->delete_entry = svnpatch_delete_entry;
> + cb->close_directory = svnpatch_close_directory;
> + cb->apply_textdelta = svnpatch_apply_textdelta;
> + cb->change_file_prop = svnpatch_change_file_prop;
> + cb->change_dir_prop = svnpatch_change_dir_prop;
> + cb->close_file = svnpatch_close_file;
> + cb->close_edit = svnpatch_close_edit;
>
> - *editor = diff_editor;
> + *callbacks = cb;
> }
>
> /* Create a repository diff editor and baton. */
> @@ -1635,7 +1635,7 @@ svn_client__get_diff_editor(const char *
> eb->notify_baton = notify_baton;
> eb->next_token = 0;
> eb->savepoint = 0;
> - eb->diff_editor = NULL;
> + eb->svnpatch_callbacks = NULL;
> eb->svnpatch_stream = NULL;
> eb->svnpatch_file = svnpatch_file;
>
> @@ -1644,7 +1644,7 @@ svn_client__get_diff_editor(const char *
> eb->svnpatch_stream =
> svn_stream_from_aprfile2(eb->svnpatch_file,
> FALSE, eb->pool);
> - get_svnpatch_diff_editor(&eb->diff_editor, eb->pool);
> + get_svnpatch_callbacks(&eb->svnpatch_callbacks, eb->pool);
> }
>
> tree_editor->set_target_revision = set_target_revision;
>
> Modified:
> trunk/subversion/libsvn_client/repos_diff.c
>
> Modified: trunk/subversion/libsvn_client/repos_diff.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/repos_diff.c?pathrev=37943&r1=37942&r2=37943
> ==============================================================================
> --- trunk/subversion/libsvn_client/repos_diff.c Fri Jun 5 13:08:03 2009 (r37942)
> +++ trunk/subversion/libsvn_client/repos_diff.c Fri Jun 5 15:36:05 2009 (r37943)
> @@ -100,7 +100,7 @@ struct edit_baton {
> apr_off_t savepoint;
>
> /* Diff editor baton */
> - svn_delta_editor_t *diff_editor;
> + svn_delta_editor_t *svnpatch_callbacks;
>
> /* A token holder, helps to build the svnpatch. */
> int next_token;
> @@ -869,7 +869,7 @@ delete_entry(const char *path,
> }
>
> if (eb->svnpatch_stream)
> - SVN_ERR(eb->diff_editor->delete_entry
> + SVN_ERR(eb->svnpatch_callbacks->delete_entry
> (path, SVN_INVALID_REVNUM, pb, pool));
>
> return SVN_NO_ERROR;
> @@ -1266,7 +1266,7 @@ close_file(void *file_baton,
>
> if (binary_file && eb->svnpatch_stream)
> SVN_ERR(transmit_svndiff(b->path_end_revision,
> - eb->diff_editor, b, pool));
> + eb->svnpatch_callbacks, b, pool));
> }
>
>
> @@ -1323,7 +1323,7 @@ close_file(void *file_baton,
> if (binary_file && !b->added)
> svnpatch_release_savepoint(b, svn_node_file);
>
> - SVN_ERR(eb->diff_editor->close_file
> + SVN_ERR(eb->svnpatch_callbacks->close_file
> (b, binary_file ? text_checksum : NULL, b->pool));
> }
>
> @@ -1435,7 +1435,7 @@ close_directory(void *dir_baton,
> }
>
> if (eb->svnpatch_stream)
> - eb->diff_editor->close_directory(b, pool);
> + eb->svnpatch_callbacks->close_directory(b, pool);
>
> return SVN_NO_ERROR;
> }
> @@ -1463,7 +1463,7 @@ change_file_prop(void *file_baton,
> /* Restrict to Regular Properties. */
> if (eb->svnpatch_stream
> && svn_property_kind(NULL, name) == svn_prop_regular_kind)
> - SVN_ERR(eb->diff_editor->change_file_prop
> + SVN_ERR(eb->svnpatch_callbacks->change_file_prop
> (b, name, value, pool));
>
> return SVN_NO_ERROR;
> @@ -1491,7 +1491,7 @@ change_dir_prop(void *dir_baton,
> /* Restrict to Regular Properties. */
> if (eb->svnpatch_stream
> && svn_property_kind(NULL, name) == svn_prop_regular_kind)
> - SVN_ERR(eb->diff_editor->change_dir_prop
> + SVN_ERR(eb->svnpatch_callbacks->change_dir_prop
> (dir_baton, name, value, pool));
>
> return SVN_NO_ERROR;
> @@ -1506,7 +1506,7 @@ close_edit(void *edit_baton,
> struct edit_baton *eb = edit_baton;
>
> if (eb->svnpatch_stream)
> - SVN_ERR(eb->diff_editor->close_edit(eb, pool));
> + SVN_ERR(eb->svnpatch_callbacks->close_edit(eb, pool));
>
> svn_pool_destroy(eb->pool);
>
> @@ -1579,22 +1579,22 @@ absent_file(const char *path,
> * drive is being performed by transmit_svndiff() against binary files
> * to generate svndiffs and txdelta Editor Commands though. */
> static void
> -get_svnpatch_diff_editor(svn_delta_editor_t **editor,
> - apr_pool_t *pool)
> +get_svnpatch_callbacks(svn_delta_editor_t **callbacks,
> + apr_pool_t *pool)
> {
> - svn_delta_editor_t *diff_editor;
> + svn_delta_editor_t *cb;
>
> - diff_editor = svn_delta_default_editor(pool);
> + cb = svn_delta_default_editor(pool);
>
> - diff_editor->delete_entry = svnpatch_delete_entry;
> - diff_editor->close_directory = svnpatch_close_directory;
> - diff_editor->apply_textdelta = svnpatch_apply_textdelta;
> - diff_editor->change_file_prop = svnpatch_change_file_prop;
> - diff_editor->change_dir_prop = svnpatch_change_dir_prop;
> - diff_editor->close_file = svnpatch_close_file;
> - diff_editor->close_edit = svnpatch_close_edit;
> + cb->delete_entry = svnpatch_delete_entry;
> + cb->close_directory = svnpatch_close_directory;
> + cb->apply_textdelta = svnpatch_apply_textdelta;
> + cb->change_file_prop = svnpatch_change_file_prop;
> + cb->change_dir_prop = svnpatch_change_dir_prop;
> + cb->close_file = svnpatch_close_file;
> + cb->close_edit = svnpatch_close_edit;
>
> - *editor = diff_editor;
> + *callbacks = cb;
> }
>
> /* Create a repository diff editor and baton. */
> @@ -1635,7 +1635,7 @@ svn_client__get_diff_editor(const char *
> eb->notify_baton = notify_baton;
> eb->next_token = 0;
> eb->savepoint = 0;
> - eb->diff_editor = NULL;
> + eb->svnpatch_callbacks = NULL;
> eb->svnpatch_stream = NULL;
> eb->svnpatch_file = svnpatch_file;
>
> @@ -1644,7 +1644,7 @@ svn_client__get_diff_editor(const char *
> eb->svnpatch_stream =
> svn_stream_from_aprfile2(eb->svnpatch_file,
> FALSE, eb->pool);
> - get_svnpatch_diff_editor(&eb->diff_editor, eb->pool);
> + get_svnpatch_callbacks(&eb->svnpatch_callbacks, eb->pool);
> }
>
> tree_editor->set_target_revision = set_target_revision;
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2359852
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2360064
Received on 2009-06-07 09:15:59 CEST