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

Re: XML-outputting editor questions

From: Ben Collins-Sussman <sussman_at_newton.collab.net>
Date: 2000-09-30 14:37:56 CEST

Greg Hudson <ghudson@mit.edu> writes:

> * The envisioned interface svn_txdelta_to_vcdiff() doesn't
> jive with the edit_fns model, which wants to use a push
> model. Maybe Branko has already addressed this in his work.

Greg, maybe this document will help. I believe it's under
subversion/notes/, and I typed it for my own sanity:

General Guide to Textdeltas.... basic use of interfaces.

(Yes, the interfaces are a bit simplified. :) )

To SEND textdeltas
 1. txdelta_stream = svn_txdelta (source_stream, target_stream);

 2. (If using an "editor" to transmit information -- PUSH Interface:)

    window_consumer_func = editor->apply_textdelta (file_baton);

       txdelta_window = svn_txdelta_next_window (txdelta_stream);
       window_consumer_func (txdelta_window);
       svn_txdelta_free_window (txdelta_window);

                    --- OR ---

    (If you want raw vcdiff data for embedding in XML or HTTP
    transactions -- PULL interface:)

     vcdiff_read_fn = svn_txdelta_to_vcdiff (txdelta_stream);

        read bytes out of vcdiff_read_fn
        stash them in XML or elsewhere

 3. svn_txdelta_free (txdelta_stream);

To RECEIVE textdeltas
 1. (If implementing "apply_textdelta" within an editor:)

      write a window_consumer_func() which parses the ops within each
      window and applies them to a source file, resulting in target file.

               --- AND OPTIONALLY ---

     (If you want to receive raw vcdiff data from XML or HTTP transactions:)

      vcdiff_parser = svn_make_vcdiff_parser (window_consumer_func);

      Loop over vcdiff data:
          svn_vcdiff_parse (vcdiff_parser, data);
Received on Sat Oct 21 14:36:09 2006

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