org.tmatesoft.svn.core.wc2.SvnCheckout Java Examples
The following examples show how to use
org.tmatesoft.svn.core.wc2.SvnCheckout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SvnWorkingCopyManager.java From scava with Eclipse Public License 2.0 | 6 votes |
public void checkoutBroken(File workingDirectory, VcsRepository repository, String revision) throws WorkingCopyCheckoutException { try { SvnUtil.setupLibrary(); final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); try { final SvnCheckout checkout = svnOperationFactory.createCheckout(); checkout.setSingleTarget(SvnTarget.fromFile(workingDirectory)); checkout.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(repository.getUrl()), SVNRevision.create(Long.parseLong(revision)))); checkout.run(); } finally { svnOperationFactory.dispose(); } } catch (NumberFormatException | SVNException e) { throw new WorkingCopyCheckoutException(repository, revision, e); } }
Example #2
Source File: SVNKitEnvironmentRepositoryIntegrationTests.java From spring-cloud-config with Apache License 2.0 | 6 votes |
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(); }
Example #3
Source File: StatusCmdTest.java From git-as-svn with GNU General Public License v2.0 | 6 votes |
@Test public void simple() throws Exception { try (SvnTestServer server = SvnTestServer.createMasterRepository()) { final SvnOperationFactory factory = server.createOperationFactory(); final SvnCheckout checkout = factory.createCheckout(); checkout.setSource(SvnTarget.fromURL(server.getUrl())); checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); checkout.setRevision(SVNRevision.create(1)); checkout.run(); final SvnGetStatus status = factory.createGetStatus(); status.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); status.setRevision(SVNRevision.create(2)); status.run(); } }
Example #4
Source File: SvnUpdateTest.java From git-as-svn with GNU General Public License v2.0 | 5 votes |
/** * Bug: svn up doesnt remove file #18 * <pre> * bozaro@landfill:/tmp/test/git-as-svn$ echo > test.txt * bozaro@landfill:/tmp/test/git-as-svn$ svn add test.txt * A test.txt * bozaro@landfill:/tmp/test/git-as-svn$ svn commit -m "Add new file" * Добавляю test.txt * Передаю данные . * Committed revision 58. * bozaro@landfill:/tmp/test/git-as-svn$ svn up -r 57 * Updating '.': * В редакции 57. * bozaro@landfill:/tmp/test/git-as-svn$ ls -l test.txt * -rw-rw-r-- 1 bozaro bozaro 1 авг. 15 00:50 test.txt * bozaro@landfill:/tmp/test/git-as-svn$ * </pre> */ @Test public void addAndUpdate() throws Exception { try (SvnTestServer server = SvnTestServer.createEmpty()) { final SvnOperationFactory factory = server.createOperationFactory(); final SVNClientManager client = SVNClientManager.newInstance(factory); // checkout final SvnCheckout checkout = factory.createCheckout(); checkout.setSource(SvnTarget.fromURL(server.getUrl())); checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); checkout.setRevision(SVNRevision.HEAD); final long revision = checkout.run(); // create file Path newFile = server.getTempDirectory().resolve("somefile.txt"); TestHelper.saveFile(newFile, "Bla Bla Bla"); // add file client.getWCClient().doAdd(newFile.toFile(), false, false, false, SVNDepth.INFINITY, false, true); // set eof property client.getWCClient().doSetProperty(newFile.toFile(), SVNProperty.EOL_STYLE, SVNPropertyValue.create(SVNProperty.EOL_STYLE_NATIVE), false, SVNDepth.INFINITY, null, null); // commit new file client.getCommitClient().doCommit(new File[]{newFile.toFile()}, false, "Add file commit", null, null, false, false, SVNDepth.INFINITY); // update for checkout revision client.getUpdateClient().doUpdate(server.getTempDirectory().toFile(), SVNRevision.create(revision), SVNDepth.INFINITY, false, false); // file must be remove Assert.assertFalse(Files.exists(newFile)); } }