-3

Can I in svn hooks for Windows to write a command which relocate automatically some folders to another location in repository?

Hook must run at server For example: Users commit files in his working copy (C:svnworkingcopy\dev) At server will run a hook and automatically relocated or copy this files into another folder of repository.(https://svnserver/onlyread) Where this user have permission to read only.
Thnk !

bahrep
  • 29,961
  • 12
  • 103
  • 150
  • 3
    Short answer... yes. but why? I'm trying to imagine why someone would want to do this, and only coming up with is awful. Why would it matter if the user only had read only access on the second path - they could simply commit to the first (which is essentially write access). – thekbb Oct 02 '12 at 14:01
  • It’s a organization matters. It’ll be a release folder of repositories, like glue between admin and developers. Only managers and admin of svn will have full permission. – user1714379 Oct 02 '12 at 20:46

1 Answers1

3

svn switch --relocate a user's working copy with a hook script? Looks like you are confusing the terms. Nevertheless I advise you to check the following warning in SVNBook:

While hook scripts can do almost anything, there is one dimension in which hook script authors should show restraint: do not modify a commit transaction using hook scripts. While it might be tempting to use hook scripts to automatically correct errors, shortcomings, or policy violations present in the files being committed, doing so can cause problems. Subversion keeps client-side caches of certain bits of repository data, and if you change a commit transaction in this way, those caches become indetectably stale. This inconsistency can lead to surprising and unexpected behavior. Instead of modifying the transaction, you should simply validate the transaction in the pre-commit hook and reject the commit if it does not meet the desired requirements. As a bonus, your users will learn the value of careful, compliance-minded work habits.

bahrep
  • 29,961
  • 12
  • 103
  • 150