Question

What I need is to check content of all last day CVS committed files for occurrence of certain expressions in code and report it with its committer.

In order to do that, I have to get content of the files, but I am able to get only list of committed files with other obvious attributes. The command I used for it is

cvs history -a -c -D <today's date> > cvs_history.txt

Is there some way, I could modify the command, so I can get what I need? Or will I have to parse the history output file and checkout all the files mentioned, so I can search them through? What is most efficient way to do it?

NB. I'm writing it in Ant script (if that is going to make things somehow easier).

Thank you, Jakub

Edit:

I need to do it every night for all commits in the company (list of users constantly changing).

After some research of CVS commands, I'll probably have to take the history list and get rdiff for each file from list (interested only in code added). And to call rdiff, I must know revisions: the last revision is from history and it's previous from rlog - it's a bit more difficult, because I need to take into account also branch revisions. All this will have to be glued together with Perl script using regex and that will finally combine it into the output I need.

I think that'll do it, but it can take long time for large number of commits. Could it be easier?

Was it helpful?

Solution 2

So, to answer my question, when the only I needed was committed content of the last day, I did create a Perl script that calls

cvs history -a -c -D $today

and saves the output to the commit-log.txt file (that might not be needed, but I just did it to save memory). Then I just process the commit-log.txt file and select only th efiles from my domain. On these I call

cvs rdiff -r $prevRev -r $revision -u $repoName/$file

where $prevRev is just lastDigit($revision) - 1. That just gets me a diff content, so I append it to the report and process it as I need then (search for unwanted expressions...).

if I would want the whole content of the file, I would just use the first $firstRevision (might be 1.1, or 1.0) instead of $prevRev in the command above.

Also, just as a matter of interest, we like to see the name of the branch instead of revision num in the report. So I use 'rlog' ouptut in similar way as above and extract the branch name related to the committed revision number.

Thanks for interest and suggestions guys ;o)

OTHER TIPS

If you have a limited set of users you can run the history command for each user and combine the output.

cvs history -u username ....
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top