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

Re: Use SVN to Publish to FTP?

From: Gavin Andresen <gavinandresen_at_gmail.com>
Date: 2007-07-02 04:20:52 CEST

> Is it possible to run SVN on a server inside my companies LAN and have
> it nightly publish any changes to the repository to a FTP server? What would
> it take to make this happen?

Is nightly important? Is the machine hosting the svn repository Unix-like?

I wrote a php-based pre- or post- commit hook that will use ftp or sftp to
copy changes to one or more places (where to copy specified using a property
on the root repository directory). pre-commit is better for what I use it
for (copying changes in web pages from my development tree to a production
or test web server-- if the copy to the server fails for any reason, the
commit fails).

It's on SourceForge:

... here's the README:

Subversion hook script to automatically copy committed files to a
Written in php.


Install as a pre-commit hook. The hooks directory is
"root_of_repository/hooks", name must be "pre-commit" and it must be
executable. Also, the hook MUST set an appropriate PATH; svn2web uses
the following command-line programs:
  php svnlook cp rm mkdir cd
If using ftp or sftp to upload files:
  expect ftp sftp

Then, add a "svn2web" property to the branch or directory that should
get copied (e.g. on the trunk):
  cd trunk
  svn propset svn2web "sftp:username:password@machine:/path" .
  svn commit -N -m "Upload commits to server." .

If a branch/directory should get copied multiple places, use svn
propedit and list each on a separate line.

Also, note that if a subdirectory has the svn2web property set, then
that setting OVERRIDES the parent's setting.

The put_ftp/put_sftp/remove_ftp/remove_sftp files must be executable,
and must be in the same directory as the svn2web utility.

EXAMPLE pre-commit HOOK:
export PATH=/usr/local/bin:/usr/bin:/bin
svn2web $1 $2 >> /tmp/svn2web.log || exit 1
exit 0

Gavin Andresen
Received on Mon Jul 2 04:21:01 2007

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.