Blame source file from within visual studio
Asked Answered
D

2

6

I'm using AnkSVN within Visual Studio 2010, and it covers ~95% of my SVN needs. The biggest missing feature is that I can't find a way to blame a file from directly within VS. The workaround I currently use is to right click on the file within the tablist, and select Open Containing Folder, and then right clicking on the file in Explorer to call Blame.

Disentail answered 6/4, 2011 at 14:48 Comment(0)
K
1

I didn't like AnkhSVN's Annotate feature. So I used the following:
How to integrate TortoiseSVN into Visual Studio.

Content from above url:


If you're using Visual Studio, you can integrate TortoiseSVN commands to various context menus.

The first step is to add the TortoiseSVN commands as external tools, under the menu TOOLS->External Tools....

Add the name of the command, the path to TortoiseProc.exe and then the parameters for the command.

Use the VS variables wherever needed. Since I add my commands to the context menu of the open file tab, here's the parameters I used:

  • /command:blame /path:"$(ItemPath)" /line:$(CurLine)
  • /command:diff /path:"$(ItemPath)"
  • /command:log /path:"$(ItemPath)"

Notice the /line: parameter: this will make TortoiseBlame automatically scroll to the same line the cursor is located in the opened file in Visual Studio.

Now to add those new commands to the file tab context menu, go to TOOLS->Customize..., select the Commands tab, click the radio button Context menu and then select Other Context Menus | Easy MDI Document Window.

Now you have to select the commands. Problem is that the custom commands are not shown with their title but only as External Command X with X being the number of the external command.

In my case, the commands were number 9-11, you might have to do some trial-and-error here. Just add the commands you think are the ones you added and then check if the right ones show up in the context menu.


NOTE: In Visual Studio 2010 to add a command to the right-click menu of a document’s tab, first you’ll need to right-click on a Visual Studio document tab to work around a Visual Studio bug. (Otherwise the Easy MDI Document Window context menu doesn’t show up in the Customize dialog.) Source

Koosis answered 1/7, 2014 at 10:38 Comment(0)
S
7

It's called Annotate in AnhkSVN.

Subversion -> Annotate in the context menu.

Script answered 6/4, 2011 at 14:55 Comment(2)
Thanks, Ankh's annotate tool lags TortiseBlame enough in functionality (lack of color coding being the biggest issue) that I think I'll keep using the standalone version.Disentail
The Ankh annotation window is bad. The sidebar that shows the commits doesn't necessarily sync with the lines in the code, so it's impossible to tell what goes with what.Loner
K
1

I didn't like AnkhSVN's Annotate feature. So I used the following:
How to integrate TortoiseSVN into Visual Studio.

Content from above url:


If you're using Visual Studio, you can integrate TortoiseSVN commands to various context menus.

The first step is to add the TortoiseSVN commands as external tools, under the menu TOOLS->External Tools....

Add the name of the command, the path to TortoiseProc.exe and then the parameters for the command.

Use the VS variables wherever needed. Since I add my commands to the context menu of the open file tab, here's the parameters I used:

  • /command:blame /path:"$(ItemPath)" /line:$(CurLine)
  • /command:diff /path:"$(ItemPath)"
  • /command:log /path:"$(ItemPath)"

Notice the /line: parameter: this will make TortoiseBlame automatically scroll to the same line the cursor is located in the opened file in Visual Studio.

Now to add those new commands to the file tab context menu, go to TOOLS->Customize..., select the Commands tab, click the radio button Context menu and then select Other Context Menus | Easy MDI Document Window.

Now you have to select the commands. Problem is that the custom commands are not shown with their title but only as External Command X with X being the number of the external command.

In my case, the commands were number 9-11, you might have to do some trial-and-error here. Just add the commands you think are the ones you added and then check if the right ones show up in the context menu.


NOTE: In Visual Studio 2010 to add a command to the right-click menu of a document’s tab, first you’ll need to right-click on a Visual Studio document tab to work around a Visual Studio bug. (Otherwise the Easy MDI Document Window context menu doesn’t show up in the Customize dialog.) Source

Koosis answered 1/7, 2014 at 10:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.