/jgitflow-maven-plugin/src/it/projects/feature-finish-added-files/prebuild.groovy
Groovy | 27 lines | 22 code | 5 blank | 0 comment | 0 complexity | fd5744ff6e864b19830be1edef1ccf2a 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.1-SNAPSHOT","my-feature","feature/")
- Git localGit = gits.local;
- localGit.checkout().setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).setCreateBranch(true).setStartPoint("origin/feature/my-feature").setName("feature/my-feature").call()
- helper.comparePomFiles("expected-feature-pom.xml", "pom.xml")
-
- 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;
- }