File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes CVS Comments added to Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "CVS Comments added to Code" Watch "CVS Comments added to Code" New topic

CVS Comments added to Code

Lisa Carter

Joined: May 29, 2003
Posts: 25
Hello Group,

I saw a neat trick that one of my co-workers did. He added some comments to the Java code. When the committed in cvs, the code is updated with the comments entered into CVS. My question is where can I learn more about this neat trick. I wanted to understand it better. He's been using it for awhile and didn't know where I could get more info. Any info you have that can point me in the right direction would be great. Thanks in advance.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Do you just mean things like

$Id:,v 1.39 2005/10/11 22:04:50 ejfried Exp $

To get a comment like that, which is always kept updated with the file version, committer, commit date and time, you just put "$Id$" into your source. It'll be expanded the next time you commit.

Here's some other keyword substitutions, from the CVS info page:

[Jess in Action][AskingGoodQuestions]
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
I actually don't like this feature very much. Your IDE should provide this information to you in a much more comfortable way, anyway (like the "Resource History" view in Eclipse). If it does, it just adds clutter to the code, in my opinion.

I guess it can be valuable when you print your sources a lot, though, so your mileage might certainly vary...

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

it works well for when you remove your code from the ide environment. such as printing as you said.

you can find information like this in the 'cederqvist' or whatever they are calling the help files of CVS

Google 4tw.
Lisa Carter

Joined: May 29, 2003
Posts: 25
thanks for the info. I tried to look up the codes in eclipse but no luck. We have to list all of the changes in our source code and this would be the easiest way. It stops me from adding commentsin CVS and then in my code. Using these variables allows the comments to autmatically be added. Thanks again for your help.
I agree. Here's the link:
subject: CVS Comments added to Code
It's not a secret anymore!