How to search cvs comment history

cvs
Chris Noe picture Chris Noe · Sep 23, 2008 · Viewed 19.5k times · Source

I am aware of this command: cvs log -N -w<userid> -d"1 day ago"

Unfortunately this generates a formatted report with lots of newlines in it, such that the file-path, the file-version, and the comment-text are all on separate lines. Therefore it is difficult to scan it for all occurrences of comment text, (eg, grep), and correlate the matches to file/version.

(Note that the log output would be perfectly acceptable, if only cvs could perform the filtering natively.)

EDIT: Sample output. A block of text like this is reported for each repository file:


RCS file: /data/cvs/dps/build.xml,v
Working file: build.xml
head: 1.49
branch:
locks: strict
access list:
keyword substitution: kv
total revisions: 57;    selected revisions: 1
description:
----------------------------
revision 1.48
date: 2008/07/09 17:17:32;  author: noec;  state: Exp;  lines: +2 -2
Fixed src.jar references
----------------------------
revision 1.47
date: 2008/07/03 13:13:14;  author: noec;  state: Exp;  lines: +1 -1
Fixed common-src.jar reference.
=============================================================================

Answer

s_t_e_v_e picture s_t_e_v_e · Dec 19, 2008

The -w options seems to work better with the -S option. Otherwise there are additional results which don't seem related to the userid. Perhaps someone can explain it.

cvs log -N -S -w<userid> -d"1 day ago"

With that I have been getting reasonable success piping it to grep:

cvs log -N -S -w<userid> -d"1 day ago" | grep -B14 "some text" > afile

I'm redirecting output to a file since the cvs log is noisy and I'm not sure how to make it quiet. I suppose an alternative is to redirect the stderr to /dev/null.