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

Re: atomic svnsync

From: Lieven Govaerts <svnlgo_at_mobsol.be>
Date: Thu, 24 Jan 2008 22:43:29 +0100

Kouhei Sutou wrote:
> Hi,
> Goal: I want to use my local commit-email.rb (in post-commit
> hook) for external Subversion repository. I only have read
> only permission for the external repository. Or I want to
> set up commit-email.rb only for me.
> Strategy:
> * svnadmin create /.../repos
> * vim /.../repos/hooks/pre-revprop-change
> * vim /.../repos/hooks/post-commit # set up commit-email.rb
> * svnsync init file:///.../repos http://.../repos
> * svnsync sync # commit mail is sent for each commit
> Problem: svnsync needs 2 processes to synchronize
> repositories. They are (1) synchronizing changes and
> properties except revision properties and (2) synchronizing
> revision properties. post-commit hook is invoked on (1) and
> commit-email.rb is also invoked. But some important
> information, author, log message and so on, aren't
> synchronized at this time yet. They are synchronized on (2).
> I can't use post-revprop-change for this propose because
> post-revprop-change hook may be called one or more times for
> each commit. (e.g. for author revision property, log
> revision property and so on.)

As of trunk r29013 only for svn:author and svn:date.

> Solution idea: I can use post-commit hook like a usual
> repository if svnsync just needs a process to synchronize
> repository. In 1.5 API, we have svn_ra_get_commit_editor3()
> that accepts revision properties. But FS layer don't use
> passed some revision properties, date and author.

The current svnsync code on trunk will include all revprops with the
commit, except the two you mention. So on post-commit you'll have all
info expect author and date.

> We may be
> able to decide whether we use those revision properties or
> not with hook mechanism. I don't have a good name idea but
> what about pre-commit-revprop hook?

As a workaround for your problem, you can use some knowledge about the
internals of svnsync. Before starting to copy the revision contents,
svnsync will set a revprop called 'svn:sync-currently-copying', which it
will remove right after the svn:date and svn:author revprops are copied.
So, write a post-revprop-change hook that checks for the removal of this
revprop, takes the revision argument and uses svnlook to read all needed
info from the repository.

As it depends on the way svnsync is implemented - which may change - I
wouldn't call it a solution, but at least it can serve as a temporary

The most decent solution IMHO would be to allow passing the svn:author
and svn:date revprops on commit.



To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-24 22:43:23 CET

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