/jgitflow-maven-plugin/src/it/projects/release-finish-added-files/prebuild.groovy
https://bitbucket.org/atlassian/jgit-flow · Groovy · 25 lines · 21 code · 4 blank · 0 comment · 0 complexity · 6320947a0a1d32aec2e5b861fe985b41 MD5 · raw file
- import com.atlassian.maven.plugins.jgitflow.it.FinishScriptHelper
- import org.apache.commons.io.FileUtils
- import org.eclipse.jgit.api.CreateBranchCommand
- import org.eclipse.jgit.api.Git
- try
- {
- helper = new FinishScriptHelper(basedir, localRepositoryPath, context)
- FinishScriptHelper.Gits gits = helper.createAndCloneRepo("1.0","1.2-SNAPSHOT","1.1","release/")
- Git localGit = gits.local;
- localGit.checkout().setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).setCreateBranch(true).setStartPoint("origin/release/1.1").setName("release/1.1").call()
- File junkFile = new File(localGit.getRepository().getWorkTree(), "junk.txt");
- FileUtils.writeStringToFile(junkFile, "I am junk");
- localGit.add().addFilepattern(junkFile.getName()).call();
- localGit.commit().setMessage("adding junk file").call();
-
- return true
- }
- catch (Exception e)
- {
- System.err.println(e.getMessage())
- return false;
- }