Alien-SVN
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_repos/reporter.c view on Meta::CPAN
/* Get the target path's properties */
SVN_ERR(svn_fs_node_proplist(&t_props, b->t_root, t_path, pool));
if (s_props && apr_hash_count(s_props))
{
/* Now transmit the differences. */
SVN_ERR(svn_prop_diffs(&prop_diffs, t_props, s_props, pool));
for (i = 0; i < prop_diffs->nelts; i++)
{
pc = &APR_ARRAY_IDX(prop_diffs, i, svn_prop_t);
SVN_ERR(change_fn(b, object, pc->name, pc->value, pool));
}
}
else if (apr_hash_count(t_props))
{
/* So source, i.e. all new. Transmit all target props. */
for (hi = apr_hash_first(pool, t_props); hi; hi = apr_hash_next(hi))
{
const void *key;
void *val;
apr_hash_this(hi, &key, NULL, &val);
SVN_ERR(change_fn(b, object, key, val, pool));
}
}
return SVN_NO_ERROR;
}
/* Baton type to be passed into send_zero_copy_delta.
*/
typedef struct zero_copy_baton_t
{
/* don't process data larger than this limit */
apr_size_t zero_copy_limit;
/* window handler and baton to send the data to */
svn_txdelta_window_handler_t dhandler;
void *dbaton;
/* return value: will be set to TRUE, if the data was processed. */
svn_boolean_t zero_copy_succeeded;
} zero_copy_baton_t;
/* Implement svn_fs_process_contents_func_t. If LEN is smaller than the
* limit given in *BATON, send the CONTENTS as an delta windows to the
* handler given in BATON and set the ZERO_COPY_SUCCEEDED flag in that
* BATON. Otherwise, reset it to FALSE.
* Use POOL for temporary allocations.
*/
static svn_error_t *
send_zero_copy_delta(const unsigned char *contents,
apr_size_t len,
void *baton,
apr_pool_t *pool)
{
zero_copy_baton_t *zero_copy_baton = baton;
/* if the item is too large, the caller must revert to traditional
streaming code. */
if (len > zero_copy_baton->zero_copy_limit)
{
zero_copy_baton->zero_copy_succeeded = FALSE;
return SVN_NO_ERROR;
}
SVN_ERR(svn_txdelta_send_contents(contents, len,
zero_copy_baton->dhandler,
zero_copy_baton->dbaton, pool));
/* all fine now */
zero_copy_baton->zero_copy_succeeded = TRUE;
return SVN_NO_ERROR;
}
/* Make the appropriate edits on FILE_BATON to change its contents and
properties from those in S_REV/S_PATH to those in B->t_root/T_PATH,
possibly using LOCK_TOKEN to determine if the client's lock on the file
is defunct. */
static svn_error_t *
delta_files(report_baton_t *b, void *file_baton, svn_revnum_t s_rev,
const char *s_path, const char *t_path, const char *lock_token,
apr_pool_t *pool)
{
svn_boolean_t changed;
svn_fs_root_t *s_root = NULL;
svn_txdelta_stream_t *dstream = NULL;
svn_checksum_t *s_checksum;
const char *s_hex_digest = NULL;
svn_txdelta_window_handler_t dhandler;
void *dbaton;
/* Compare the files' property lists. */
SVN_ERR(delta_proplists(b, s_rev, s_path, t_path, lock_token,
change_file_prop, file_baton, pool));
if (s_path)
{
SVN_ERR(get_source_root(b, &s_root, s_rev));
/* We're not interested in the theoretical difference between "has
contents which have not changed with respect to" and "has the same
actual contents as" when sending text-deltas. If we know the
delta is an empty one, we avoiding sending it in either case. */
SVN_ERR(svn_repos__compare_files(&changed, b->t_root, t_path,
s_root, s_path, pool));
if (!changed)
return SVN_NO_ERROR;
SVN_ERR(svn_fs_file_checksum(&s_checksum, svn_checksum_md5, s_root,
s_path, TRUE, pool));
s_hex_digest = svn_checksum_to_cstring(s_checksum, pool);
}
/* Send the delta stream if desired, or just a NULL window if not. */
SVN_ERR(b->editor->apply_textdelta(file_baton, s_hex_digest, pool,
&dhandler, &dbaton));
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.939 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )