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

minimalist example of svn_txdelta_run?

From: Clifford Yapp <cliffyapp_at_gmail.com>
Date: Wed, 30 Mar 2011 19:46:04 -0400

Hi - I'm trying to create a minimal-case example creating a delta
between two strings and applying that delta to a svn repository in C.
I'm able to add and delete files and add content to an empty file, but
so far I haven't been able to take the contents of a file, diff them
with a string, and use that diff to update the file in the repository.

Two immediate questions:

1) are the md5 checksums integral to the process of creating a delta
- i.e., can it be ignored or is calculating md5 checksums a required
step?

2) is there an example somewhere of this process being done in C code
as a minimal example? Something along the lines of "given a
repository and two strings str1 and str2, here's how to apply the
difference to a file in a repository?"

A code snippet appears below to better illustrate what I'm trying to
do - I can expand it if that would help any.

Thanks,
CY

 svn_repos_get_commit_editor4(editor, &edit_baton, repos, NULL,
full_path, base, user, logmsg, NULL, NULL, NULL, NULL, pool);
 (*editor)->open_root(edit_baton, youngest_rev, pool, &root_baton);
 (*editor)->open_file(bu_vls_addr(&filepath), root_baton,
youngest_rev, pool, &file_baton);
 char *testcontents = "test contents 2";
 teststring = svn_string_createf(pool, "%s", testcontents2);
 svn_stream_t *newstream = svn_stream_from_string(teststring, pool);
 (*editor)->apply_textdelta(file_baton, NULL, pool, &handler, &handler_baton);
 svn_txdelta_run(oldstream, newstream, handler, handler_baton,
svn_checksum_md5, &local_checksum, NULL, NULL, pool, pool);
 (*editor)->close_file(file_baton, NULL, pool);
 (*editor)->close_edit(edit_baton, pool);
Received on 2011-03-31 01:46:35 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.