In subversion is there a command to list all the available repositories registered on a particular host?
Eg. in ClearCase, a cleartool lsv开发者_C百科ob
would give me the listing of all the versioned databases in a given region. I have not been able to find anything akin to this in subversion.
No. Each subversion repository is independent and knows nothing about the others. There would be no way to locate all of the subversion repositories.
We keep all of our repositories in a standard location (/data/svn
) and can easily and programatically list all of the repositories:
ls /data/svn
Or from a remote system:
ssh svn ls /data/svn
SVN repos have a distinct structure (/conf, /hooks, /db, /locks), so searching for one if its components would be a start.
If locate/updatedb is installed and current:
locate /db | grep /db$
Or by an exhaustive search:
find / -type d | grep /db$
A more sophisticated search would check for the full set of components.
You can create subversion repos anywhere on your server and they are not linked to each other.
In my server I put everything in /var/svn/ then I can list all the repository using ssh and listing this repository.
$ find -iname .svn
it should list all working directories on a host
If the svn server is local,for Linux from shell use these commands
#ps aux|grep svnserve/media/Hitachi_boot_disk/Repositories
This will show you how the svn service was started. It will look something like:
/usr/bin/svnserve -d -r /media/Hitachi_boot_disk/Repositories
The path following the -r specifies the path to all Repositories
#cd /media/Hitachi_boot_disk/Repositories
#ls
This will list all the repositories under this server
If you relax the requirement to a smaller set of suspected directories, this command is useful for scripting to get the base directories of a bunch of svn repositories, but it's too slow for searching /. If you need entire system I'd pursue BobC's solution. This method works on repositories and not working copies.
find <directories> -type d -exec bash -c 'if svnlook info "{}" 1>/dev/null 2>&1; then echo "{}"; fi' \;
精彩评论