我正在尝试从 SVNKit 文档中的文档中编写/改编的方法,但无济于事。如果文件与特定修订版匹配,我正在尝试打印出文件的内容。问题是我不确定如何正确使用 getfile 调用。我只是不确定我需要传递给它的字符串。任何帮助将不胜感激!!
public static void listEntries(SVNRepository repository, String path, int revision, List<S_File> file_list) throws SVNException {
Collection entries = repository.getDir(path, revision, null, (Collection) null);
Iterator iterator = entries.iterator();
while (iterator.hasNext()) {
SVNDirEntry entry = (SVNDirEntry) iterator.next();
if (entry.getRevision() == revision) {
SVNProperties fileProperties = new SVNProperties();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
S_File toadd = new S_File(entry.getDate(), entry.getName(), entry.getRevision());
try {
SVNNodeKind nodeKind = repository.checkPath(path + entry.getName(), revision); //**PROBLEM HERE**
if (nodeKind == SVNNodeKind.NONE) {
System.err.println("There is no entry there");
//System.exit(1);
} else if (nodeKind == SVNNodeKind.DIR) {
System.err.println("The entry is a directory while a file was expected.");
//System.exit(1);
}
repository.getFile(path + entry.getName( ), revision, fileProperties, baos);
} catch (SVNException svne) {
System.err.println("error while fetching the file contents and properties: " + svne.getMessage());
//System.exit(1);
}