开发者

svnkit: Problem getting entry name

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.Str开发者_StackOverflowing, long, boolean, java.util.Collection)


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.


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());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜