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

Using the svn_delta_editor

From: William Ferguson <william.ferguson_at_hubbub.com.au>
Date: 2005-05-04 08:21:48 CEST

I need some help using the svn_delta_editor.

I'm trying to submit a new file to the Repository and seem to have most of
the operations working OK, on svn_delta_editor_t->close_edit() (which is
commit right?) I get:

Out of date: 'SubVersionRA' in transaction '3n'

SubVersionRA is 2nd level folder in the path of the file I am trying to add.
Ie /trunk/SubVersionRA/testdata/add/myfilename.txt

I think the problem might lie with the calls to

Should I be recursively calling ->open_direcotry for each sub folder or just
make on call for folder '/trunk/SubVersionRA/testdata/add' ?

Also, if you just want to add the new file to the HEAD revision, is it OK to
pass in SVN_INVALID_REVNUM as the revision, if not what should I be doing?

Here's the code snippet :

ra_lib->get_commit_editor(session, &commitEditor, &editBaton, "This is the
commit message", __commit_callback, commitBaton, subpool);
// Get a baton for the root folder.
commitEditor->open_root(editBaton, REVISION_HEAD, subpool, &rootBaton);

// TODO parse the supplied resourcePath and open the specified folder.
commitEditor->open_directory("trunk", rootBaton, REVISION_HEAD, subpool,
commitEditor->open_directory("SubVersionRA", folder1Baton, REVISION_HEAD,
subpool, &folder2Baton);
commitEditor->open_directory("testdata", folder2Baton, REVISION_HEAD,
subpool, &folder3Baton);
commitEditor->open_directory("add", folder3Baton, REVISION_HEAD, subpool,
commitEditor->add_file("myfilename.txt", folder4Baton, NULL, REVISION_HEAD,
subpool, &fileBaton);

// No need to supply the base text checksum as we are adding a new file.
commitEditor->apply_textdelta(fileBaton, /* baseTextCheckSum */ NULL,
subpool, &handler, &handlerBaton);

// Get a stream from which we can read the content.
contents = __create_svn_stream_for_added_resource(env, resourceContent,
svn_txdelta_send_stream(contents, handler, handlerBaton, NULL /*digest */,
// TODO grab the textCheckSum when applying the delta and compare during
commitEditor->close_file(fileBaton, /* textCheckSum */ NULL, subpool);
commitEditor->close_directory(folder4Baton, subpool);
commitEditor->close_directory(folder3Baton, subpool);
commitEditor->close_directory(folder2Baton, subpool);
commitEditor->close_directory(folder1Baton, subpool);
commitEditor->close_directory(rootBaton, subpool);
// Commit.
commitEditor->close_edit(editBaton, subpool);


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 4 08:22:43 2005

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

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