tags:

views:

58

answers:

2

I'm trying to create a SVN Eclipese EFS plugin and have problems when getting the names of entries.

When I make a call to: SVNRepository

`//Fetches the contents of a directory into the provided collection object and returns the directory entry itself.

SVNDirEntry getDir(String path, long revision, boolean includeCommitMessages, Collection entries)`

It correctly returns the entry for the provided path, however, it doesn't set the "name" value on the "returned" entry. Note, the items returned in the collection are all OK.

Does anyone know why this is? And/or if there is a workaround?

See: http://svnkit.com/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html http://svnkit.com/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html#getDir(java.lang.String, long, boolean, java.util.Collection)

+1  A: 

I've checked and the SVNDirEntry returned by the getDir() method always has its name attribute set to an empty string.

However when that method is used to fetch a directory listing each directory entry has its name properly assigned.

I think that behavior is somewhat buggy though you can still find out the name of an SVNDirEntry through its URL:

SVNDirEntry dirEntry = repository.getDir("branches/1.0", -1, false, null);
String name = SVNPathUtil.tail(dirEntry.getURL().getPath());
Alexandre Jasmin
+2  A: 

It correctly returns the entry for the provided path, however, it doesn't set the "name" value on the "returned" entry. Note, the items returned in the collection are all OK.

Treat it like "ls" command to list entries in the directory. The directory itself will be represented as ".". Or better to say that name of the entry is relative to the directory and for the directory itself it is an empty string.

Does anyone know why this is? And/or if there is a workaround?

Use dirEntry.getURL() and then you may compute name from the URL's path. Also, directory name is either part of the "path" parameter or part of the SVNRepository object location URL.

Alexander Kitaev