Search in sources :

Example 1 with SvnCommit

use of org.tmatesoft.svn.core.wc2.SvnCommit in project spring-cloud-config by spring-cloud.

the class SVNKitEnvironmentRepositoryIntegrationTests method updateRepoForUpdate.

private void updateRepoForUpdate(String uri) throws SVNException, FileNotFoundException, IOException {
    SvnOperationFactory svnFactory = new SvnOperationFactory();
    final SvnCheckout checkout = svnFactory.createCheckout();
    checkout.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(uri)));
    checkout.setSingleTarget(SvnTarget.fromFile(this.workingDir));
    checkout.run();
    // update bar.properties
    File barProps = new File(this.workingDir, "trunk/bar.properties");
    StreamUtils.copy("foo: foo", Charset.defaultCharset(), new FileOutputStream(barProps));
    // commit to repo
    SvnCommit svnCommit = svnFactory.createCommit();
    svnCommit.setCommitMessage("update bar.properties");
    svnCommit.setSingleTarget(SvnTarget.fromFile(barProps));
    svnCommit.run();
}
Also used : FileOutputStream(java.io.FileOutputStream) SvnOperationFactory(org.tmatesoft.svn.core.wc2.SvnOperationFactory) SvnCheckout(org.tmatesoft.svn.core.wc2.SvnCheckout) File(java.io.File) SvnCommit(org.tmatesoft.svn.core.wc2.SvnCommit)

Example 2 with SvnCommit

use of org.tmatesoft.svn.core.wc2.SvnCommit in project GMM by Katharsas.

the class SVNTest method testCommitFile.

/**
 * Add a test file to working copy and commit it.
 */
public void testCommitFile() throws IOException, SVNException {
    // add file
    final String newFileName = "TestFile_" + DateTime.now().toString().replace(':', '-');
    final Path newFile = workingCopyPath.resolve(newFileName);
    Files.createFile(newFile);
    final SvnScheduleForAddition add = svnOperationFactory.createScheduleForAddition();
    add.setSingleTarget(SvnTarget.fromFile(newFile.toFile()));
    add.setAddParents(true);
    add.run();
    final SvnCommit commit = svnOperationFactory.createCommit();
    // only changes below this path will be commited
    commit.setSingleTarget(workingCopy);
    // TODO needed or default?
    commit.setDepth(SVNDepth.INFINITY);
    commit.setCommitMessage("Added file: " + newFileName);
    commit.run();
}
Also used : Path(java.nio.file.Path) SvnScheduleForAddition(org.tmatesoft.svn.core.wc2.SvnScheduleForAddition) SvnCommit(org.tmatesoft.svn.core.wc2.SvnCommit)

Example 3 with SvnCommit

use of org.tmatesoft.svn.core.wc2.SvnCommit in project GMM by Katharsas.

the class SvnPlugin method commit.

private void commit(String message) {
    final SvnCommit ops = svnOperationFactory.createCommit();
    // only changes below this path will be committed
    ops.setSingleTarget(workingCopy);
    // TODO needed or default?
    ops.setDepth(SVNDepth.INFINITY);
    ops.setCommitMessage(message);
    tryRun(ops);
}
Also used : SvnCommit(org.tmatesoft.svn.core.wc2.SvnCommit)

Aggregations

SvnCommit (org.tmatesoft.svn.core.wc2.SvnCommit)3 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 Path (java.nio.file.Path)1 SvnCheckout (org.tmatesoft.svn.core.wc2.SvnCheckout)1 SvnOperationFactory (org.tmatesoft.svn.core.wc2.SvnOperationFactory)1 SvnScheduleForAddition (org.tmatesoft.svn.core.wc2.SvnScheduleForAddition)1