/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

  1. import com.atlassian.maven.plugins.jgitflow.it.FinishScriptHelper
  2. import org.apache.commons.io.FileUtils
  3. import org.eclipse.jgit.api.CreateBranchCommand
  4. import org.eclipse.jgit.api.Git
  5. try
  6. {
  7. helper = new FinishScriptHelper(basedir, localRepositoryPath, context)
  8. FinishScriptHelper.Gits gits = helper.createAndCloneRepo("1.0","1.2-SNAPSHOT","1.1","release/")
  9. Git localGit = gits.local;
  10. localGit.checkout().setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).setCreateBranch(true).setStartPoint("origin/release/1.1").setName("release/1.1").call()
  11. File junkFile = new File(localGit.getRepository().getWorkTree(), "junk.txt");
  12. FileUtils.writeStringToFile(junkFile, "I am junk");
  13. localGit.add().addFilepattern(junkFile.getName()).call();
  14. localGit.commit().setMessage("adding junk file").call();
  15. return true
  16. }
  17. catch (Exception e)
  18. {
  19. System.err.println(e.getMessage())
  20. return false;
  21. }