3

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...

Community
  • 1
  • 1
santa
  • 983
  • 9
  • 30

3 Answers3

3

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\Ankh​SVN\VisualStudio\​<Version>\Conf​iguration (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.

WhiteKnight
  • 4,938
  • 5
  • 37
  • 41
  • i'll give that a shot on monday - if it works - the reward shall be yours! thanks in advance! – santa Mar 31 '12 at 15:05
  • 1
    sorry - haven't had time earlier - but look there: http://baevo.com/interwebs/client_side_hooks_in_ankhsvn.jpg the bounty shall be yours :-) thanks! – santa Apr 03 '12 at 07:07
  • The option doesn't seem working in Microsoft Visual Studio Community 2015 Version 14.0.25123.00 Update 2 on Windows 10. – alehro May 19 '16 at 10:07
1

Visual Studio > Tools > Options

enter image description here

Levitikon
  • 7,749
  • 9
  • 56
  • 74
  • ty levitikon for sharing, but i already got used to use a shortcut before commiting to kick of astyle as an external tool. maybe i'll give it a shot when i've got too much time on my hands the next days. but on the other hand - when does that happen :) – santa May 14 '13 at 08:34
0

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).

eckes
  • 64,417
  • 29
  • 168
  • 201
  • i use tortoise anyway - but i don't want to give up the vs-integration :-) – santa Mar 31 '12 at 15:04
  • Client side hooks are described in Tortoise help under "4.30.8. Client Side Hook Scripts" (most of the above answer is a quote from it). – user1068352 Jan 05 '13 at 22:07
  • @user1068352: yes, absolutely. The chapter in the TSVN docs is linked with this answer. But it's good practice here at SO not to only share a link but to bring up the contents of the link here in the answer. Doing so, the answer is still valid when the link target changes or is deleted. – eckes Jan 06 '13 at 11:00
  • @eckes I just wanted to point out that help file installed with Tortoise has it too. I was actually reading it while seeing your answer :) – user1068352 Jan 06 '13 at 19:47