I have a server repository of branch and trunk. The branch is all team members' repositories. I'm trying to use svn hooks
only in my repo under branch, but it doesn't seem to work fine. In the following are the steps I tried to approach:
checked out
my_repo
from the remote server'sbranch/my_repo
since the local repo
my_repo
doesn't have any content, I created a new svn repo locally and copied over everything including the/hooks
folder tomy_repo
.I created an empty file in
my_repo
and added a line of text. Thensvn add
this file.modified the
my_repo/hooks/pre-commit.tmpl
file and make it always not pass with error code 1. Now it looks like:
#!/bin/sh exit 1
copy the
pre-commit.tmpl
to pre-commit and add execute permit of pre-commit to myselfThe server contains other people's now the server's structure is like:
- server - branch - my_repo - myfile - hooks - pre-commit - Tom's repo - other team member's repo - trunk
- in the checked out repo I committed the changes using:
svn commit -m "dumb change"
Now from here I should not be able to commit and it should give me an error with code 1 right? But I don't see it anywhere.
- Then I tried putting the hooks folder at the top level and at same level as branch and trunk. i.e. the structure looks like:
-server - branches - my_repo - myfile - Tom's repo - other team member's repo - trunk - hooks - pre-commit
But, still not working. sigh...
HOWEVER, with David's help, I figured out what to do and what was wrong: 1. To highlight: the ownership of the hooks folder should be the same as who created to repository. Thus I had to ask the owner to add the hooks files to the server. I didn't create the repository on the server, thus the files are invisible in my working directory. 2. now here's what I tried:
1) on my own Linux system, I `svnadmin create` a new repository, maybe called test_server: in that there is folders: confs, db, hooks, locks; files: format, readme.txt 2) on the same level, mkdir a new folder (called working_dir) as your local working directory and checkout from the test_server. Now the working_dir contains a folder called test_server and it's empty. You can't see any of the folders or files in step 1 3) modify the test_server's hooks file as described above. 4) try to add a file and add a new line to the file in the working_dir/test_server folder and commit. 5) now you should see commit failed with message: svn: Commit blocked by pre-commit hook(exit code 1) with no output.
Thank you so much David and anyone put comments earlier!