views:

405

answers:

2

Has anyone ever found other ways to get a file's commit history outside of solution explorer? It's really annoying that history is so stagnant because it is a really helpful view. I just wish it would show the current file. Here is the use case.

I build my gigantic solution, find random errors in files I have never heard of and want to know who's at fault. I can get to the file by double clicking from the Error List view, but right clicking doesn't work, nor does navigating View->Other Windows->History. If I can even get the history view, I just get the last history that I right-clicked from the Solution Explorer. +1 Also for anyone that has a way to find a file in the solution.

+2  A: 

I would grep the build log and pipe the output to the TFS powershell tools, but I'm a command line kind of guy. If you want to work inside VS, I don't think you can do any better than doubleclicking the row in the Errors toolwindow. In addition to opening the file, this should automatically expand whatever projects & subfolders are needed so that the file is clickable in Solution Explorer (including rightclick -> History).

Quite aside from source control integration, here's the quickest way to open a file anywhere in the active solution: http://blogs.msdn.com/andrewarnottms/archive/2008/08/02/visual-studio-trick-to-quickly-find-any-file-in-solution.aspx

EDIT: here's a quick-n-dirty command line to look up the last 2 changes to every file with build errors.

$regex = [regex] "(?<filename>\S+\.cs).*error"
msbuild | %{ $regex.Matches($_) } | %{ $_.groups["filename"].value } | select -unique | %{ tfhist $_ -stop 2 }
Richard Berg
Is there a built in grep in VS, and what would the command be for a file with an unknown path (or one with a path for that matter)? I have never seen the behavior of expand to show the file in the solution explorer. As you say, the link is useful, but off topic.
TahoeWolverine
Visual Studio has a grep feature but it's even worse than its build system. (for example, its regex syntax is incompatible with the .Net BCL!!) The example above (see edit) assumes you're building from Powershell. ----- Solution Explorer expands for me, but if it doesn't, you can always use the File -> Source Control menu. ----- The link is not related to TFS but does directly answer your final question ("+1 also for anyone that has a way to find a file in the solution")
Richard Berg
These are all very good ideas. Powershell is a Vista thing right? I'm on XP at work. The solution does not expand, and I don't see a history option from the file menu. The link provides an easy way to open a file by name, but still, I have no idea what project and folder that file might be in.
TahoeWolverine
Powershell can be installed on XP SP2 and above. ---- Using the Command Window to open a file doesn't require you to know what project it's in. Just start typing the name.
Richard Berg
Richard Berg
+2  A: 

Double-click the error message to open the file. Then File > Source Control > Annotate to put a list of revisions down the left hand side. You can then click a revision number to get the details.

apathetic
Hmm, I can't seem to find the Annotate option, but that navigation path is nice to know about.
TahoeWolverine
Make sure you have 2008 SP1 for Annotate to be available.
Richard Berg
Found it! That's a really slick feature that I would have liked to know about from the get go. Thanks for enlightening me.
TahoeWolverine
I found Annotate, and it gives a real sleak view of the changes made to the file. This is more than what I had hoped for. Thanks for enlightening me. An answer to my question was that the Error List has a "Project" column that shows the project path to the file, which helps me to find where something is in the solution.
TahoeWolverine
An even better answer that I found was that there is a history button in the TFS toolbar, which actually works!
TahoeWolverine
You can add Annotate to the TFS toolbar (or any other toolbar) as well.
Richard Berg