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

Re: [SOLVED] Website Management / Open Questions

From: Georg Wittenburg <georg.wittenburg_at_gmx.net>
Date: 2006-01-29 18:16:56 CET

On Tuesday 24 January 2006 18:50, Ryan Schmidt wrote:
> On Jan 24, 2006, at 18:26, Kalin KOZHUHAROV wrote:
> >> Is the repository on a different machine than the web server? Does
> >> the
> >> repository server have spare disk space? If so, then I would keep a
> >> complete working copy of the relevant subset of the repository on the
> >> repository server and update it whenever a relevant commit occurs.
> >> Then
> >> I would use rsync to synchronize this with the directory on the web
> >> server. rsync will only send the changes over the network, so it
> >> would
> >> be comparable to running svn up.
> >
> > It will be even faster, IMHO and you can exclude the .svn files
> > like this:
> >
> > $ alias R='rsync -Hazv --delete --delete-after --progress --
> > exclude=.svn/'
> > $ R working_dir/ webserver.domain.org:html/
> >
> > I am actually using sort of this but without the hook: not frequent
> > updates
> > so for now manually running the rsync is OK.
>
> Er... yes... I seem to have forgotten that part. Either use svn
> export on the working copy first, then rsync the export, or just
> exclude the .svn directories when rsyncing the working copy. The
> latter is probably quicker, because you don't have to wait for the
> export, and apparently easy, as shown above.

Thanks for your help! With your input I put together the following post-commit
hook which solved the problem for me.

Thanks!
   Georg

#!/bin/sh

# The following hook is used for website management: Upon detecting a commit
# to a certain project, a working copy of that project is updated and then
# rsynced with the real webpage, omitting the .svn directories of the working
# copy.

REPOS="$1"
REV="$2"

WEBSITE_PROJECT_NAME="trunk/public_html"
WEBSITE_WORKING_COPY_PATH="/home/georg/Documents/public_html/"
WEBSITE_PATH="/import/htdocs/georg/public_html/"

/usr/bin/svnlook dirs-changed $REPOS -r $REV | grep $WEBSITE_PROJECT_NAME
> /dev/null
if [ $? = 0 ]; then
        # The following update will fail ("svn: Working copy locked") if the
        # commit that has triggered this hook was called from within
        # $WEBSITE_WORKING_COPY_PATH. However, this doesn't matter because
        # either way we have an up-to-date copy in $WEBSITE_WORKING_COPY_PATH.
        /usr/bin/svn update $WEBSITE_WORKING_COPY_PATH
        /usr/bin/rsync -a --delete --exclude=.svn/ $WEBSITE_WORKING_COPY_PATH
$WEBSITE_PATH
fi

-- 
Georg Wittenburg
http://page.mi.fu-berlin.de/~wittenbu/

  • application/pgp-signature attachment: stored
Received on Sun Jan 29 18:18:12 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.