I'm looking for a way to search a whole subversion server.
I already got a piece of the puzzle to search within a repository. Now I need to do this for every repository.
I have to access this list from some unix shell script (perl, bash, etc.)
This question is related to
svn
version-control
search
If your server is Apache, you should be able to configure it to see the repository list with viewvc - this is the most basic one, other more complex interfaces exist but this is not your purpose here.
In some versions, ViewVC is an option of the standard installation now, for instance from Collabnet.
Edit: Nevermind my previous idea just above, Peter has a much simpler way of sending the repository list.
From there, you will have to:
Unfortunately in this case I cannot think of something more straightforward.
There are examples on SO on how to extract text from HTML pages in Python, this would be a good option since Python also has bindings for SVN, to perform the repository search - you can still call svn
directly from Python if you prefer.
If Python is not your cup of tea, you will have to process that differently with GNU tools (wget, then parsing tools or existing packages - I can't be of much help there, Carl gave you some more details in this post).
At my company they didn't configure the server to provide a list of repositories, so svn list
worked for a specific repository but not at a higher level to list all repositories.
However they installed FishEye which gives you a GUI listing the repositories https://www.atlassian.com/software/fisheye
It's a paid option, so it's not for everyone, but the functionality is nice.
If you enable svn via apache and a SVNParentPath directive, you can add a SVNListParentPath On directive to your svn location to get a list of all repositories.
Your apache conf should look similar to this:
<Location /svn>
DAV svn
SVNParentPath "/net/svn/repositories"
# optional auth stuff
SVNListParentPath On # <--- Add this line to enable listing of all repos
</Location>
Doesn't your access to SVN work just like a Web service? When I access the top directory of my SVN server, I get a page that's essentially a Table Of Contents of the whole works. It's an Unordered List that I can simply scan through.
EDIT: Here's how I would do it from the command line:
wget http://user:password@svn-url/ -O - | grep \<li\>
Sometimes you may wish to check on the timestamp for when the repo was updated, for getting this handy info you can use the svn -v (verbose) option as in
svn list -v svn://123.123.123.123/svn/repo/path
I was also looking to list repositories in SVN. I did something like this on shell prompt:
~$ svn list https://www.repo.rr.com/svn/main/team/gaurav
Test/
Test2/
Test3/
Test4/
Test5/
Test6/
If you know your way around Java, you can use SvnKit to do browse, search and God knows what with your Subversion server.
After that, you can package your program and invoke it either via an Ant task or a shell script.
It's quite a "brute force" solution, but once you master SvnKit, you can really do lots of cool things.
Source: Stackoverflow.com