Reputation: 20391
I'm working on writing a script which will append a copyright comment to the beginning of each source code file.
This comment needs to have the the original check in date's year. To get this I need to query CVS to get the original check in date for each file, but haven't found an easy way to do this. Is there an easy to way to get this information?
Upvotes: 1
Views: 161
Reputation: 263257
The first revision is 1.1
(at least that's the default; I don't know whether there's a way to override it).
So this:
cvs log -r1.1 filename
should give you a log showing just the initial revision, and something similar to this:
cvs log -r1.1 -N filename | sed -n '/^date: \(....\).*$/s//\1/p'
should give you the year of the initial checkin date. (The -N
option tells it not to list the tags, which is not important but it does slightly less work.)
The exact format of the date:
line might vary across different versions of CVS; you might need a more robust way to find the year. The script could check that the result of the above command is a 4-digit number in a reasonable range and complain if it isn't.
Upvotes: 2