2012-06-06 55 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; 
}