/jgitflow-maven-plugin/src/it/projects/release-finish-added-files-no-origin/prebuild.groovy
Groovy | 29 lines | 23 code | 6 blank | 0 comment | 0 complexity | dccecfa1b0861d694d844344a16ff502 MD5 | raw file
Possible License(s): Apache-2.0
- 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;
- Git remoteGit = gits.remote;
-
- 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();
-
- helper.clearOrigin(localGit)
-
- return true
- }
- catch (Exception e)
- {
- System.err.println(e.getMessage())
- return false;
- }