You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Georg Wittenburg <ge...@gmx.net> on 2006/01/24 10:52:48 UTC
Website Management / Open Questions
Hi all,
I know that the topic of managing a website using Subversion has come up
several times before, in
[http://subversion.tigris.org/faq.html#website-auto-update] and
[http://svn.haxx.se/users/archive-2004-10/0902.shtml] for example.
While I'd like to set things up just like described in the FAQ, there are two
problems with that:
- I'm running on a tight quota and don't want to waste the extra space
required for .svn directories.
- I don't have access to the httpd.conf and thus would have to add LOTS
of .htaccess files to disallow public access to the .svn directories.
Essentially, I'd like to have the benefits of doing a "svn up", but without
the .svn directories sticking around.
I've looked into using "svn export -f" in my post-commit hook as a way to only
export the actual content of my website without the version control
information. This has several problems:
- There are multiple projects in my repository. Yet I want the "svn export"
only to run, after a commit to the public_html project. I can retrieve this
information rather clumsily by saying something like "svn diff /path/to/repo
-r ($REV-1):$REV | grep public_html". Is there a better way?
- For efficiency, I only want to export those files that have been changed in
the last commit. However, afaik but there is not selective export.
Before I start thinking towards using the post-commit hook to generate a diff
and then calling patch to apply the changes to my website, I wanted to ask on
this list whether there is a more elegant way to do this.
Thanks!
Georg
--
Georg Wittenburg
http://page.mi.fu-berlin.de/~wittenbu/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: [SOLVED] Website Management / Open Questions
Posted by Georg Wittenburg <ge...@gmx.net>.
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/
Re: Website Management / Open Questions
Posted by Ryan Schmidt <su...@ryandesign.com>.
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.
>> If, on the other hand, you only have a single server which is
>> handling
>> both repository and web server, and this is the server with the
>> constrained disk space situation, then I don't know a solution.
>
> Then use file:// and have the repo on your workstation :-) If you
> dare.
And if you have the repository on your workstation, then you do not
have the repository and the web server on the same machine, hence
we're back to the first scenario and you can follow the above
recommendations.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Website Management / Open Questions
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jan 24, 2006, at 11:52, Georg Wittenburg wrote:
> Essentially, I'd like to have the benefits of doing a "svn up", but
> without
> the .svn directories sticking around.
>
> I've looked into using "svn export -f" in my post-commit hook as a
> way to only
> export the actual content of my website without the version control
> information. This has several problems:
> - There are multiple projects in my repository. Yet I want the "svn
> export"
> only to run, after a commit to the public_html project. I can
> retrieve this
> information rather clumsily by saying something like "svn diff /
> path/to/repo
> -r ($REV-1):$REV | grep public_html". Is there a better way?
You can use "svnlook dirs-changed -r $REV" to learn which directories
were changed by a revision, and act accordingly.
> - For efficiency, I only want to export those files that have been
> changed in
> the last commit. However, afaik but there is not selective export.
>
> Before I start thinking towards using the post-commit hook to
> generate a diff
> and then calling patch to apply the changes to my website, I wanted
> to ask on
> this list whether there is a more elegant way to do this.
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.
If, on the other hand, you only have a single server which is
handling both repository and web server, and this is the server with
the constrained disk space situation, then I don't know a solution.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org