Clifford Yapp wrote on Wed, Mar 30, 2011 at 19:46:04 -0400:
> 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);

The first thing to say is that you aren't checking the error return
values.  Try compiling with -DSVN_DEBUG --- that will cause an abort()
if you missed an error return.

That's all that jumps out at me right now :(.   If I had to learn this API
I'd do so by writing a dummy C test --- eg in 
subversion/tests/libsvn_{fs,delta}/ ---
which is also where you might be able to find a 'minimal example'.

Reply via email to