Basically I want to do the same thing as the fella over there.
It seems that everybody was thinking about server-side hooks (with all their evil potential).
I want a client side script be run before commit so astyle can format the code the way my boss likes to see it.
Since my IDE (VS2010Pro) automatically checks when a file changed on the disk an opts me in for reloading it, there is no real evil with all that.
Is there any (clean) way to accomplish that with AnkhSVN?
Maybe there's also a way to extend VisualStudio to call my pre-commit-script...
It seems like AnkhSVN is being made to use TortoiseSVN's hook scripts, as there is a conversation about it being in the nightly builds. Also the daily updates seem to mention hooks (e.g revision 10870 and revision 10873.
Try getting a daily build and seeing the subversion options in Tools->Options->Source Control->Subversion Environment
in Visual Studio. If that doesn't work try opening Windows registry to HKEY_CURRENT_USER\Software\AnkhSVN\VisualStudio\<Version>\Configuration
(where <Version>
should be 10.0 for you) and adding a string named EnableTortoiseSvnHooks
with the data True
, as mentioned in the above conversation link.
Visual Studio > Tools > Options
If you could move away from AnkhSVN and switch over to TortoiseSVN, you'll get support for client side hooks for free.
You could use any executable thing as a hook and they get passed different parameters depending on the type of the hook scripts.
The pre-commit
hook for example gets the following parameters:
PATH DEPTH MESSAGEFILE CWD
Where the elements are the following:
PATH
A path to a temporary file which contains all the paths for which the operation was started. Each path is on a separate line in the temp file.DEPTH
The depth with which the commit/update is done.MESSAGEFILE
Path to a file containing the log message for the commit. The file contains the text in UTF-8 encoding. After successful execution of the start-commit hook, the log message is read back, giving the hook a chance to modify it.CWD
The current working directory with which the script is run. This is set to the common root directory of all affected paths.
While TortoiseSVN is not integrated into VS, I think it would be worth a look since you could use it as a general-purpose client for other projects too (i.e. all your other coding/scripting stuff that you don't do with VS).
来源:https://stackoverflow.com/questions/9888667/ankhsvn-client-side-pre-commit-hook