PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/atlassian/jgit-flow
Groovy | 29 lines | 23 code | 6 blank | 0 comment | 0 complexity | 80c405c83f3887f6dc42c506c4639853 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.1-SNAPSHOT","1.0.1","hotfix/")
  9. Git localGit = gits.local;
  10. Git remoteGit = gits.remote;
  11. localGit.checkout().setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).setCreateBranch(true).setStartPoint("origin/hotfix/1.0.1").setName("hotfix/1.0.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. }