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()); }