views:

7643

answers:

13

Is there any good software that will allow me to search through my SVN respository for code snippets? I found 'FishEye' but the cost is 1,200 and well outside my budget.

A: 

If you have a copy checked out, then you could use grep in any *nix distribution, or you can use its Windows counterpart.

Noah Goodrich
+1  A: 

A lot of SVN repos are "simply" HTTP sites, so you might consider looking at some off the shelf "web crawling" search app that you can point at the SVN root and it will give you basic functionality. Updating it will probably be a bit of a trick, perhaps some SVN check in hackery can tickle the index to discard or reindex changes as you go.

Just thinking out loud.

Will Hartung
This is probably not a good idea, as the overhead involved would be huge. Also, SVN-servers aren't usually regular web-pages, but a svn repo exposed through webdav.
torkildr
+1  A: 

theres krugle and koders but both are expensive. Both have ide plugins for eclipse.

Brendon
What about Krugle Basic?
Bård
+3  A: 

I do like TRAC - this plugin might be helpful for your task: http://trac-hacks.org/wiki/RepoSearchPlugin

Kai
this looks somewhat promising... but not too terribly easy to install, can't confirm if it works with Trac+VisualSVN Server.
Kit Roed
+4  A: 

We use http://opensolaris.org/os/project/opengrok/

Ben Noland
+1  A: 

If you're really desperate, do a dump of the repo (look at "svnadmin dump") and then grep through it. It's not pretty, but you can look around the search results to find the metadata that indicates the file and revision, then check it out for a better look.

Not a good solution, to be sure, but it is free :) SVN provides no feature for searching past checkins (or even past log files, AFAIK).

rmeador
+3  A: 

Painfully slow (and crudely implemented) but a combination of svn log and svn cat works if you are searching the history of single files or small repositories:

svn log filetosearch |
    grep '^r' |
    cut -f1 -d' ' |
    xargs -i bash -c "echo '{}'; svn cat filetosearch -'{}'"

will output each revision number where file changed and the file. You could always cat each revision into a different file and then grep for changes.

PS. Massive upvotes to anyone that shows me how to do this properly!

Ken
Just use `git-svn`. Git has built-in search for code in commit history. But you will need to download the whole commit history to use `git-svn`.
Vi
+10  A: 

There is http://sourceforge.net/projects/svn-search/ and also a Windows application directly from the SVN home at http://svnquery.tigris.org/. The latter is very beta, but working.

Elmar Weber
+1 for svnquery
Seth Reno
A: 

If you're searching only for the filename, I use:

svn list -R file:///subversion/repository | grep filename

(windows: svn list -R file:///subversion/repository | findstr filename)

..otherwise checkout and do filesystem search: egrep -r code . Windows: Install cygwin, or upgrade to Linux ;-)

+1  A: 
  1. Create git-svn mirror of that repository.
  2. Search for added or removed strings inside git: git log -S'my line of code' or the same in gitk

The advantage is that you can do many searches locally, without loading the server and network connection.

Vi
A: 

Just a note, FishEye (and a lot of other Atlassian products) now have Free Starter Editions, which in the case of FishEye gives you 5 repositories and access for up to 10 committers.

www.atlassian.com/starter

Maybe someone with higher rating can add this as a comment to the original question.

DEF
A: 

I tried to let my crawler index my VisualSVN Server - but it's repository browser doesn't serve HTML (so most crawlers can't follow the links). It actually serves XML/XSLT and it lets your browser do the transform to HTML as you go.

I wound up writing a little app to do the transform server-side so my crawler could index it. Works great. Full app and details here:

http://programmerramblings.blogspot.com/2010/08/visualsvn-server-search.html

Good luck-

kman0
A: 

I started using this tool

http://www.supose.org/wiki/supose

It works fine just lacking a visual UI, but is fast and somewhat maintained

Kuryaki