使用SVNKit检出目录/文件


问题内容

我在Wiki上看不到记录有结帐的地方。理想情况下,我想检出文件“ example / folder /
file.xml”,不仅是文件夹…,然后在应用程序关闭或其他情况下,可以提交对该文件的更改。我该怎么做呢?


问题答案:

您不能在Subversion中检出文件。您必须检出一个文件夹。

要检出包含一个或多个文件的文件夹:

SVNClientManager ourClientManager = SVNClientManager.newInstance(null, 
            repository.getAuthenticationManager());
SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
updateClient.setIgnoreExternals(false);
updateClient.doCheckout(url, destPath, revision, revision,
            isRecursive);

提交先前签出的文件夹:

SVNClientManager ourClientManager = SVNClientManager.newInstance(null, 
            repository.getAuthenticationManager());
ourClientManager.getWCClient().doInfo(wcPath, SVNRevision.HEAD);
ourClientManager.getCommitClient().doCommit
        (new File[] { wcPath }, keepLocks, commitMessage, false, true);