10

チェックアウトが文書化されているwikiが見当たりません。理想的には、フォルダーだけでなく、ファイル「example/folder/file.xml」をチェックアウトしたいと思います...そして、アプリケーションが閉じたときなどに、このファイルへの変更をコミットできるようにします。どうすればいいですか?

4

3 に答える 3

20

SVNKit開発者として、SvnOperationFactoryに基づく新しいAPIを選択することをお勧めします。古いAPI(SVNClientManagerに基づく)は引き続き機能しますが、すべての新しいSVN機能は新しいAPIにのみ適用されます。

final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
try {
    final SvnCheckout checkout = svnOperationFactory.createCheckout();
    checkout.setSingleTarget(SvnTarget.fromFile(workingCopyDirectory));
    checkout.setSource(SvnTarget.fromURL(url));
    //... other options
    checkout.run();
} finally {
    svnOperationFactory.dispose();
}
于 2013-01-17T19:45:10.367 に答える
9

Subversion でファイルをチェックアウトすることはできません。フォルダをチェックアウトする必要があります。

1 つまたは複数のファイルを含むフォルダーをチェックアウトするには:

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);
于 2010-08-03T17:47:09.610 に答える