static svn_error_t * file_textdelta(void *file_baton, const char *base_checksum, apr_pool_t *result_pool, svn_txdelta_window_handler_t *handler, void **handler_baton) { struct file_baton_t *fb = file_baton; svn_stream_t *target; SVN_ERR_ASSERT(! fb->writing); SVN_ERR(svn_stream_open_writable(&target, fb->local_abspath, fb->pool, fb->pool)); fb->writing = TRUE; svn_txdelta_apply(svn_stream_empty(fb->pool) /* source */, target, fb->digest, fb->local_abspath, fb->pool, /* Provide the handler directly */ handler, handler_baton); return SVN_NO_ERROR; }
svn_error_t *svn_txdelta_send_stream(svn_stream_t *stream, svn_txdelta_window_handler_t handler, void *handler_baton, unsigned char *digest, apr_pool_t *pool) { svn_txdelta_stream_t *txstream; svn_error_t *err; /* ### this is a hack. we should simply read from the stream, construct ### some windows, and pass those to the handler. there isn't any reason ### to crank up a full "diff" algorithm just to copy a stream. ### ### will fix RSN. */ /* Create a delta stream which converts an *empty* bytestream into the target bytestream. */ svn_txdelta(&txstream, svn_stream_empty(pool), stream, pool); err = svn_txdelta_send_txstream(txstream, handler, handler_baton, pool); if (digest && (! err)) { const unsigned char *result_md5; result_md5 = svn_txdelta_md5_digest(txstream); /* Since err is null, result_md5 "cannot" be null. */ memcpy(digest, result_md5, APR_MD5_DIGESTSIZE); } return err; }
svn_stream_t * svn_stream_from_aprfile2(apr_file_t *file, svn_boolean_t disown, apr_pool_t *pool) { struct baton_apr *baton; svn_stream_t *stream; if (file == NULL) return svn_stream_empty(pool); baton = apr_palloc(pool, sizeof(*baton)); baton->file = file; baton->pool = pool; stream = svn_stream_create(baton, pool); svn_stream_set_read(stream, read_handler_apr); svn_stream_set_write(stream, write_handler_apr); svn_stream_set_skip(stream, skip_handler_apr); svn_stream_set_mark(stream, mark_handler_apr); svn_stream_set_seek(stream, seek_handler_apr); svn_stream__set_is_buffered(stream, is_buffered_handler_apr); if (! disown) svn_stream_set_close(stream, close_handler_apr); return stream; }
static int l_cat (lua_State *L) { const char *path = luaL_checkstring (L, 1); svn_opt_revision_t peg_revision; svn_opt_revision_t revision; peg_revision.kind = svn_opt_revision_unspecified; if (lua_gettop (L) < 2 || lua_isnil (L, 2)) { revision.kind = get_revision_kind (path); } else { revision.kind = svn_opt_revision_number; revision.value.number = lua_tointeger (L, 2); } apr_pool_t *pool; svn_error_t *err; svn_client_ctx_t *ctx; init_function (&ctx, &pool, L); path = svn_path_canonicalize (path, pool); svn_stream_t *stream; stream = svn_stream_empty (pool); svn_stream_set_write (stream, write_fn); svn_stringbuf_t *buffer = svn_stringbuf_create ("\0", pool); svn_stream_set_baton (stream, buffer); err = svn_client_cat2 (stream, path, &peg_revision, &revision, ctx, pool); IF_ERROR_RETURN (err, pool, L); lua_pushstring (L, buffer->data); svn_pool_destroy (pool); return 1; }
/* Subversion delta editor callback */ static svn_error_t *de_apply_textdelta(void *file_baton, const char *base_checksum, apr_pool_t *pool, svn_txdelta_window_handler_t *handler, void **handler_baton) { apr_file_t *src_file = NULL, *dest_file = NULL; svn_stream_t *src_stream, *dest_stream; de_node_baton_t *node = (de_node_baton_t *)file_baton; dump_options_t *opts = node->de_baton->opts; #ifdef USE_TIMING stopwatch_t watch = stopwatch_create(); #endif char *filename; DEBUG_MSG("de_apply_textdelta(%s)\n", node->path); /* Create a new temporary file to write to */ node->filename = apr_psprintf(node->pool, "%s/XXXXXX", opts->temp_dir); apr_file_mktemp(&dest_file, node->filename, APR_CREATE | APR_READ | APR_WRITE | APR_EXCL, pool); dest_stream = svn_stream_from_aprfile2(dest_file, FALSE, pool); /* Update the local copy */ filename = rhash_get(delta_hash, node->path, APR_HASH_KEY_STRING); if (filename == NULL) { src_stream = svn_stream_empty(pool); } else { apr_file_open(&src_file, filename, APR_READ, 0600, pool); src_stream = svn_stream_from_aprfile2(src_file, FALSE, pool); } svn_txdelta_apply(src_stream, dest_stream, node->md5sum, node->path, pool, handler, handler_baton); node->old_filename = apr_pstrdup(node->pool, filename); rhash_set(delta_hash, node->path, APR_HASH_KEY_STRING, node->filename, RHASH_VAL_STRING); DEBUG_MSG("applied delta: %s -> %s\n", node->old_filename, node->filename); node->applied_delta = 1; node->dump_needed = 1; #ifdef USE_TIMING tm_de_apply_textdelta += stopwatch_elapsed(&watch); #endif return SVN_NO_ERROR; }
svn_ra_svn__stream_t * svn_ra_svn__stream_create(void *baton, svn_read_fn_t read_cb, svn_write_fn_t write_cb, ra_svn_timeout_fn_t timeout_cb, ra_svn_pending_fn_t pending_cb, apr_pool_t *pool) { svn_ra_svn__stream_t *s = apr_palloc(pool, sizeof(*s)); s->stream = svn_stream_empty(pool); svn_stream_set_baton(s->stream, baton); if (read_cb) svn_stream_set_read(s->stream, read_cb); if (write_cb) svn_stream_set_write(s->stream, write_cb); s->baton = baton; s->timeout_fn = timeout_cb; s->pending_fn = pending_cb; return s; }
svn_stream_t * svn_stream_from_string(const svn_string_t *str, apr_pool_t *pool) { svn_stream_t *stream; struct string_stream_baton *baton; if (! str) return svn_stream_empty(pool); baton = apr_palloc(pool, sizeof(*baton)); baton->str = str; baton->amt_read = 0; stream = svn_stream_create(baton, pool); svn_stream_set_read(stream, read_handler_string); svn_stream_set_mark(stream, mark_handler_string); svn_stream_set_seek(stream, seek_handler_string); svn_stream_set_skip(stream, skip_handler_string); svn_stream__set_is_buffered(stream, is_buffered_handler_string); return stream; }
static svn_error_t * file_textdelta(void *file_baton, const char *base_checksum, apr_pool_t *result_pool, svn_txdelta_window_handler_t *handler, void **handler_baton) { struct file_baton_t *fb = file_baton; const char *target_dir = svn_dirent_dirname(fb->local_abspath, fb->pool); svn_error_t *err; svn_stream_t *source; svn_stream_t *target; SVN_ERR_ASSERT(! fb->writing_file); err = svn_stream_open_readonly(&source, fb->local_abspath, fb->pool, fb->pool); if (err && APR_STATUS_IS_ENOENT(err->apr_err)) { svn_error_clear(err); source = svn_stream_empty(fb->pool); } else SVN_ERR(err); SVN_ERR(svn_stream_open_unique(&target, &fb->writing_file, target_dir, svn_io_file_del_none, fb->pool, fb->pool)); svn_txdelta_apply(source, target, fb->digest, fb->local_abspath, fb->pool, /* Provide the handler directly */ handler, handler_baton); return SVN_NO_ERROR; }
/* Deltifies a node, i.e. generates a svndiff that can be dumped */ static svn_error_t *delta_deltify_node(de_node_baton_t *node) { svn_txdelta_stream_t *stream; svn_txdelta_window_handler_t handler; void *handler_baton; svn_stream_t *source, *target, *dest; apr_file_t *source_file = NULL, *target_file = NULL, *dest_file = NULL; dump_options_t *opts = node->de_baton->opts; apr_pool_t *pool = svn_pool_create(node->pool); svn_error_t *err; DEBUG_MSG("delta_deltify_node(%s): %s -> %s\n", node->path, node->old_filename, node->filename); /* Open source and target */ apr_file_open(&target_file, node->filename, APR_READ, 0600, pool); target = svn_stream_from_aprfile2(target_file, FALSE, pool); if (node->old_filename) { apr_file_open(&source_file, node->old_filename, APR_READ, 0600, pool); source = svn_stream_from_aprfile2(source_file, FALSE, pool); } else { source = svn_stream_empty(pool); } /* Open temporary output file */ node->delta_filename = apr_psprintf(node->pool, "%s/XXXXXX", opts->temp_dir); apr_file_mktemp(&dest_file, node->delta_filename, APR_CREATE | APR_READ | APR_WRITE | APR_EXCL, pool); dest = svn_stream_from_aprfile2(dest_file, FALSE, pool); DEBUG_MSG("delta_deltify_node(%s): writing to %s\n", node->path, node->delta_filename); /* Produce delta in svndiff format */ svn_txdelta(&stream, source, target, pool); svn_txdelta_to_svndiff2(&handler, &handler_baton, dest, 0, pool); err = svn_txdelta_send_txstream(stream, handler, handler_baton, pool); svn_pool_destroy(pool); return err; }
static svn_error_t * bench_null_export(svn_revnum_t *result_rev, const char *from_path_or_url, svn_opt_revision_t *peg_revision, svn_opt_revision_t *revision, svn_depth_t depth, void *baton, svn_client_ctx_t *ctx, svn_boolean_t quiet, apr_pool_t *pool) { svn_revnum_t edit_revision = SVN_INVALID_REVNUM; svn_boolean_t from_is_url = svn_path_is_url(from_path_or_url); SVN_ERR_ASSERT(peg_revision != NULL); SVN_ERR_ASSERT(revision != NULL); if (peg_revision->kind == svn_opt_revision_unspecified) peg_revision->kind = svn_path_is_url(from_path_or_url) ? svn_opt_revision_head : svn_opt_revision_working; if (revision->kind == svn_opt_revision_unspecified) revision = peg_revision; if (from_is_url || ! SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(revision->kind)) { svn_client__pathrev_t *loc; svn_ra_session_t *ra_session; svn_node_kind_t kind; /* Get the RA connection. */ SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &loc, from_path_or_url, NULL, peg_revision, revision, ctx, pool)); SVN_ERR(svn_ra_check_path(ra_session, "", loc->rev, &kind, pool)); if (kind == svn_node_file) { apr_hash_t *props; /* Since you cannot actually root an editor at a file, we * manually drive a few functions of our editor. */ /* Step outside the editor-likeness for a moment, to actually talk * to the repository. */ /* ### note: the stream will not be closed */ SVN_ERR(svn_ra_get_file(ra_session, "", loc->rev, svn_stream_empty(pool), NULL, &props, pool)); } else if (kind == svn_node_dir) { void *edit_baton = NULL; const svn_delta_editor_t *export_editor = NULL; const svn_ra_reporter3_t *reporter; void *report_baton; svn_delta_editor_t *editor = svn_delta_default_editor(pool); editor->set_target_revision = set_target_revision; editor->open_root = open_root; editor->add_directory = add_directory; editor->add_file = add_file; editor->apply_textdelta = apply_textdelta; editor->close_file = close_file; editor->change_file_prop = change_file_prop; editor->change_dir_prop = change_dir_prop; /* for ra_svn, we don't need an editior in quiet mode */ if (!quiet || strncmp(loc->repos_root_url, "svn:", 4)) SVN_ERR(svn_delta_get_cancellation_editor(ctx->cancel_func, ctx->cancel_baton, editor, baton, &export_editor, &edit_baton, pool)); /* Manufacture a basic 'report' to the update reporter. */ SVN_ERR(svn_ra_do_update3(ra_session, &reporter, &report_baton, loc->rev, "", /* no sub-target */ depth, FALSE, /* don't want copyfrom-args */ FALSE, /* don't want ignore_ancestry */ export_editor, edit_baton, pool, pool)); SVN_ERR(reporter->set_path(report_baton, "", loc->rev, /* Depth is irrelevant, as we're passing start_empty=TRUE anyway. */ svn_depth_infinity, TRUE, /* "help, my dir is empty!" */ NULL, pool)); SVN_ERR(reporter->finish_report(report_baton, pool)); } else if (kind == svn_node_none) { return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL, _("URL '%s' doesn't exist"), from_path_or_url); } /* kind == svn_node_unknown not handled */ } if (result_rev) *result_rev = edit_revision; return SVN_NO_ERROR; }
/* The main dumper. */ svn_error_t * svn_repos_dump_fs3(svn_repos_t *repos, svn_stream_t *stream, svn_revnum_t start_rev, svn_revnum_t end_rev, svn_boolean_t incremental, svn_boolean_t use_deltas, svn_repos_notify_func_t notify_func, void *notify_baton, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) { const svn_delta_editor_t *dump_editor; void *dump_edit_baton = NULL; svn_revnum_t i; svn_fs_t *fs = svn_repos_fs(repos); apr_pool_t *subpool = svn_pool_create(pool); svn_revnum_t youngest; const char *uuid; int version; svn_boolean_t found_old_reference = FALSE; svn_boolean_t found_old_mergeinfo = FALSE; svn_repos_notify_t *notify; /* Determine the current youngest revision of the filesystem. */ SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool)); /* Use default vals if necessary. */ if (! SVN_IS_VALID_REVNUM(start_rev)) start_rev = 0; if (! SVN_IS_VALID_REVNUM(end_rev)) end_rev = youngest; if (! stream) stream = svn_stream_empty(pool); /* Validate the revisions. */ if (start_rev > end_rev) return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL, _("Start revision %ld" " is greater than end revision %ld"), start_rev, end_rev); if (end_rev > youngest) return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL, _("End revision %ld is invalid " "(youngest revision is %ld)"), end_rev, youngest); if ((start_rev == 0) && incremental) incremental = FALSE; /* revision 0 looks the same regardless of whether or not this is an incremental dump, so just simplify things. */ /* Write out the UUID. */ SVN_ERR(svn_fs_get_uuid(fs, &uuid, pool)); /* If we're not using deltas, use the previous version, for compatibility with svn 1.0.x. */ version = SVN_REPOS_DUMPFILE_FORMAT_VERSION; if (!use_deltas) version--; /* Write out "general" metadata for the dumpfile. In this case, a magic header followed by a dumpfile format version. */ SVN_ERR(svn_stream_printf(stream, pool, SVN_REPOS_DUMPFILE_MAGIC_HEADER ": %d\n\n", version)); SVN_ERR(svn_stream_printf(stream, pool, SVN_REPOS_DUMPFILE_UUID ": %s\n\n", uuid)); /* Create a notify object that we can reuse in the loop. */ if (notify_func) notify = svn_repos_notify_create(svn_repos_notify_dump_rev_end, pool); /* Main loop: we're going to dump revision i. */ for (i = start_rev; i <= end_rev; i++) { svn_revnum_t from_rev, to_rev; svn_fs_root_t *to_root; svn_boolean_t use_deltas_for_rev; svn_pool_clear(subpool); /* Check for cancellation. */ if (cancel_func) SVN_ERR(cancel_func(cancel_baton)); /* Special-case the initial revision dump: it needs to contain *all* nodes, because it's the foundation of all future revisions in the dumpfile. */ if ((i == start_rev) && (! incremental)) { /* Special-special-case a dump of revision 0. */ if (i == 0) { /* Just write out the one revision 0 record and move on. The parser might want to use its properties. */ SVN_ERR(write_revision_record(stream, fs, 0, subpool)); to_rev = 0; goto loop_end; } /* Compare START_REV to revision 0, so that everything appears to be added. */ from_rev = 0; to_rev = i; } else { /* In the normal case, we want to compare consecutive revs. */ from_rev = i - 1; to_rev = i; } /* Write the revision record. */ SVN_ERR(write_revision_record(stream, fs, to_rev, subpool)); /* Fetch the editor which dumps nodes to a file. Regardless of what we've been told, don't use deltas for the first rev of a non-incremental dump. */ use_deltas_for_rev = use_deltas && (incremental || i != start_rev); SVN_ERR(get_dump_editor(&dump_editor, &dump_edit_baton, fs, to_rev, "", stream, notify_func, notify_baton, start_rev, use_deltas_for_rev, FALSE, subpool)); /* Drive the editor in one way or another. */ SVN_ERR(svn_fs_revision_root(&to_root, fs, to_rev, subpool)); /* If this is the first revision of a non-incremental dump, we're in for a full tree dump. Otherwise, we want to simply replay the revision. */ if ((i == start_rev) && (! incremental)) { svn_fs_root_t *from_root; SVN_ERR(svn_fs_revision_root(&from_root, fs, from_rev, subpool)); SVN_ERR(svn_repos_dir_delta2(from_root, "", "", to_root, "", dump_editor, dump_edit_baton, NULL, NULL, FALSE, /* don't send text-deltas */ svn_depth_infinity, FALSE, /* don't send entry props */ FALSE, /* don't ignore ancestry */ subpool)); } else { SVN_ERR(svn_repos_replay2(to_root, "", SVN_INVALID_REVNUM, FALSE, dump_editor, dump_edit_baton, NULL, NULL, subpool)); } loop_end: if (notify_func) { notify->revision = to_rev; notify_func(notify_baton, notify, subpool); } if (dump_edit_baton) /* We never get an edit baton for r0. */ { if (((struct edit_baton *)dump_edit_baton)->found_old_reference) found_old_reference = TRUE; if (((struct edit_baton *)dump_edit_baton)->found_old_mergeinfo) found_old_mergeinfo = TRUE; } } if (notify_func) { /* Did we issue any warnings about references to revisions older than the oldest dumped revision? If so, then issue a final generic warning, since the inline warnings already issued might easily be missed. */ notify = svn_repos_notify_create(svn_repos_notify_dump_end, subpool); notify_func(notify_baton, notify, subpool); if (found_old_reference) { notify = svn_repos_notify_create(svn_repos_notify_warning, subpool); notify->warning = svn_repos_notify_warning_found_old_reference; notify->warning_str = _("The range of revisions dumped " "contained references to " "copy sources outside that " "range."); notify_func(notify_baton, notify, subpool); } /* Ditto if we issued any warnings about old revisions referenced in dumped mergeinfo. */ if (found_old_mergeinfo) { notify = svn_repos_notify_create(svn_repos_notify_warning, subpool); notify->warning = svn_repos_notify_warning_found_old_mergeinfo; notify->warning_str = _("The range of revisions dumped " "contained mergeinfo " "which reference revisions outside " "that range."); notify_func(notify_baton, notify, subpool); } } svn_pool_destroy(subpool); return SVN_NO_ERROR; }
svn_error_t * svn_repos_verify_fs2(svn_repos_t *repos, svn_revnum_t start_rev, svn_revnum_t end_rev, svn_repos_notify_func_t notify_func, void *notify_baton, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) { svn_fs_t *fs = svn_repos_fs(repos); svn_revnum_t youngest; svn_revnum_t rev; apr_pool_t *iterpool = svn_pool_create(pool); svn_repos_notify_t *notify; /* Determine the current youngest revision of the filesystem. */ SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool)); /* Use default vals if necessary. */ if (! SVN_IS_VALID_REVNUM(start_rev)) start_rev = 0; if (! SVN_IS_VALID_REVNUM(end_rev)) end_rev = youngest; /* Validate the revisions. */ if (start_rev > end_rev) return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL, _("Start revision %ld" " is greater than end revision %ld"), start_rev, end_rev); if (end_rev > youngest) return svn_error_createf(SVN_ERR_REPOS_BAD_ARGS, NULL, _("End revision %ld is invalid " "(youngest revision is %ld)"), end_rev, youngest); /* Create a notify object that we can reuse within the loop. */ if (notify_func) notify = svn_repos_notify_create(svn_repos_notify_verify_rev_end, pool); for (rev = start_rev; rev <= end_rev; rev++) { svn_delta_editor_t *dump_editor; void *dump_edit_baton; const svn_delta_editor_t *cancel_editor; void *cancel_edit_baton; svn_fs_root_t *to_root; apr_hash_t *props; svn_pool_clear(iterpool); /* Get cancellable dump editor, but with our close_directory handler. */ SVN_ERR(get_dump_editor((const svn_delta_editor_t **)&dump_editor, &dump_edit_baton, fs, rev, "", svn_stream_empty(pool), notify_func, notify_baton, start_rev, FALSE, TRUE, /* use_deltas, verify */ iterpool)); dump_editor->close_directory = verify_close_directory; SVN_ERR(svn_delta_get_cancellation_editor(cancel_func, cancel_baton, dump_editor, dump_edit_baton, &cancel_editor, &cancel_edit_baton, iterpool)); SVN_ERR(svn_fs_revision_root(&to_root, fs, rev, iterpool)); SVN_ERR(svn_repos_replay2(to_root, "", SVN_INVALID_REVNUM, FALSE, cancel_editor, cancel_edit_baton, NULL, NULL, iterpool)); SVN_ERR(svn_fs_revision_proplist(&props, fs, rev, iterpool)); if (notify_func) { notify->revision = rev; notify_func(notify_baton, notify, iterpool); } } /* We're done. */ if (notify_func) { notify = svn_repos_notify_create(svn_repos_notify_verify_end, iterpool); notify_func(notify_baton, notify, iterpool); } svn_pool_destroy(iterpool); return SVN_NO_ERROR; }
svn_error_t * svn_ra__file_revs_from_log(svn_ra_session_t *ra_session, const char *path, svn_revnum_t start, svn_revnum_t end, svn_file_rev_handler_t handler, void *handler_baton, apr_pool_t *pool) { svn_node_kind_t kind; const char *repos_url, *session_url, *fs_path; apr_array_header_t *condensed_targets; struct fr_log_message_baton lmb; struct rev *rev; apr_hash_t *last_props; svn_stream_t *last_stream; apr_pool_t *currpool, *lastpool; /* Fetch the absolute FS path associated with PATH. */ SVN_ERR(get_fs_path(&fs_path, ra_session, path, pool)); /* Check to make sure we're dealing with a file. */ SVN_ERR(svn_ra_check_path(ra_session, path, end, &kind, pool)); if (kind == svn_node_dir) return svn_error_createf(SVN_ERR_FS_NOT_FILE, NULL, _("'%s' is not a file"), fs_path); condensed_targets = apr_array_make(pool, 1, sizeof(const char *)); APR_ARRAY_PUSH(condensed_targets, const char *) = path; lmb.path = fs_path; lmb.eldest = NULL; lmb.pool = pool; /* Accumulate revision metadata by walking the revisions backwards; this allows us to follow moves/copies correctly. */ SVN_ERR(svn_ra_get_log2(ra_session, condensed_targets, end, start, 0, /* no limit */ TRUE, FALSE, FALSE, NULL, fr_log_message_receiver, &lmb, pool)); /* Reparent the session while we go back through the history. */ SVN_ERR(svn_ra_get_session_url(ra_session, &session_url, pool)); SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_url, pool)); SVN_ERR(svn_ra_reparent(ra_session, repos_url, pool)); currpool = svn_pool_create(pool); lastpool = svn_pool_create(pool); /* We want the first txdelta to be against the empty file. */ last_props = apr_hash_make(lastpool); last_stream = svn_stream_empty(lastpool); /* Walk the revision list in chronological order, downloading each fulltext, diffing it with its predecessor, and calling the file_revs handler for each one. Use two iteration pools rather than one, because the diff routines need to look at a sliding window of revisions. Two pools gives us a ring buffer of sorts. */ for (rev = lmb.eldest; rev; rev = rev->next) { const char *temp_path; apr_pool_t *tmppool; apr_hash_t *props; apr_file_t *file; svn_stream_t *stream; apr_array_header_t *prop_diffs; svn_txdelta_stream_t *delta_stream; svn_txdelta_window_handler_t delta_handler = NULL; void *delta_baton = NULL; svn_pool_clear(currpool); /* Get the contents of the file from the repository, and put them in a temporary local file. */ SVN_ERR(svn_stream_open_unique(&stream, &temp_path, NULL, svn_io_file_del_on_pool_cleanup, currpool, currpool)); SVN_ERR(svn_ra_get_file(ra_session, rev->path + 1, rev->revision, stream, NULL, &props, currpool)); SVN_ERR(svn_stream_close(stream)); /* Open up a stream to the local file. */ SVN_ERR(svn_io_file_open(&file, temp_path, APR_READ, APR_OS_DEFAULT, currpool)); stream = svn_stream_from_aprfile2(file, FALSE, currpool); /* Calculate the property diff */ SVN_ERR(svn_prop_diffs(&prop_diffs, props, last_props, lastpool)); /* Call the file_rev handler */ SVN_ERR(handler(handler_baton, rev->path, rev->revision, rev->props, FALSE, /* merged revision */ &delta_handler, &delta_baton, prop_diffs, lastpool)); /* Compute and send delta if client asked for it. */ if (delta_handler) { /* Get the content delta. Don't calculate checksums as we don't * use them. */ svn_txdelta2(&delta_stream, last_stream, stream, FALSE, lastpool); /* And send. */ SVN_ERR(svn_txdelta_send_txstream(delta_stream, delta_handler, delta_baton, lastpool)); } /* Switch the pools and data for the next iteration */ tmppool = currpool; currpool = lastpool; lastpool = tmppool; SVN_ERR(svn_stream_close(last_stream)); last_stream = stream; last_props = props; } SVN_ERR(svn_stream_close(last_stream)); svn_pool_destroy(currpool); svn_pool_destroy(lastpool); /* Reparent the session back to the original URL. */ return svn_ra_reparent(ra_session, session_url, pool); }