Add "production" branch command

There already was a branch command for test purposes. This was adapted
for production use with git and hg.
This commit is contained in:
René Pfeuffer
2019-03-26 09:16:33 +01:00
parent 39ae41327a
commit 3c7930d1a9
11 changed files with 371 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package sonia.scm.repository.spi;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import sonia.scm.repository.Branch;
import java.io.IOException;
import java.util.List;
public class GitBranchCommandTest extends AbstractGitCommandTestBase {
@Test
public void shouldCreateBranch() throws IOException {
GitContext context = createContext();
Assertions.assertThat(readBranches(context)).filteredOn(b -> b.getName().equals("new_branch")).isEmpty();
new GitBranchCommand(context, repository).branch("new_branch");
Assertions.assertThat(readBranches(context)).filteredOn(b -> b.getName().equals("new_branch")).isNotEmpty();
}
private List<Branch> readBranches(GitContext context) throws IOException {
return new GitBranchesCommand(context, repository).getBranches();
}
}