[英]Get history of a Deleted File from SVN using SVNKit
I am trying to access Revision History of a file that has been deleted using SVNKit. 我正在尝试访问已使用SVNKit删除的文件的修订历史记录。
Following is what I am doing to achieve that. 以下是我为实现这一目标所做的工作。
SVNClientManager manager = SVNClientManager.newInstance();
SVNLogClient logClient = manager.getLogClient();
logClient.doLog(svnURL, new String[] { fileName }, SVNRevision.create(deletedRevision),
SVNRevision.UNDEFINED, SVNRevision.UNDEFINED, false, false, true, -1, null,
new ISVNLogEntryHandler() {
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
log.debug(" ==== " + logEntry.getChangedPaths() + " === "
+ logEntry.getRevision());
}
});
Here, deletedRevision => The SVN revision in which File was deleted. 在这里,deleteRevision =>删除文件的SVN修订版。
When this code is executed I keep on getting following exceptions: 当执行此代码时,我不断收到以下异常:
org.tmatesoft.svn.core.SVNException: svn: '<FilePath>' path not found: 404 Not Found (https://<RepositoryURL>
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.logImpl(DAVRepository.java:976)
at org.tmatesoft.svn.core.io.SVNRepository.log(SVNRepository.java:1034)
at org.tmatesoft.svn.core.wc.SVNLogClient.doLog(SVNLogClient.java:1024)
at org.tmatesoft.svn.core.wc.SVNLogClient.doLog(SVNLogClient.java:891)
at com.blueoptima.connectors.scr.SVN.getWorkingFileList(SVN.java:711)
... 4 more
Is it something that I am doing wrong here? 我在这里做错什么了吗? Is there any other way to get the History of a deleted file using SVNKit
还有其他方法可以使用SVNKit获取已删除文件的历史记录
Though this question has been asked more than a year back but still thought of answering it if it could be other's help. 尽管这个问题已经有一年多了的历史了,但仍然想回答这个问题是否对别人有所帮助。
I didnt try for retrieving history of a deleted file but i could retrieve the history of a deleted branch using - 我没有尝试检索已删除文件的历史记录,但可以使用-检索已删除分支的历史记录。
SVNLogClient.doLog(SVNURL.parseURIEncoded(path), new String[] { "" }, pegRevision, SVNRevision.create(0),pegRevision, stopOnCopy, discoverChangedPaths, logsLimit, logHandler);
This is similar to the call you are making but you need to supply proper values for pegRevision
, startRevision
and endRevision
. 这与您进行的呼叫类似,但是您需要为
pegRevision
, startRevision
和endRevision
提供适当的值。 Use of UNDEFINED
may not give correct result, instead use the revision at which file was deleted as pegRevision and startRevision as 0 and it should work. 使用
UNDEFINED
可能不会给出正确的结果,而是使用删除文件的修订版本作为pegRevision,将startRevision设置为0,它应该可以工作。
You should specify a revision where the file existed as a peg revision. 您应该在文件作为钉修订存在的地方指定一个修订。 Obviously it is deletedRevision-1.
显然,它已删除。 And maybe (I'm not sure here, just try) the file should exist in both start and end revisions.
也许(我不确定在这里,只是尝试)该文件应该同时存在于开始和结束版本中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.