SVN windows post-commit update hook 6

The environment is Windows XP running apache2 using TortoiseSVN. This is a development server that also has a copy of the repository trunk checked out and I want that checkout updated when somebody commits to the repository.

I spent hours on Google today trying to figure out how to get a hook script working on windows for SVN.

I found only one decent resource that didn’t work.  I kept getting the error ‘post-commit hook failed (exit code 1) with output: ‘svn is not recognized as an internal or external command, operable program or batch file.

Finally, a friend helped me out by looking up their configuration, which was a similar setup, and pointed me in the right direction. In the post-commit.bat file you create, the only thing in the file should be this windows command:

“pathToYourSVN.exe” update –username yourSVNUserName –password yourSVNPassword pathToYourCodeCheckout

It’s a very different solution and very simple as well.  Hope this helps!

TortoiseSVN merging branch back into trunk 1

Merging changes back into the trunk incorrectly can really screw things up.  Trust me, I found out the hard way.   Below is a checklist of steps to follow.

1.    Update trunk from repository
2.    merge branch from trunk and take care of any conflicts
3.    View localhost and make sure everything looks good
4.    Commit merge changes to branch repository
5.    Merge branch into trunk locally.  Perform a test run first, then merge.
6.    Fix any conflicts
7.    Commit to repository trunk
8.    View development or staging server to verify changes

Below is the interface for TortoiseSVN and sample data for when you “merge two different trees”.  Select the trunk in the first drop down and the branch in the second drop down.  The result of the merge will be stored in the trunk.  Remember to commit your changes afterward.

SVN merging with TortoiseSVN

If you’re going to perform a merge, I can assume you’ve already created, checked out, and have made modifications to a branch from your code repository.  On your checkout, right click a directory or single file and select “TortoiseSVN” then “Merge” from the context menu.

From the next window, you may need to alter the “From” URL to your repository.  This will most likely be pointing to the same directory or single file in the trunk of your repository.  For beginners, this can be confusing.  What the interface is asking you to do is specify a revision range to merge with your files.  In most cases, the “From” and “To” URL will be exactly the same.  The difference is the “From” entry where you’ll need to specify the beginning revision number to start the merge.  The “To” entry will usually be the “Head Revision” if you’d like to get the most recent commits.  The “result of the merge” will automatically point to your branch.  Perform a “Dry Run” the first couple times until your comfortable with the process.

Watch for conflicts

Edit and resolve conflicts, then commit all changes to your branch.