You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Joshua Brickner <jo...@rocketjones.com> on 2007/06/26 13:42:03 UTC

Use SVN to Publish to FTP?

Greetings All,

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?

Thanks,
Joshua Brickner
Technical Developer
Rocket Jones Interactive
joshua@rocketjones.com


Re: Use SVN to Publish to FTP?

Posted by Eric Hanchrow <of...@blarg.net>.
>>>>> "Joshua" == Joshua Brickner <jo...@rocketjones.com> writes:

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

Read about post-commit hooks: 

http://svnbook.red-bean.com/nightly/en/svn.ref.reposhooks.post-commit.html

-- 
The people I know who do great work think that they suck, but
that everyone else sucks even more.

        -- Paul Graham

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Use SVN to Publish to FTP?

Posted by Gavin Andresen <ga...@gmail.com>.
> 
>
> 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:
  http://svn2web.svn.sourceforge.net/viewvc/svn2web/trunk/

... here's the README:

Subversion hook script to automatically copy committed files to a
server-in-the-sky.
Written in php.

HOW TO USE:

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:
-------------------------
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin
svn2web $1 $2 >> /tmp/svn2web.log || exit 1
exit 0

-- 
--
Gavin Andresen

Re: Use SVN to Publish to FTP?

Posted by Andy Levy <an...@gmail.com>.
On 6/26/07, Larry Martell <la...@gmail.com> wrote:
> On 6/26/07, Joshua Brickner <jo...@rocketjones.com> wrote:
> > On Jun 26, 2007, at 7:49 AM, Larry Martell wrote:
> >
> > > On 6/26/07, Joshua Brickner <jo...@rocketjones.com> wrote:
> > >>
> > >> Greetings All,
> > >>
> > >> 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?
> > >
> > > Yes.
> > >
> > >> What would it take to make this happen?
> > >
> > > I would write a perl script and run it from cron.
>
> > Do you have any suggestions on further steps? I program in PHP
> > mostly. How would I gather a list of files from SVN to upload?
>
> Use svn log.

Or, in Subversion 1.4+, svn diff --summarize

> > Can SVN automatically keep track of what versions are on the FTP site?
>
> Yes, if those files are under subversions control.

At this point, you're better off (IMO) making the remote server a
working copy and running svn up to pull updates from your Subversion
server, instead of pushing with FTP.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Use SVN to Publish to FTP?

Posted by Larry Martell <la...@gmail.com>.
On 6/26/07, Joshua Brickner <jo...@rocketjones.com> wrote:
> On Jun 26, 2007, at 7:49 AM, Larry Martell wrote:
>
> > On 6/26/07, Joshua Brickner <jo...@rocketjones.com> wrote:
> >>
> >> Greetings All,
> >>
> >> 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?
> >
> > Yes.
> >
> >> What would it take to make this happen?
> >
> > I would write a perl script and run it from cron.

> Do you have any suggestions on further steps? I program in PHP
> mostly. How would I gather a list of files from SVN to upload?

Use svn log.

> Can SVN automatically keep track of what versions are on the FTP site?

Yes, if those files are under subversions control.

-larry

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Use SVN to Publish to FTP?

Posted by Larry Martell <la...@gmail.com>.
On 6/26/07, Joshua Brickner <jo...@rocketjones.com> wrote:
>
> Greetings All,
>
> 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?

Yes.

> What would it take to make this happen?

I would write a perl script and run it from cron.

-larry

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org