Automating TortoiseSVN

I have my Clarion REDirection file set up so that all generated files are created into sub-folders from the application folder. This makes the application folder clean, as no generated files are created there. In my version control setup, I decided to exclude those folders so that I do not version control the generated files.

I don't see a reason for it since I'm version controlling the .app files. For this I need to set Tortoise to ignore the files. I do that via the properties on the project root, by using the svn:ignore property and set it to ignore all my folders, using both the upper and lower case variations! Works fine, but this only ignores the files and doesn't remove them from the repository.

After some digging around, I found that since TortoiseSVN does not have a full command line interface for SVN available, they have made an exe that you can use to execute certain SVN functions directly via the TortoiseSVN interface. This is documented in Appendix D of the TortoiseSVN documentation, which is about Automating TortoiseSVN.

To make things easier for me I created a bat file to do the removal of the folders from version control.

"c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:remove /closeonend:1 /path:"z-backup"
"c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:remove /closeonend:1 /path:"z-clw"
"c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:remove /closeonend:1 /path:"z-inc"
"c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:remove /closeonend:1 /path:"z-lib"
"c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:remove /closeonend:1 /path:"z-obj32"
"c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:remove /closeonend:1 /path:"z-source"

Note that the statements above will wrap. This takes care of removing the folders and then I commit and I'm back in business. I just move this RemoveSVN.bat file from one folder to the other when I need to use it and this makes it much quicker to go through this process when dealing with multiple folders.

There is an option to put multiple paths on the /path: parameter, like:

REM "c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:remove /closeonend:1 /path:"z-backup*z-clw*z-inc*z-lib*z-obj32*z-source"

but I ran into problem with it where it would lock the folders, requiring to execute the "Cleanup" action on the folder to unlock it. I'm not sure why that happened, but it does not happen when dealing with the paths individually.

Version control actions are on my drawing board for Build Automator and my plan is to have it supporting at least TortoiseSVN/SVN before the end of 2010 and perhaps MS Team Foundation Server 2010. If you are using a different version control system and would like to see it supported by Build Automator please let me know:)

Arnor Baldvinsson

Leave a Reply