tags:

views:

113

answers:

1

The company which I work for uses CVS as source control and we have an intranet application(Source forge) which expose the repository i.e. we can see the source file using that interface but it does not provide any search facility where I can search for the code snippets for the given keywords.

I want to write an application which can search the code snippet.Ex. would be Koders.com which provides search for the given keyword and gives a link to browse the source file. The two ways I can think of is

1-Search in cvs repository (for which access may be an issue.)

2-Search the intranet application which exposes all the source files.

What do you guys think will be the right approach. I was planning to index it in a seperate database and use that for search but have no idea how to do that. Any help is appreciated :)

A: 

When I was asked the question "Do we have a file called somefile.txt in the CVS repository?" or "Do we have a file containing sometext?" (since I had access to the underlying repository) I just ran find commands on the CVSROOT. When doing this, remember that CVS stores files using RCS so files are appended with ,v. So when looking for somefile.txt you have to look for a file called somefile.txt,v.

find $CVSROOT -type f -name somefile.txt,v

or

find $CVSROOT -type f -exec grep sometext {} \; (it might need to be a little more complicated to do it nicely, but you get the gist)

If the file has been "deleted" you will see that it's in an Attic directory. Also, be careful not to edit these ,v files since it's easy to break.

If you don't have access then you'd have to check out the entire repository and then search on your local machine but you'd not effectively get a search of the history.

Tom Duckering