PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/atlassian/jgit-flow
Groovy | 31 lines | 24 code | 7 blank | 0 comment | 0 complexity | 6df54bb35cbcbe6f8289b3a2f37895d8 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","my-feature","feature/")
  9. Git localGit = gits.local;
  10. Git remoteGit = gits.remote;
  11. localGit.checkout().setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).setCreateBranch(true).setStartPoint("origin/feature/my-feature").setName("feature/my-feature").call()
  12. helper.comparePomFiles("expected-feature-pom.xml", "pom.xml")
  13. File junkFile = new File(localGit.getRepository().getWorkTree(), "junk.txt");
  14. FileUtils.writeStringToFile(junkFile, "I am junk");
  15. localGit.add().addFilepattern(junkFile.getName()).call();
  16. localGit.commit().setMessage("adding junk file").call();
  17. helper.clearOrigin(localGit)
  18. return true
  19. }
  20. catch (Exception e)
  21. {
  22. System.err.println(e.getMessage())
  23. return false;
  24. }