What is the easiest way to figure out who wrote/edited this line of code?
Asked Answered
G

7

8

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.

Gwennie answered 15/12, 2008 at 7:45 Comment(1)
Ah, and here then is the root of all version control antagonists. Basic accountability. :-oEatables
P
17

That looks like the blame function, supported in eclipse with CVS, or with Subversion (also in eclipse)

As you mention, the eclipse-name for that feature is Show Annotations.

Eclipse Show-Annotations

Pearse answered 15/12, 2008 at 7:49 Comment(1)
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.Kickshaw
C
7

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

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

svn blame

:)

Cristoforo answered 15/12, 2008 at 7:48 Comment(1)
He didn't in his initial post. :)Cristoforo
O
2

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

Oven answered 15/12, 2008 at 8:16 Comment(0)
P
1

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.

Pillory answered 15/12, 2008 at 15:13 Comment(1)
I found that TortoiseHg (Mercurial client) also includes this feature (Annotate Files)Kickshaw
S
1

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
(source: accurev.com)

Soinski answered 4/1, 2009 at 13:7 Comment(0)
S
1

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.

Septuple answered 3/2, 2009 at 21:29 Comment(0)
R
0

For perforce plugin in Eclipse annotate is not showing up in the context menu. So I need to use: p4 annotate my-file and then using Eclipse browse the history.

Rotund answered 28/12, 2012 at 21:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.