views:

475

answers:

6

This obviously requires the source file to be under source control. I would ideally like a tool which works under the IDE (Eclipse, Visual Studio, etc) - but an external tool would be nice, too. Obviously, it is possible manually go through previous versions of the file, and compare the various versions, but I am looking for a way to be able to see quickly who is responsible for a code section.

I am using CVS, but the tool should ideally work with different source control systems.

+7  A: 

You don't mention wich source control are you using.

If you're using Subversion, you can take a look at:

svn blame

:)

OscarRyz
Ahem, he did mention CVS :)
Keltia
He didn't in his initial post. :)
OscarRyz
+12  A: 
VonC
That's precisely what I was looking for. This feature also synchronises with the "History" view, making it easy to check out details regarding the related check-in.
Ola Eldøy
+2  A: 

For Visual Studio .NET with TFS.

The function is "Annotate" and works pretty much the same with Blame.

(personally I refer to these as the team's witch hunt tool).

John Liu
+1  A: 

The question is quite broad/open. Somehow, it is a good idea, it can be used as reference...

At work, I use Perforce with its graphical interface. The Time-lapse view allows to see the file with, for each line, the revision version in which it has been changed, and details (who submitted the change, when, etc.). And you can move a slider to see previous versions.
There is a command line version: p4 annotate.

I am starting to use Mercurial so I looked at it. Version control systems comparison (good site, I just discovered it) shows that the command is hg annotate.

PhiLho
I found that TortoiseHg (Mercurial client) also includes this feature (Annotate Files)
Ola Eldøy
+1  A: 

In AccuRev this is even smarter with the annotate + "version slider" function, which will give you the option to browse through the annotated version of the file in history:

(Not only who changed what on the latest revision, but also on all revisions)

Accurev Version Slider

nav.jdwdw
+1  A: 

In many version control systems including CVS, Perforce, AccuRev, Mercurial, and Team Foundation Server, the command is annotate.

In Subversion and RCS, the command is blame.

For example, with CVS:

cvs annotate foo.cc > foo_changes.txt

will create foo_changes.txt, which lists the revision number and username associated with the most recent change for each line in the current version of foo.cc. Using different options will give you the same info for previous versions or tagged versions of the file.

I needed this question answered too, but it didn't jump out at me right away when reading the answers already posted, so hopefully this summary should help.

Scottie T