mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-08 05:10:20 +01:00
Merge with 2.0.0-m3
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user