tags:

views:

1184

answers:

2

I'd like to automate TortoiseSVN as part of a commit process. Specifically I'd like to dynamically create a log entry for the commit dialog.

I know that I can launch the commit dialog either from the commandline or by right clicking on a folder and selecting svncommit.

I'd like to use the start commit hook to setup a log entry. I thought this worked by passing an entry file name in the MESSAGEFILE variable but when I add a hook script it cannot see this variable (hook launched successfully after right clicking and choosing svncommit).

When I try using the commandline I use the /logmsgfile parameter but it seems to have no effect.

I'm using tortoisesvn 1.5.3.

+1  A: 

Looks like it was my own misunderstanding of the the API that caused by a problem.

Solution:
1) I've added a start commit hook script to TortoiseSVN using the hooks gui in the settings area of the right click menu.

2) The script receive 3 pieces of information: PATH MESSAGEFILE CWD
For details see: Manual
These are passed as command line arguements to the script - for some reason I had thought they were set as temporary environmental variables.

My script then simply opens the file specified by the second arguement and adds in the custom text.

When the commit dialog comes up the custom text is there.

3) Best of all if tortoisesvn is launched from a script directly into the commit dialog:
e.g. [ tortoiseproc /command:commit /path:. /closeonend:1 ]
The hooks are still called.

morechilli
+1  A: 

If you just need a static template, set the tsvn:logtemplate property.

For dynamic generation, the /logmsgfile parameter does work, but it seems to need the full path. A batch file that looks like the following might work for you.

GenerateLogMsg.exe > tmp.msg
"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:. /logmsgfile:"C:\Documents and Settings\User\My Documents\Visual Studio Projects\Project\tmp.msg"
Nathan Jones
The fullpath required for /logmsgfile seems to be why I was having problems with that particular command. Thanks!
morechilli