Hi Ben,
As you had suggested I have started using the JNI to achieve the svndiff
functionality.
I followed the document at
http://svn.collab.net/repos/svn/trunk/notes/txdelta_sanity
to write the code to achieve sending of deltas first.
The following are the steps mentioned in document and my implementation
too
Step 1.
txdelta_stream = svn_txdelta (source_stream, target_stream);
My Implementation:
apr_initialize();
pool = svn_pool_create (NULL);
src_buf = svn_stringbuf_create( "h", pool );
tgt_buf = svn_stringbuf_create( "", pool );
src_stream = svn_stream_from_stringbuf(
src_buf, pool );
tgt_stream = svn_stream_from_stringbuf(
tgt_buf, pool );
svn_txdelta (&txdelta_stream, src_stream, tgt_stream, pool);
Step 2.
Get window handler to do something with delta. If using an
"editor" to transmit information:
window_consumer_func = editor->apply_textdelta (file_baton);
If you want raw vcdiff data for embedding in XML or HTTP
transactions:
window_consumer_func = svn_txdelta_to_vcdiff (txdelta_stream);
My Implementation:
encoder = svn_base64_encode_string(
svn_string_create_from_buf(src_buf,pool), pool );
svn_txdelta_to_svndiff (encoder, pool, &svndiff_handler,
&svndiff_baton);
Step 3 And 4
Loop until there are no more windows:
txdelta_window = svn_txdelta_next_window (txdelta_stream);
window_consumer_func (txdelta_window);
svn_txdelta_free_window (txdelta_window);
Be sure to call window_consumer_func with a NULL window when there
are no more windows to consume.
svn_txdelta_free (txdelta_stream);
My Implementation:
err = svn_txdelta_send_txstream (txdelta_stream,
svndiff_handler,
svndiff_baton,
pool);
return (*env)->NewStringUTF(env, encoder->data);
I should return a data that has been encoded in svn format to the java
program hence the above statement.
I am not sure that what I have written I correct. Please correct me if I
am wrong.
Also attached are the files used.
Please let me know how to send the data back to java should be as string
or a byte array.
Regards
Ramprasad
-----Original Message-----
From: Ben Collins-Sussman [mailto:sussman@collab.net]
Sent: Tuesday, June 28, 2005 7:36 PM
To: Ramprasad Venkata Inala
Cc: Max Bowsher; dev@subversion.tigris.org
Subject: Re: SVN Protocol
On Jun 28, 2005, at 12:23 AM, Ramprasad Venkata Inala wrote:
>
> I am making a mistake some where or my understanding is wrong. Please
> correct me and also provide exact sequence of bytes .
>
Why are you trying to re-implement the whole binary differencing
language? Why not just use the public API for encoding/decoding
binary differences as provided by the public API in svn_delta.h?
Wouldn't it be easier to make JNI calls to libsvn_delta, rather than
reimplement everything?
**********************************************************************
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this message
by anyone else is unauthorized. If you are not the intended recipient, any
disclosure, copying, or distribution of the message, or any action or
omission taken by you in reliance on it, is prohibited and may be unlawful.
Please immediately contact the sender if you have received this message in
error.
**********************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jul 6 12:48:06 2005