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