How to link svn hooks to checked out repository
-
25-06-2021 - |
Question
How to link svn hooks to checked out repository?. I have checked out a sample SVN repo. And with SVN-admin option, I created svn repo(?), which has sample hooks . But how do I link my newly written script to work on local checked-out repo?. Its needed ,, as I have test the script locally before putting in admin area.
Thanks
Solution
I think there might be some terminology-related confusion here. If you check out a repository using svn checkout
, what you have is not a repository. It is a working copy. You can't do repository operations (like commit
or branch
) to a working copy, only to a repository.
If you are trying to test hook scripts, you need to first set up a repository on your local machine. You can either make your local repo act as a mirror of the "real" repo, or you can seed your local repo using a copy of your data. To do the latter, the procedure looks something like this:
- Use
svn export
to grab a snapshot of your "real" repo. Usingexport
instead ofcheckout
is important, sinceexport
will not create the Subversion metadata folders that are normally present (this is important). - Use
svn import
to load this tree into your local repository.
This will result in the HEAD of your local repository looking exactly like the HEAD of your "real" repo. Your local repo won't have the full history since it's not a complete mirror, but it will have the same file and folder layout. Most of the time, this is sufficient for the purposes of testing scripts.