0

I need to grep for specific comments from a cvs file and give an output based on that in a python file.

For example, if there is a comment saying "deleted" then i need a command which outputs the comment so that I can assign that output to a variable and do an re.search on the contents of that variable in my python file.

Nate
  • 30,286
  • 23
  • 113
  • 184
  • You shouldn't be parsing the repository files (`*,v`) manually. You should use cvs commands to get the information you need. – Burhan Ali May 30 '12 at 13:02

1 Answers1

1

I'll assume that by "comment", you mean the log message provided with cvs commit.

Given just a *,v file, you can use the rlog command (part of rcs, not part of cvs) to get a log that will show all the commit messages.

But ordinarily it should be part of a CVS repository; in that case, cvs log will do the same thing.

Both rlog and cvs log produce very similar plain-text output that should be reasonably easy to parse.

That's about all I can come up with based on the information you've given us. Provide a more detailed question, and we can probably give you a more detailed answer.

UPDATE :

If by "comments" you mean text in the files themselves rather than commit messages, you can extract individual versions of the file using a command like this:

cvs update -p -r1.23 filename

The -p option tells cvs update to print the contents of the file to stdout.

Shameless self-promotion: My own get-versions tool lets you grab multiple versions of a file in a single command (it currently works with RCS, CVS, and Git).

Extracting a particular comment and storing it in a variable will require more work and, as I said, a more detailed question.

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631