Question

How to get the latest version of the project file to another folder on every commit?

I'm using VisualSVN server and I think we can do this on post-commit in hooks, but I don't know how. Server is on Windows.

Actually I need to get the latest version of the file to \www folder of IIS7. Simply, get the latest file to another folder.

Était-ce utile?

La solution

I've added following code in post-commit hook (for copying latest version files to D:\Destination).

svn export --force file:///D:/Repositories/myproject D:\Destination
exit 2

It works fine for me.

If your trying to export this to a directory of website, need to change the directory permission. Visual SVN is using NETWORK SERVICE.

Autres conseils

If you use the same file in more than single folder inside your repository and you Subversion is 1.6 or newer, you can use file-type of svn:externals without binding to revision.

In this case committed to SOURCE file will be updated in Working Copy of TARGET after usual svn up

but I don't know how

You correctly say that you have to do it by post-commit, but if you mean you don't know the process, here is how.

Your post-commit hook is a script which is called after every commit to a project in your SVN repository. There is a file called post-commit in the hooks folder of every repository. Change the file to include the necessary commands* to do the copying for you and make it an executable post-commit.exe.

Afterwards, every time you commit a new revision, that script should handle it for you.

*By necessary commands I mean, either do the copying via the Windows cmd prompt, or call another script to do the job from within post-commit.exe.

Also, even though SVN docs mention that the post-commit hook needs to be either .bat or .exe file, I've had it working only when it's .exe on my machine.

You can convert .bat files into binary .exe using tools available here and here. The second one is much more user-friendly. I hope it helps.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top