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

Re: svn commit: r26220 - in branches/copy-on-update/subversion: libsvn_repos libsvn_wc

From: Vlad Georgescu <vgeorgescu_at_gmail.com>
Date: 2007-08-21 18:08:11 CEST

Hi,

sussman@tigris.org wrote:
> Log:
> First step in making updates copy files: have server send copyfrom args.
> [...]
> +/* Call the B->editor's add_file() function to create PATH as a child
> + of PARENT_BATON, returning a new baton in *NEW_FILE_BATON.
> + However, make an attempt to send 'copyfrom' arguments if they're
> + available, by examining the closest copy of the original file
> + O_PATH within B->t_root. If any copyfrom args are discovered,
> + return those in *COPYFROM_PATH and *COPYFROM_REV; otherwise leave
> + those return args untouched. */
> +static svn_error_t *
> +add_file_smartly(report_baton_t *b,
> + const char *path,
> + void *parent_baton,
> + const char *o_path,
> + void **new_file_baton,
> + const char **copyfrom_path,
> + svn_revnum_t *copyfrom_rev,
> + apr_pool_t *pool)
> +{
> + // ### TODO: use a subpool to do this work, clear it at the end?
> + svn_fs_t *fs = svn_repos_fs(b->repos);
> + svn_fs_root_t *closest_copy_root = NULL;
> + const char *closest_copy_path = NULL;
> + svn_revnum_t my_copyfrom_rev = SVN_INVALID_REVNUM;
> + const char *my_copyfrom_path = NULL;
> +
> + /* Find the destination of the nearest 'copy event' which may have
> + caused o_path@t_root to exist. */
> + SVN_ERR(svn_fs_closest_copy(&closest_copy_root, &closest_copy_path,
> + b->t_root, o_path, pool));
> + if (closest_copy_root != NULL)
> + {
> + /* If the destination of the copy event is the same path as
> + o_path, then we've found something interesting that should
> + have 'copyfrom' history. */
> + if (strcmp(closest_copy_path + 1, o_path) == 0)
> + {
> + SVN_ERR(svn_fs_copied_from(&my_copyfrom_rev, &my_copyfrom_path,
> + closest_copy_root, closest_copy_path,
> + pool));
> + *copyfrom_path = my_copyfrom_path;
> + *copyfrom_rev = my_copyfrom_rev;
> + }
> + }
> +

You should probably check authz on the copyfrom path, and set
*copyfrom_path to NULL if the check fails (so that we fall back to
delta-against-empty-file later).

-- 
Vlad
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 21 18:06:00 2007

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