I have an SVN repo that is managed via web interface (svn checkout https://server/repos/proj1 etc.), which all works.

Now, with every commit I wish to copy the newest version in a directory, e.g. into /home/user/somewhere/proj1/rev102/ using a shell command on the server.

If I remember correctly you can call a command upon every commit and I am not worried much about how it is done (that failing I could create a cron job), but:

How do I extract the newest files from the svn repo directory/files using a locally running shell script without using svn update, svn login mechanisms etc.? All the files are there and accessible from the shell, so that ought to be easy?


You do not need an svn login if you have direct file access to the svn database. Somewhere on the server you have the root of the svn database, say directory /some/dir. It has subdirectories db, conf, hooks and locks. You can checkout this repository on the same machine by using

cd /home/user/somewhere/
svn list file:///some/dir/
svn checkout file:///some/dir/repos/proj1/rev102  proj1/rev102

You can also do svn update in the newly created subdirectory.

As you say, you can call a command on every commit. Edit and rename the file hooks/post-commit.tmpl to hooks/post-commit in /some/dir.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.