You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bo Chen <bo...@gmail.com> on 2013/03/28 15:53:24 UTC

the source code in the SVN client for transferring the delta

I am struggling to locate the source code by which the SVN client can
transfer the delta to the server upon a commit operation. Can anyone give
me some hints for it, e.g., which source file file is responsible to
transferring the delta (after the delta has been computed) to the server ?

Thanks for help.

Bo

Re: the source code in the SVN client for transferring the delta

Posted by Daniel Shahaf <da...@elego.de>.
The RA layer encapsulates the choice of URL scheme (file://, svn://, and
http://) so the client and server logics don't need to worry about it.

svnserve opens its own sockets, but with libsvn_ra_serf the syscalls
happen in a dependency library (serf).

Bo Chen wrote on Thu, Mar 28, 2013 at 11:11:15 -0400:
> I am just starting to investigate into the source code of SVN.
> 
> Can you please give me more introductions for it. In my previous
> experiences for network communication, I can simply establish a network
> connection, and send the information to the server via the socket, and that
> is it. Why SVN is so complicated for it, e.g., depends on the RA layer?
> 
> Thanks.
> 
> Bo
> 
> On Thu, Mar 28, 2013 at 10:56 AM, Daniel Shahaf <da...@elego.de> wrote:
> 
> > Bo Chen wrote on Thu, Mar 28, 2013 at 10:53:24 -0400:
> > > I am struggling to locate the source code by which the SVN client can
> > > transfer the delta to the server upon a commit operation. Can anyone give
> > > me some hints for it, e.g., which source file file is responsible to
> > > transferring the delta (after the delta has been computed) to the server
> > ?
> > >
> >
> > That depends on the RA layer.  Look in libsvn_ra_* for the
> > "apply_textdelta" function in the commit editor.
> >
> > Is that the answer you were looking for?
> >
> > Daniel
> >
> > > Thanks for help.
> > >
> > > Bo
> >

Re: the source code in the SVN client for transferring the delta

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Mar 28, 2013 at 11:11:15AM -0400, Bo Chen wrote:
> I am just starting to investigate into the source code of SVN.
> 
> Can you please give me more introductions for it. In my previous
> experiences for network communication, I can simply establish a network
> connection, and send the information to the server via the socket, and that
> is it. Why SVN is so complicated for it, e.g., depends on the RA layer?
> 
> Thanks.

The sockets SVN uses are managed by APR (see apr.apache.org) which
SVN uses as a portability layer.

The repository access (RA) layer makes support for multiple
protocols possible, so that the client can talk HTTP or the
custom SVN protocol to the server, or even use repositories
without a server (ra_local file:// URLs).

Re: AW: the source code in the SVN client for transferring the delta

Posted by Julian Foad <ju...@btopenworld.com>.
Markus Schaber wrote:

> Hi, Bo,
> 
> Von: Bo Chen [mailto:bo.irvine.chen@gmail.com]
>>  I am just starting to investigate into the source code of SVN. 
>> 
>>  Can you please give me more introductions for it. In my previous 
>> experiences for network communication, I can simply establish a network 
>> connection, and send the information to the server via the socket, and that is 
>> it. Why SVN is so complicated for it, e.g., depends on the RA layer?
> 
> The main reason is that SVN supports several different ways of accessing the 
> repository:
> - The "http" and "https" protocols, handled alternatively 
> via "serf" or "neon" libraries.
> - The custom "svn" protocol.
> - Tunneling of the custom svn protocol through ssh or other external 
> communication tools.
> - Direct, local repository access with "file" URLs (there is no 
> "server" involved in that case).
> 
> The RA (Repository Access) layer abstracts those.

There's a nice system block diagram here:
<http://svnbook.red-bean.com/en/1.7/svn.intro.whatis.html#svn.intro.architecture>.

- Julian

AW: the source code in the SVN client for transferring the delta

Posted by Markus Schaber <m....@codesys.com>.
Hi, Bo,

Von: Bo Chen [mailto:bo.irvine.chen@gmail.com]
> On Thu, Mar 28, 2013 at 10:56 AM, Daniel Shahaf <da...@elego.de> wrote:
> > Bo Chen wrote on Thu, Mar 28, 2013 at 10:53:24 -0400:
> > > I am struggling to locate the source code by which the SVN client can
> > > transfer the delta to the server upon a commit operation. Can anyone give
> > > me some hints for it, e.g., which source file file is responsible to
> > > transferring the delta (after the delta has been computed) to the server ?
> > >
> > That depends on the RA layer.  Look in libsvn_ra_* for the
> > "apply_textdelta" function in the commit editor.
> > Is that the answer you were looking for?
> I am just starting to investigate into the source code of SVN. 
>
> Can you please give me more introductions for it. In my previous experiences for network communication, I can simply establish a network connection, and send the information to the server via the socket, and that is it. Why SVN is so complicated for it, e.g., depends on the RA layer?

The main reason is that SVN supports several different ways of accessing the repository:
- The "http" and "https" protocols, handled alternatively via "serf" or "neon" libraries.
- The custom "svn" protocol.
- Tunneling of the custom svn protocol through ssh or other external communication tools.
- Direct, local repository access with "file" URLs (there is no "server" involved in that case).

The RA (Repository Access) layer abstracts those.


Best regards

Markus Schaber

CODESYS® a trademark of 3S-Smart Software Solutions GmbH 

Inspiring Automation Solutions 
________________________________________
3S-Smart Software Solutions GmbH 
Dipl.-Inf. Markus Schaber | Product Development Core Technology 
Memminger Str. 151 | 87439 Kempten | Germany 
Tel. +49-831-54031-979 | Fax +49-831-54031-50 

E-Mail: m.schaber@codesys.com | Web: codesys.com | CODESYS store: store.codesys.com 
CODESYS forum: forum.codesys.com 

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 


Re: the source code in the SVN client for transferring the delta

Posted by Bo Chen <bo...@gmail.com>.
I am just starting to investigate into the source code of SVN.

Can you please give me more introductions for it. In my previous
experiences for network communication, I can simply establish a network
connection, and send the information to the server via the socket, and that
is it. Why SVN is so complicated for it, e.g., depends on the RA layer?

Thanks.

Bo

On Thu, Mar 28, 2013 at 10:56 AM, Daniel Shahaf <da...@elego.de> wrote:

> Bo Chen wrote on Thu, Mar 28, 2013 at 10:53:24 -0400:
> > I am struggling to locate the source code by which the SVN client can
> > transfer the delta to the server upon a commit operation. Can anyone give
> > me some hints for it, e.g., which source file file is responsible to
> > transferring the delta (after the delta has been computed) to the server
> ?
> >
>
> That depends on the RA layer.  Look in libsvn_ra_* for the
> "apply_textdelta" function in the commit editor.
>
> Is that the answer you were looking for?
>
> Daniel
>
> > Thanks for help.
> >
> > Bo
>

Re: the source code in the SVN client for transferring the delta

Posted by Daniel Shahaf <da...@elego.de>.
Bo Chen wrote on Thu, Mar 28, 2013 at 10:53:24 -0400:
> I am struggling to locate the source code by which the SVN client can
> transfer the delta to the server upon a commit operation. Can anyone give
> me some hints for it, e.g., which source file file is responsible to
> transferring the delta (after the delta has been computed) to the server ?
> 

That depends on the RA layer.  Look in libsvn_ra_* for the
"apply_textdelta" function in the commit editor.

Is that the answer you were looking for?

Daniel

> Thanks for help.
> 
> Bo

Re: the source code in the SVN client for transferring the delta

Posted by Daniel Shahaf <da...@elego.de>.
Bo Chen wrote on Thu, Mar 28, 2013 at 13:00:15 -0400:
> I am now working on understanding the  flow when a user is doing a commit,
> what exactly happens in the SVN client, and what exactly happens in the SVN
> server, in the code level.

I suggest that you run a commit on ra_local (file:///) and set a
breakpoint in write_final_current():

    (gdb) set breakpoint pending on
    (gdb) b write_final_current
    (gdb) r

then examine the call stack:

    (gdb) bt

That call stack will show you nearly all of our layering.  (but some
auxiliary routines in libsvn_delta and libsvn_subr won't show in it)

Re: the source code in the SVN client for transferring the delta

Posted by Bo Chen <bo...@gmail.com>.
Thanks for the suggestion.

I need to modify the SVN source code for a project, so I need to look
through and understand the source code.

I am now working on understanding the  flow when a user is doing a commit,
what exactly happens in the SVN client, and what exactly happens in the SVN
server, in the code level.

Bo

On Thu, Mar 28, 2013 at 11:39 AM, Ben Reser <be...@reser.org> wrote:

> On Thu, Mar 28, 2013 at 7:53 AM, Bo Chen <bo...@gmail.com> wrote:
> > I am struggling to locate the source code by which the SVN client can
> > transfer the delta to the server upon a commit operation. Can anyone
> give me
> > some hints for it, e.g., which source file file is responsible to
> > transferring the delta (after the delta has been computed) to the server
> ?
>
> 1) You might find using gdb a lot easier than trying to follow the
> source.  Just build SVN with --enable-maintainer-mode and then do `gdb
> -args svn commit -mm`.  Set a breakpoint on wherever you want to start
> following and off you go.
>
> 2) Maybe it would be better if you told us what you're trying to
> figure out than just asking us where the code is?  We might be able to
> just answer it.
>

Re: the source code in the SVN client for transferring the delta

Posted by Ben Reser <be...@reser.org>.
On Thu, Mar 28, 2013 at 7:53 AM, Bo Chen <bo...@gmail.com> wrote:
> I am struggling to locate the source code by which the SVN client can
> transfer the delta to the server upon a commit operation. Can anyone give me
> some hints for it, e.g., which source file file is responsible to
> transferring the delta (after the delta has been computed) to the server ?

1) You might find using gdb a lot easier than trying to follow the
source.  Just build SVN with --enable-maintainer-mode and then do `gdb
-args svn commit -mm`.  Set a breakpoint on wherever you want to start
following and off you go.

2) Maybe it would be better if you told us what you're trying to
figure out than just asking us where the code is?  We might be able to
just answer it.