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

Re: Students' Project seeks help

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Mon, 01 Aug 2011 16:25:18 +0100

On Mon, 2011-07-25, Jan Peters wrote:
> [...] Yet the code of the update functionality is by far harder to
> comprehend.

Hi Jan. I'll just reply to this part of your question about how the
'update' code works.

> To me personally it looks like the svn_ra_do_update2 fetches the data
> from the server (or whatever method is used here) but does not apply
> changes to the working copy yet. Since we do not want to change
> anything about the ra modules themselves we omitted this part when
> checking.
> Concerning svn_wc_crawl_revisions5 and svn_wc_crawl_revisions2 it says
> "After all revisions are reported, reporter->finish_report() is
> called, which immediately causes the RA layer to update the working
> copy. Thus the return value may very well reflect the result of the
> update!" here
> http://subversion.sourcearchive.com/lines/1.4.4dfsg1/svn__wc_8h_9aacdf613889a86c23af70544103132a.html#9aacdf613889a86c23af70544103132a.
> I don't actually see where this is done. But I must assume that actual
> changes to the local files and database are done here.

If you look at the calling code, in subversion/libsvn_client/update.c
update_internal(), you will see [1]:

  svn_wc_get_update_editor4(&update_editor, &update_edit_baton, ...);

  svn_ra_do_update2(..., &reporter, &report_baton,
                    ..., update_editor, update_edit_baton, ...);

  svn_wc_crawl_revisions5(..., reporter, report_baton, ...);

What's happening here is two layers of wrapping funtional objects.
First, svn_wc_get_update_editor4() creates and returns an 'update
editor' which is capable of modifying the working copy; but this editor
isn't called yet so nothing interesting happens.

Then svn_ra_do_update2() creates and returns a 'reporter'. This
reporter is capable of reporting a WC status to the server and calling
the update editor according to what the server tells it; but this
reporter isn't called yet.

Finally, svn_wc_crawl_revisions5() examines the current state of the WC
and calls the 'reporter' to tell it the current WC state, which it
communicates to the server. The last step this function performs is to
call the reporter's finish_report() method, at which point the reporter
finishes talking to the server and, according to the server's responses,
the reporter then calls the update editor to update the WC.

I hope that makes a bit of sense.

[1] I'm quoting from trunk. I noticed that you quoted some
documentation from version 1.4.4 which is very old. Is that what you're
using? I strongly recommend you work with either trunk or 1.7.x (now in
Beta testing <http://subversion.apache.org/download/#pre-releases>).
The working copy has changed a lot in v1.7, and the old format used up
to 1.6 is basically a dead end.

- Julian
Received on 2011-08-01 17:25:53 CEST

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