PageRenderTime 53ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/jgitflow-maven-plugin/src/it/projects/release-finish-added-files-no-origin/prebuild.groovy

https://bitbucket.org/atlassian/jgit-flow
Groovy | 29 lines | 23 code | 6 blank | 0 comment | 0 complexity | dccecfa1b0861d694d844344a16ff502 MD5 | raw file
Possible License(s): Apache-2.0
  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. Git remoteGit = gits.remote;
  11. localGit.checkout().setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).setCreateBranch(true).setStartPoint("origin/release/1.1").setName("release/1.1").call()
  12. File junkFile = new File(localGit.getRepository().getWorkTree(), "junk.txt");
  13. FileUtils.writeStringToFile(junkFile, "I am junk");
  14. localGit.add().addFilepattern(junkFile.getName()).call();
  15. localGit.commit().setMessage("adding junk file").call();
  16. helper.clearOrigin(localGit)
  17. return true
  18. }
  19. catch (Exception e)
  20. {
  21. System.err.println(e.getMessage())
  22. return false;
  23. }