private void updateMaterial(SvnMaterial svnMaterial, SubversionRevision revision, File workingCopy) { svnMaterial.updateTo(outputStreamConsumer, workingCopy, new RevisionContext(revision), new TestSubprocessExecutionContext()); }
private void updateMaterial(SvnMaterial material, SubversionRevision revision, File working, InMemoryStreamConsumer output2) { material.updateTo(output2, working, new RevisionContext(revision), new TestSubprocessExecutionContext()); }
@Test public void shouldNotDeleteWorkingDirIfSvnRepositoryUsesFileProtocol() throws IOException { Subversion subversion = mock(Subversion.class); when(subversion.getUserName()).thenReturn(""); when(subversion.getPassword()).thenReturn(""); when(subversion.isCheckExternals()).thenReturn(false); File workingCopy = createSvnWorkingCopy(true); when(subversion.workingRepositoryUrl(workingCopy)).thenReturn(workingCopy.getPath()); String url = "file://" + workingCopy.getPath(); when(subversion.getUrl()).thenReturn(new UrlArgument(url)); SvnMaterial svnMaterial = SvnMaterial.createSvnMaterialWithMock(subversion); svnMaterial.setUrl(url); svnMaterial.updateTo(outputStreamConsumer, workingCopy, new RevisionContext(revision), new TestSubprocessExecutionContext()); assertThat(workingCopy.exists(), is(true)); verify(subversion).updateTo(outputStreamConsumer, workingCopy, revision); } }
public void checkInOneFile(String fileName, SvnMaterial svnMaterial) throws Exception { final File baseDir = temporaryFolder.newFolder(); tmpFolders.add(baseDir); ProcessOutputStreamConsumer consumer = inMemoryConsumer(); Revision revision = latestRevision(svnMaterial, baseDir, new TestSubprocessExecutionContext()); svnMaterial.updateTo(consumer, baseDir, new RevisionContext(revision), new TestSubprocessExecutionContext()); File workingDir = new File(baseDir, svnMaterial.getFolder()); File newFileToAdd = new File(workingDir, fileName); newFileToAdd.getParentFile().mkdirs(); FileUtils.writeStringToFile(newFileToAdd, "", UTF_8); svnMaterial.add(consumer, newFileToAdd); svnMaterial.commit(consumer, workingDir, "adding file [" + svnMaterial.getFolder() + "/" + fileName + "]"); }
protected List<Modification> checkInOneFile(SvnMaterial svnMaterial, String filename, String message) throws IOException { final File workingCopy = temporaryFolder.newFolder(); tmpFolders.add(workingCopy); InMemoryStreamConsumer consumer = inMemoryConsumer(); Revision latestRevision = getLatestRevision(svnMaterial); svnMaterial.updateTo(consumer, workingCopy, new RevisionContext(latestRevision), new TestSubprocessExecutionContext()); File newFileToAdd = new File(workingCopy, filename); File directoryToAddTo = newFileToAdd.getParentFile(); boolean addedToExistingDir = directoryToAddTo.exists(); directoryToAddTo.mkdirs(); FileUtils.writeStringToFile(newFileToAdd, "", UTF_8); svnMaterial.add(consumer, addedToExistingDir ? newFileToAdd : directoryToAddTo); svnMaterial.commit(consumer, workingCopy, message); return svnMaterial.latestModification(workingCopy, new TestSubprocessExecutionContext()); }
@Test @RunIf(value = EnhancedOSChecker.class, arguments = {DO_NOT_RUN_ON, WINDOWS}) public void shouldRecogniseSvnAsTheSameIfURLContainsSpaces() throws Exception { File working = temporaryFolder.newFolder("shouldRecogniseSvnAsTheSameIfURLContainsSpaces"); SvnTestRepo repo = new SvnTestRepo(temporaryFolder, "a directory with spaces"); SvnMaterial material = repo.material(); assertThat(material.getUrl(), containsString("%20")); InMemoryStreamConsumer output = new InMemoryStreamConsumer(); material.freshCheckout(output, new SubversionRevision("3"), working); assertThat(output.getAllOutput(), containsString("Checked out revision 3")); InMemoryStreamConsumer output2 = new InMemoryStreamConsumer(); material.updateTo(output2, working, new RevisionContext(new SubversionRevision("4")), new TestSubprocessExecutionContext()); assertThat(output2.getAllOutput(), containsString("Updated to revision 4")); }