This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CVS Comments added to Code

 
Lisa Carter
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you just mean things like

$Id: JoglModel3D.java,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:

 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic