mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-10-31 10:35:56 +01:00 
			
		
		
		
	init svn repositories with README.md in trunk folder
This commit is contained in:
		| @@ -39,12 +39,13 @@ import sonia.scm.repository.work.WorkingCopy; | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
| import java.nio.file.Path; | ||||
| import java.nio.file.Paths; | ||||
|  | ||||
| public class SvnModifyCommand implements ModifyCommand { | ||||
|  | ||||
|   private SvnContext context; | ||||
|   private SvnWorkingCopyFactory workingCopyFactory; | ||||
|   private Repository repository; | ||||
|   private final SvnContext context; | ||||
|   private final SvnWorkingCopyFactory workingCopyFactory; | ||||
|   private final Repository repository; | ||||
|  | ||||
|   SvnModifyCommand(SvnContext context, SvnWorkingCopyFactory workingCopyFactory) { | ||||
|     this.context = context; | ||||
| @@ -57,6 +58,9 @@ public class SvnModifyCommand implements ModifyCommand { | ||||
|     SVNClientManager clientManager = SVNClientManager.newInstance(); | ||||
|     try (WorkingCopy<File, File> workingCopy = workingCopyFactory.createWorkingCopy(context, null)) { | ||||
|       File workingDirectory = workingCopy.getDirectory(); | ||||
|       if (request.isDefaultPath()) { | ||||
|         workingDirectory = Paths.get(workingDirectory.toString() + "/trunk").toFile(); | ||||
|       } | ||||
|       modifyWorkingDirectory(request, clientManager, workingDirectory); | ||||
|       return commitChanges(clientManager, workingDirectory, request.getCommitMessage()); | ||||
|     } | ||||
|   | ||||
| @@ -101,6 +101,22 @@ public class SvnModifyCommandTest extends AbstractSvnCommandTestBase { | ||||
|     assertThat(new File(workingCopy.getWorkingRepository(), "Test123")).exists(); | ||||
|   } | ||||
|  | ||||
|   @Test | ||||
|   public void shouldAddNewFileInDefaultPath() throws IOException { | ||||
|     File testfile = temporaryFolder.newFile("Test123"); | ||||
|  | ||||
|     ModifyCommandRequest request = new ModifyCommandRequest(); | ||||
|     request.setDefaultPath(true); | ||||
|     request.addRequest(new ModifyCommandRequest.CreateFileRequest("Test123", testfile, false)); | ||||
|     request.setCommitMessage("this is great"); | ||||
|     request.setAuthor(new Person("Arthur Dent", "dent@hitchhiker.com")); | ||||
|  | ||||
|     svnModifyCommand.execute(request); | ||||
|  | ||||
|     WorkingCopy<File, File> workingCopy = workingCopyFactory.createWorkingCopy(context, null); | ||||
|     assertThat(new File(workingCopy.getWorkingRepository(), "trunk/Test123")).exists(); | ||||
|   } | ||||
|  | ||||
|   @Test | ||||
|   public void shouldThrowFileAlreadyExistsException() throws IOException { | ||||
|     File testfile = temporaryFolder.newFile("a.txt"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user