~svn/ubuntu/oneiric/subversion/ppa

« back to all changes in this revision

Viewing changes to notes/txdelta_sanity

  • Committer: Max Bowsher
  • Date: 2012-06-27 12:25:12 UTC
  • mfrom: (44.1.46 precise)
  • Revision ID: _@maxb.eu-20120627122512-kmo8fj0lr7mlkppj
Make tree identical to precise branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
General Guide to Textdeltas.... basic use of interfaces.
3
 
 
4
 
(Yes, the interfaces are a bit simplified.  :)  )
5
 
 
6
 
 
7
 
To SEND textdeltas
8
 
------------------
9
 
 
10
 
 1. txdelta_stream = svn_txdelta (source_stream, target_stream);
11
 
 
12
 
 2. Get window handler to do something with delta.  If using an
13
 
    "editor" to transmit information:
14
 
 
15
 
      window_consumer_func = editor->apply_textdelta (file_baton);
16
 
 
17
 
    If you want raw vcdiff data for embedding in XML or HTTP
18
 
    transactions:
19
 
 
20
 
      window_consumer_func = svn_txdelta_to_vcdiff (txdelta_stream);
21
 
 
22
 
 3. Loop until there are no more windows:
23
 
 
24
 
      txdelta_window = svn_txdelta_next_window (txdelta_stream);
25
 
      window_consumer_func (txdelta_window);
26
 
      svn_txdelta_free_window (txdelta_window);
27
 
 
28
 
    Be sure to call window_consumer_func with a NULL window when there
29
 
    are no more windows to consume.
30
 
 
31
 
 4. svn_txdelta_free (txdelta_stream);
32
 
 
33
 
 
34
 
 
35
 
To RECEIVE textdeltas
36
 
---------------------
37
 
If implementing "apply_textdelta" within an editor:
38
 
 
39
 
 1. Get window handler to apply the text delta:
40
 
 
41
 
      apply_handler = svn_txdelta_apply (read_func, write_func)
42
 
 
43
 
    where read_func reads from the delta source and write_func writes
44
 
    to the target.
45
 
 
46
 
 2. If you don't need to do any special cleanup, you can return
47
 
    apply_handler to the caller directly.  If you do need to do
48
 
    cleanup, write your own window_consumer_func which invokes
49
 
    apply_handler.  In this case, your window handler will receive a
50
 
    NULL window argument when there are no more windows to consume,
51
 
    and you can do cleanup then.  Be sure to pass a NULL window to
52
 
    apply_handler when that happens so that it can clean up its own
53
 
    stuff.
54
 
 
55
 
If you want to receive raw vcdiff data from XML or HTTP transactions,
56
 
get or write a window consumer function and call:
57
 
 
58
 
      vcdiff_parser = svn_make_vcdiff_parser (window_consumer_func);
59
 
 
60
 
      Loop over vcdiff data:
61
 
          svn_vcdiff_parse (vcdiff_parser, data);