views:

846

answers:

4

I found this question but the referenced options don't say anything about supporting "blame". What I'm looking for is an integrated way to ask "Who edited the line under the cursor last?".

I know most/all SVN clients give this in some form but I'd like something that makes it easy enough that I can do it on a whim: "Humm, who wrote that? [tap tap] Oh him."

+3  A: 

In VisualSVN supports blame to some extent - you can right-click on a file and select "Blame". However, it pops up a new window, which may not be as integrated as you want.

Jon Skeet
OK. Not near as clean as I'd prefer. (also I, personally, don't want to spend $$) Docs Link?
BCS
http://visualsvn.com/visualsvn/doc/ but it doesn't mention Blame. I can't say I've ever needed docs for Visual SVN. It just works, basically.
Jon Skeet
Dude...Visual SVN at $49 is a godsend...How much did Visual Studio Cost?
Jason Punyon
I don't think you can find better value for money
cgreeno
@JPunyon $0 ( http://www.microsoft.com/eXPress/download/ ) and using Tortoise isn't that hard. I'm trying to take the cost of getting a blame from low to practically nonexistent
BCS
@BCS: If you're using Express, add-ons won't work anyway; at least, that was the case with 2005. It's possible it's chnaged with 2008 of course.
Jon Skeet
I don't think it has. If you are using VS for anything that requires source control, you are likely violating the express license anyway...
Geoffrey Chetwood
@Rich B: My homework for English class is in source control, same for all my CS classes. For that mater, all my class work is in source control.
BCS
@BCS: That is fine, but why use Visual Studio for it? Please tell me you are not using VS to type english homework.... Also, many schools offer low cost VS licenses that might allow addons. You may want to check into this.
Geoffrey Chetwood
I might have been a bit obtuse but my point is that things "that requires source control" can be an insanity wide set. IMHO anything that can be done in VS *should* be done under source control.
BCS
VS.Net 2008 standard only costs $250 (check Amazon). Adding $50 to the cost of a $250 IDE is quite a bit extra if you can get the needed functionality for free. Now if you compare it to team system, that's quite a difference.
Kibbee
Well you *can* get the added functionality for free with AnkhSVN, which I suspect supports Blame as well, but I can't say for sure as I don't have it.
Jon Skeet
+1  A: 

I use a set of external tools wired to TortoiseProc.exe to perform SVN operations like log, diff, blame, revert, commit, update, etc. Then I create toolbar shortcuts to these external tools so that I have all the basic SVN operations accessible within the IDE.

Here are the steps to create a button to do a blame on the current file:

  1. Go to tools -> external tools and click "Add"
  2. Enter whatever title you want (e.g. "Blame")
  3. For the command, enter the following (the path will be different if you installed TortoiseSVN to a different directory): c:\Program Files\TortoiseSVN\bin\TortoiseProc.exe
  4. For the arguments, enter the following: /command:blame /path:"$(ItemPath)" /notempfile
  5. For the initial directory, enter: $(ItemDir)

Now, whenever you have a file open, simply go to tools -> Blame and it should generate the Blame in a popup window. You can also customize the toolbar and create a shortcut for this external tool to make it even easier.

Kevin Pang
Doesn't get the current line bit and that's what I'm really wanting.
BCS
@BCS, use these arguments: /command:blame /path:"$(ItemPath)" /notempfile /line:$(CurLine) /startrev:1 /endrev:-1
Derek Dahmer
+4  A: 
crashmstr
Nice! Here's the rest the steps I needed to take to get this working1) Open Tools > Macros > Macro IDE2) Put crashmstr's code in an existing or new module.3) Defined sTorEXE to point to TortoiseProc.exe, in my case sTorEXE = "C:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe"4) Had to make sShellCommand all one line (no linebreak like above). If you have any blue underlines in the IDE, fix the error or the macro may silently fail5) Made it into a button in Visual Studio by right clicking menu bar > Customize > Macros > [Dragged onto menu bar]
Derek Dahmer
+4  A: 
Bert Huijben
The thing I don't like about AnkhSVN's blame is that you need to right click on the file in the Solution Explorer instead of being able to do it right from the editor. Maybe the newer builds change this, but until then I'll use Tortoise for blame.
crashmstr
It is available in the editor context menu in the daily builds. But you can place the command anywhere by using the menu/toolbar customize option from Visual Studio.
Bert Huijben
danio