Merge with 2.0.0-m3

This commit is contained in:
René Pfeuffer
2018-09-10 09:24:45 +02:00
24 changed files with 519 additions and 106 deletions

View File

@@ -7,6 +7,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.Changeset;
import sonia.scm.repository.Person;
import sonia.scm.repository.Tag;
import sonia.scm.repository.client.api.ClientCommand;
import sonia.scm.repository.client.api.RepositoryClient;
import sonia.scm.repository.client.api.RepositoryClientFactory;
@@ -40,11 +41,11 @@ public class RepositoryUtil {
return name;
}
static void createAndCommitFile(RepositoryClient repositoryClient, String username, String fileName, String content) throws IOException {
static Changeset createAndCommitFile(RepositoryClient repositoryClient, String username, String fileName, String content) throws IOException {
File file = new File(repositoryClient.getWorkingCopy(), fileName);
Files.write(content, file, Charsets.UTF_8);
addWithParentDirectories(repositoryClient, file);
commit(repositoryClient, username, "added " + fileName);
return commit(repositoryClient, username, "added " + fileName);
}
private static String addWithParentDirectories(RepositoryClient repositoryClient, File file) throws IOException {
@@ -69,4 +70,16 @@ public class RepositoryUtil {
}
return changeset;
}
static Tag addTag(RepositoryClient repositoryClient, String revision, String tagName) throws IOException {
if (repositoryClient.isCommandSupported(ClientCommand.TAG)) {
Tag tag = repositoryClient.getTagCommand().setRevision(revision).tag(tagName, TestData.USER_SCM_ADMIN);
if (repositoryClient.isCommandSupported(ClientCommand.PUSH)) {
repositoryClient.getPushCommand().pushTags();
}
return tag;
}
return null;
}
}