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

howto pass command-line option from svn client to repository....(new option --skip-post-commit)

From: Lucas van Staden <lvs_at_softhome.net>
Date: 2005-11-13 00:04:50 CET

Hi.

Firstly I will give an explanation on what I am trying to do, as I may be
going about the wrong way to achieve this. Currently the only solution I can
fathom is to create a new command line option for svn client(s).

If I am going about this in the wrong way, or there is some documentation I
can read to understand this, do please point me into the right direction. All
in all this has been fun.....

So here goes....

Been using subversion for a while now in a multi developer web development
environment.

After new functions were developed, our marketing team needs to check and
approve them before they go live, so to enable this we work each new function
as a branch off the main trunk, each accessable as a seperate url, thus

functiona becomes http://functiona.site.co.uk, function2 becomes
functionb.site.co.uk etc etc.
Once a functions has been approved we merge that back into the main trunk,
take a snapshot into tags and release the code to stage for a final check and
then live.

Up to now the process has been a bit manual, with us having to create each
apache virtual host entry for each function, dns entries to get it company
wide available etc.

Some functions go live before others, so we have to make sure we dont send a
function that is still not approved to trunk and live. (plan to make some
kind of dependancy checking here via the hook scripts, so a function can't go
live if a dependancy has not yet been sent live)
 
(breath, phew)

I have begun to automate this process using the hook scripts, so now when we
use our svn clients (linux) to create a branch folder, and commit this folder
to the repository, the hook scripts create the required apache folder (more
on this in next paragraph), creates the apache vhost entries (working) and
adds the required dns entry into bind (working), which then gets replicated
to the main windows domain dns servers (waiting for the network guys to get
back to me on this).

(and breathe again)

Sofar everything is working good, appart from the creation of the apache
folders (the most crucial bit - read on this is a development issue...;)..),
the process is as follows:

Post-commit hook script checks to see a folder with the name of the branch
exists, and if not creates it, and does an inplace checkout as described in
the faq to make it an active svn workdir to the branch in the repository.
It then copies all the source files (php/javascript/html templates) into this
folder, and does a svn add on these, followed by a commit (can you see the
issue yet?)
It then copies the images etc that is not required to be in the repository to
make the new folder a complete working website, and creates the required
apache vhost settings and dns setting. The developer then just does an svn
update on the branch folder on his pc, and all the files are ready for him to
work on :)

The issue is that when the post-commit script does the commit, the commit
itself triggers the post-commit script again. This can at times send the
process into an endless loop, and also slow the process down, creating more
new folders etc.

Now I thought of creating a new option called --skip-post-commit for the svn
client, which would then be included in the svn commit used by the
post-commit script. (I come from a delphi/pascal background, never actually
done any c....)

Sofar what I have done (simple stuff for you guys) was to add the new option
to the /clients/cmdline code (all fine and working, running svn with
--skip-post-commit detects the new option)

I adjusted the svn_repos_fs_commit_txn function to look like this :

svn_repos_fs_commit_txn (const char **conflict_p,
                         svn_repos_t *repos,
                         svn_revnum_t *new_rev,
                         svn_fs_txn_t *txn,
                         apr_pool_t *pool,
                         svn_boolean_t *skippost)

so now in fs-wrap.c i can skip the post-commit call by checking if skippost is
true or false.

So, the call to this in libsvn_repos now looks like this:

err = svn_repos_fs_commit_txn (&conflict, eb->repos,
                                 &new_revision, eb->txn, pool,TRUE);

This seems to work, as I can place a FALSE in the call, recompile and the
post-commit is skipped.
What I cannot figure out is how now to know at this point if the
--skip-post-commit option was included in the svn client call, and thus send
the appropriate true/false value in the call.

I am setting opt_state accordingly in main.c in the command line main.c, so
how do I referance back to that in fs-wrap.c (opt_state class does not exist
at this point)

Any help would be appreciated.
Lucas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 13 00:16:55 2005

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