On Fri, Apr 27, 2012 at 8:50 PM, <gstein_at_apache.org> wrote:
> Author: gstein
> Date: Sat Apr 28 01:50:35 2012
> New Revision: 1331652
>
> URL: http://svn.apache.org/viewvc?rev=1331652&view=rev
> Log:
> For the Ev2 shims:
>
> Revamp the Ev2/Ev1 shims by using struct change_node rather than the
> funky "operation" records and the build() function. Each Ev2 callback
> simply inserts a new change_node structure with some values in
> it. Later, we use the path_driver to apply these change_node
> structures to all modified paths.
>
> This obsoletes huge chunks of code; to be removed in a future revision.
>
> Test failures: log 38, merge 105.
>
> * subversion/libsvn_delta/compat.c:
> Â (process_actions): remove an incorrect assertion
> Â (struct editor_baton): add a CHANGES hash
> Â (insert_change): new helper function, similar to locate_change()
> Â (add_directory_cb, add_file_cb, add_absent_cb, delete_cb): add code
> Â Â blocks for setting up change records
> Â (add_symlink_cb): #if this whole thing out, and add SVN__NOT_IMPLEMENTED()
> Â (alter_directory_cb, alter_file_cb): set up change records, noting
> Â Â that the record could have been created by an earlier copy/move.
> Â (copy_cb): set up change records. use the FETCH_KIND_FUNC callback
> Â Â to fetch kind information about the source (so we know what Ev1
> Â function to invoke for the destination)
> Â (move_cb): set up a change record for the source/deletion side, and
> Â Â the destination/copy side. use the FETCH_KIND_FUNC callback.
> Â (drive_ev1_props): helpful utility function to drive a series of
> Â Â single property changes (adds, modifies, deletes) to the Ev1
> Â Â editor. this helper also manages the special "unlock" mechanism
> Â (apply_change): apply all changes described in a change_node
> Â Â structure to a specified node
> Â (drive_changes): if any changes have been made (eg. start_edit_func
> Â Â was called an the root baton opened), then prepare a list of paths
> Â Â for the path_driver, and then run the sucker to make all the
> Â Â necessary edits. we have some special sneakiness to ensure the
> Â Â path_driver doesn't call open_root() a second time.
> Â (complete_cb, abort_cb): use drive_changes() rather than drive_root()
> Â (start_edit_func): leave a note about early-open of the root
> Â (do_unlock): record UNLOCK in the change_node. this will be handled
> Â Â by drive_ev1_props() later.
> Â (svn_delta__editor_from_delta): create the new CHANGES hash
>
> Modified:
> Â Â subversion/trunk/subversion/libsvn_delta/compat.c
>
> Modified: subversion/trunk/subversion/libsvn_delta/compat.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1331652&r1=1331651&r2=1331652&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_delta/compat.c (original)
> +++ subversion/trunk/subversion/libsvn_delta/compat.c Sat Apr 28 01:50:35 2012
> @@ -434,8 +434,12 @@ process_actions(struct ev2_edit_baton *e
> Â if (props || contents)
> Â Â {
> Â Â Â /* Changes to properties or content should have indicated the revision
> - Â Â Â Â it was intending to change. Â */
> + Â Â Â Â it was intending to change.
> +
> + Â Â Â Â Oop. Not true. The node may be locally-added. Â */
> +#if 0
> Â Â Â SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(change->changing));
> +#endif
>
> Â Â Â if (kind == svn_kind_dir)
> Â Â Â Â SVN_ERR(svn_editor_alter_directory(eb->editor, repos_relpath,
> @@ -1042,10 +1046,38 @@ struct editor_baton
> Â const char *repos_root;
> Â const char *base_relpath;
>
> + Â /* REPOS_RELPATH -> struct change_node * Â */
> + Â apr_hash_t *changes;
> +
> Â apr_pool_t *edit_pool;
> Â };
>
>
> +/* Insert a new change for RELPATH, or return an existing one. Â */
> +static struct change_node *
> +insert_change(const char *relpath,
> + Â Â Â Â Â Â Â apr_hash_t *changes)
> +{
> + Â apr_pool_t *result_pool;
> + Â struct change_node *change;
> +
> + Â change = apr_hash_get(changes, relpath, APR_HASH_KEY_STRING);
> + Â if (change != NULL)
> + Â Â return change;
> +
> + Â result_pool = apr_hash_pool_get(changes);
> +
> + Â /* Return an empty change. Callers will tweak as needed. Â */
> + Â change = apr_pcalloc(result_pool, sizeof(*change));
> + Â change->changing = SVN_INVALID_REVNUM;
> + Â change->deleting = SVN_INVALID_REVNUM;
> +
> + Â apr_hash_set(changes, relpath, APR_HASH_KEY_STRING, change);
As the key of the hash, RELPATH should be duplicated into a pool with
sufficient lifetime.
>...
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2012-05-01 03:38:16 CEST