You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Hudson <gh...@MIT.EDU> on 2001/01/21 06:25:44 UTC

Re: Change #6: Move textdeltas to the "other side" of the editor.

[As corrected by Greg Stein:]
>	set_file_contents (filebaton, [src_stream], target_stream)
>	apply_delta (filebaton, [src_stream], delta, enum delta_type)

What use is there for src_stream?

delta is a byte stream, yes?

Why can't set_file_contents be just a case of apply_delta with a
delta_type of "new plain text"?

Re: Change #6: Move textdeltas to the "other side" of the editor.

Posted by Branko Čibej <br...@xbc.nu>.
Greg Stein wrote:

>> Why can't set_file_contents be just a case of apply_delta with a
>> delta_type of "new plain text"?
> 
> 
> That's exactly what I said. I was outvoted.

I wasn't there, but ... If you provide an "apply_delta" API without 
specifying what kind of delta stream you can handle, I guess that 
implies accepting all the delta types supported by Subversion. Using a 
different API makes it clear you can't accept deltas.

If we use just the one API, then we'd have to provide a way to query the 
editor's capabilities to see what kind of deltas it accepts (always a 
pain for the driver app), or have the call fail if the delta type isn't 
supported, which is even worse, IMO. (Actually, the "apply_delta" call 
/must/ fail if the delta type isn't supported, but then you know you've 
gone and linked your driver with an obsolete version of the library.)

With two APIs, the decision about which to use is straightforward and 
can be made early, making it possible to propagate that info up the 
chain of nested editors. It's not the editors' job to convert between 
delta and plaintext formats.

-- 
Brane �ibej
    home:   <br...@xbc.nu>             http://www.xbc.nu/brane/
    work:   <br...@hermes.si>   http://www.hermes-softlab.com/
     ACM:   <br...@acm.org>            http://www.acm.org/

Re: Change #6: Move textdeltas to the "other side" of the editor.

Posted by Greg Stein <gs...@lyra.org>.
On Sun, Jan 21, 2001 at 01:25:44AM -0500, Greg Hudson wrote:
> [As corrected by Greg Stein:]
> >	set_file_contents (filebaton, [src_stream], target_stream)
> >	apply_delta (filebaton, [src_stream], delta, enum delta_type)
> 
> What use is there for src_stream?

The editor implementing set_file_contents() can use the two streams to
compute a delta and then use *that* to transmit what the file should be set
to.

> delta is a byte stream, yes?

Yes. Its format is defined by the enum. At the moment, we have only
"svndiff".

[ in the future, we could have "unidiff" or "gnudiff" or somesuch ]

> Why can't set_file_contents be just a case of apply_delta with a
> delta_type of "new plain text"?

That's exactly what I said. I was outvoted.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/