PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/atlassian/jgit-flow
Groovy | 27 lines | 22 code | 5 blank | 0 comment | 0 complexity | fd5744ff6e864b19830be1edef1ccf2a 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. localGit.checkout().setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).setCreateBranch(true).setStartPoint("origin/feature/my-feature").setName("feature/my-feature").call()
  11. helper.comparePomFiles("expected-feature-pom.xml", "pom.xml")
  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. return true
  17. }
  18. catch (Exception e)
  19. {
  20. System.err.println(e.getMessage())
  21. return false;
  22. }