SVN Repository Search

SvnSearchCode Search-Engine

Svn Problem Overview


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.

Svn Solutions


Solution 1 - Svn

If you're searching only for the filename, 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_ .

Solution 2 - Svn

There is sourceforge.net/projects/svn-search.

There is also a Windows application directly from the SVN home called SvnQuery available at http://svnquery.tigris.org

Solution 3 - Svn

Update April, 2022

VisualSVN Server 5.0 supports full-text repository search through the contents and history. Try out the new full-text search feature on the demo server.

Update January, 2020

VisualSVN Server 4.2 supports finding files and folders in the web interface. Try out the new feature on one of the demo server’s repositories!

See the version 4.2 Release Notes, and download VisualSVN Server 4.2.0 from the main download page.

enter image description here


Old answer

Beginning with Subversion 1.8, you can use --search option with svn log command. Note that the command does not perform full-text search inside a repository, it considers the following data only:

  • revision's author (svn:author unversioned property),
  • date (svn:date unversioned property),
  • log message text (svn:log unversioned property),
  • list of changed paths (i.e. paths affected by the particular revision).

Here is the help page about these new search options:

 If the --search option is used, log messages are displayed only if the
 provided search pattern matches any of the author, date, log message
 text (unless --quiet is used), or, if the --verbose option is also
 provided, a changed path.
 The search pattern may include "glob syntax" wildcards:
     ?      matches any single character
     *      matches a sequence of arbitrary characters
     [abc]  matches any of the characters listed inside the brackets
 If multiple --search options are provided, a log message is shown if
 it matches any of the provided search patterns. If the --search-and
 option is used, that option's argument is combined with the pattern
 from the previous --search or --search-and option, and a log message
 is shown only if it matches the combined search pattern.
 If --limit is used in combination with --search, --limit restricts the
 number of log messages searched, rather than restricting the output
 to a particular number of matching log messages.

Solution 4 - Svn

Solution 5 - Svn

  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.

Solution 6 - Svn

This example pipes the complete contents of the repository to a file, which you can then quickly search for filenames within an editor:

svn list -R svn://svn > filelist.txt

This is useful if the repository is relatively static and you want to do rapid searches without having to repeatedly load everything from the SVN server.

Solution 7 - Svn

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

Solution 8 - Svn

Just a note, FishEye (and a lot of other Atlassian products) have a $10 Starter Editions, which in the case of FishEye gives you 5 repositories and access for up to 10 committers. The money goes to charity in this case.

>www.atlassian.com/starter

Solution 9 - Svn

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!

Solution 10 - Svn

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).

Solution 11 - Svn

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.

Solution 12 - Svn

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

Solution 13 - Svn

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

Solution 14 - Svn

// Edit: Tool was already mentioned in another answer, so give all credits to Kuryaki.

Just found SupoSE which is a java based command line tool which scans a repository to create an index and afterwards is able to answer certain kinds of queries. We're still evaluating the tool but it looks promising. It's worth to mention that it makes a full index of all revisions including source code files and common office formats.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJohnView Question on Stackoverflow
Solution 1 - Svnphil_wView Answer on Stackoverflow
Solution 2 - SvnElmar WeberView Answer on Stackoverflow
Solution 3 - SvnbahrepView Answer on Stackoverflow
Solution 4 - SvnBen NolandView Answer on Stackoverflow
Solution 5 - SvnVi.View Answer on Stackoverflow
Solution 6 - SvnContangoView Answer on Stackoverflow
Solution 7 - SvnKaiView Answer on Stackoverflow
Solution 8 - SvnDavid d C e FreitasView Answer on Stackoverflow
Solution 9 - SvnKenView Answer on Stackoverflow
Solution 10 - SvnrmeadorView Answer on Stackoverflow
Solution 11 - SvnWill HartungView Answer on Stackoverflow
Solution 12 - SvnBrendon-Van-HeyzenView Answer on Stackoverflow
Solution 13 - SvnKuryakiView Answer on Stackoverflow
Solution 14 - SvnjekView Answer on Stackoverflow