tags:

views:

56

answers:

1

Hi I am working on a web based project in my free time. I have SVN set up on my machine (running XP). What I would like to do is have a copy of my repository copied to the htdocs folder (Dev machine) post-commit via a hook. That way I can test my changes in a browser.

I know that I can write up a .bat file, but I'm not sure what the syntax would be. I can do a basic DOS Copy command, but I saw one example that provided a username and password to SVN at copy time. Do I need to do this?

Can someone point me in the right direction as far a syntax for the .bat file?

Or maybe even suggest a better method.

Thanks

+1  A: 

The red-bean book has a section on hooks. The post-commit parameters are described also.

@echo off
set destination=c:\inetpub\wwwroot\blah\blah
set source_path=%1
set revision=%2
svn export --username user --password pass "%source_path%" "%destination%"

That all being said; I wouldn't couple your testing environment so tightly with your source control if you didn't have to.

You could write a completely standalone job that polls the subversion location you're interested in and does the export when it detects a change.

John Weldon
+1, but you should remove the spaces around the '=' sign, or they become part of the variable name. Also, wrap their usage with quotes in case the path contains spaces, e.g. `"%source_path%"`
orip
gracias! @orip :)
John Weldon