List Directory Entries in The Svn Repository

list directory entries in the svn repository?

If you are the subversion administrator, the following command will return the directories located in your repository.

svnlook tree $REPO_DIR --full-paths | egrep "/$"

The trick is the grep command that is looking for a trailing "/" character in the name

Same trick works for the svn command as well

svn list $REPO_URL -R | egrep "/$"

Extra notes

To repeatedly run this command you can put it into a shell for loop

for url in $URL1 $URL2 $URL2
do
svn list $url -R | egrep "/$"
done

How to list all files in a remote SVN repository?

This lists all files recursively:

svn ls -R URL-OF-REPO

Getting list of all folders but not the files

If you have access to the server (which I assume you do, given that you know well the size of the repository), you might consider using the svnlook program. Like svn, svnlook offers a collection of subcommands. You'll want the svnlook tree subcommand, and specifically the --full-paths option which causes it to print its output one-path-per-line instead of using a nested/indented approach. Piped through a grep that keeps only output which ends in a slash character (true only of directory paths), you'll have the list you seek.

$ svnlook tree /path/to/repos --full-paths | grep '/$'
/
/trunk/
/trunk/dir/
/trunk/otherdir/
/tags/
/tags/my-tag/
/tags/my-tag/dir/
/tags/my-tag/otherdir/
...

How can I create a directory listing of a subversion repository

You'll want the list command. Assuming you're using the command line client

svn list -R http://example.com/path/to/repos

This will give you a full recursive list of everything that's in the repository. Redirect it to a text file

svn list -R http://example.com/path/to/repos > file.txt

and then format to your heart's content.

How to get all files and directories from the SVN repository using java

"Authentication required" problem means that the server requires authentication but you didn't provide correct ISVNAuthenticationManager implementation to SVNClientManager. SVNKit supports different ways of authentication.

If you know what your credentials are, and they are fixed, you can use BasicAuthenticationManager implementation.

If you want to use credentials, stored in your ~/.subversion directory, use DefaultSVNAuthenticationManager implementation (there's a convenient method to construct it:SVNWCUtil.createDefaultAuthenticationManager() but note that this corresponds to Subversion commands with --non-interactive option). Look at SVNCommandEnvironment#createClientAuthenticationManager() implementation if you need authentication manager that would allow to enter password from console.

And finally I'd like to notice that SVNClientManager is a part of obsolete (though still supported). Instead prefer SvnOperationFactory class like in my another answer, it also has setAuthenticationManager() setter.

I'm one of SVNKit developers if this matters.



Related Topics



Leave a reply



Submit