Add recursive deletion in modify command (#1821)

Adds a method in the ModifyCommand to delete not only files, but also directories recursively.
This commit is contained in:
René Pfeuffer
2021-10-07 14:40:48 +02:00
committed by GitHub
parent d1de7bf214
commit 41b8f091c0
9 changed files with 102 additions and 15 deletions

View File

@@ -77,7 +77,7 @@ public class SvnModifyCommandTest extends AbstractSvnCommandTestBase {
@Test
public void shouldRemoveFiles() {
ModifyCommandRequest request = new ModifyCommandRequest();
request.addRequest(new ModifyCommandRequest.DeleteFileRequest("a.txt"));
request.addRequest(new ModifyCommandRequest.DeleteFileRequest("a.txt", false));
request.setCommitMessage("this is great");
request.setAuthor(new Person("Arthur Dent", "dent@hitchhiker.com"));
@@ -87,6 +87,19 @@ public class SvnModifyCommandTest extends AbstractSvnCommandTestBase {
assertThat(new File(workingCopy.getWorkingRepository().getAbsolutePath() + "/c")).exists();
}
@Test
public void shouldRemoveDirectory() {
ModifyCommandRequest request = new ModifyCommandRequest();
request.addRequest(new ModifyCommandRequest.DeleteFileRequest("c", true));
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().getAbsolutePath() + "/a.txt")).exists();
assertThat(new File(workingCopy.getWorkingRepository().getAbsolutePath() + "/c")).doesNotExist();
}
@Test
public void shouldAddNewFile() throws IOException {
File testfile = temporaryFolder.newFile("Test123");