2012-06-06 39 views

回答

0
SVNProperties props=new SVNProperties(); 
    repository.getFile(filePath,new Long(-1),props,null); 
    String author=props.getSVNPropertyValue("svn:entry:last-author").toString();  

工作正常。

0

你可以使用svn关键字http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html'修改'应该是作者。

您必须确保在每次检入前都会更改包含关键字的文件。这可以使用ant脚本来完成。

关键字可以以恒定使用具有第二恒定提取有趣的部分:

private static final String SVN_AUTHOR_BASE   = "$Author: 113665 $"; 

/** Is filled in automatically on check in */ 
public static final String SVN_AUTHOR     = SVN_AUTHOR_BASE. 
           substring(9,SVN_AUTHOR_BASE.indexOf('$', 9) - 1); 
0
public static String getLastModifiedBy(File localPath) throws SVNException { 
    final SVNStatus status = SVNClientManager.newInstance().getStatusClient().doStatus(localPath, false); 
    return status != null ? status.getAuthor() : null; 
}