|
|
@@ -1,8 +1,13 @@ |
|
|
|
package hudson.plugins.git; |
|
|
|
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
|
|
|
import hudson.EnvVars; |
|
|
|
import hudson.FilePath; |
|
|
|
import hudson.matrix.Axis; |
|
|
|
import hudson.matrix.AxisList; |
|
|
|
import hudson.matrix.MatrixBuild; |
|
|
|
import hudson.matrix.MatrixProject; |
|
|
|
import hudson.model.*; |
|
|
|
import hudson.plugins.git.GitSCM.BuildChooserContextImpl; |
|
|
|
import hudson.plugins.git.browser.GitRepositoryBrowser; |
|
@@ -985,6 +990,51 @@ public void testMergeFailedWithSlave() throws Exception { |
|
|
|
assertFalse("scm polling should not detect any more changes after build", project.poll(listener).hasChanges()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testMergeWithMatrixBuild() throws Exception { |
|
|
|
|
|
|
|
MatrixProject project = createMatrixProject("xyz"); |
|
|
|
project.setAxes(new AxisList(new Axis("VAR","a","b"))); |
|
|
|
|
|
|
|
//FreeStyleProject project = setupSimpleProject("master"); |
|
|
|
//project.setAssignedLabel(createSlave().getSelfLabel()); |
|
|
|
|
|
|
|
GitSCM scm = new GitSCM( |
|
|
|
createRemoteRepositories(), |
|
|
|
Collections.singletonList(new BranchSpec("*")), |
|
|
|
false, Collections.<SubmoduleConfig>emptyList(), |
|
|
|
null, null, |
|
|
|
Collections.<GitSCMExtension>emptyList()); |
|
|
|
scm.getExtensions().add(new PreBuildMerge(new UserMergeOptions("origin", "integration", null))); |
|
|
|
project.setScm(scm); |
|
|
|
|
|
|
|
// create initial commit and then run the build against it: |
|
|
|
commit("commitFileBase", johnDoe, "Initial Commit"); |
|
|
|
testRepo.git.branch("integration"); |
|
|
|
build(project, Result.SUCCESS, "commitFileBase"); |
|
|
|
|
|
|
|
|
|
|
|
testRepo.git.checkout(null, "topic1"); |
|
|
|
final String commitFile1 = "commitFile1"; |
|
|
|
commit(commitFile1, johnDoe, "Commit number 1"); |
|
|
|
final MatrixBuild build1 = build(project, Result.SUCCESS, commitFile1); |
|
|
|
assertTrue(build1.getWorkspace().child(commitFile1).exists()); |
|
|
|
|
|
|
|
assertFalse("scm polling should not detect any more changes after build", project.poll(listener).hasChanges()); |
|
|
|
// do what the GitPublisher would do |
|
|
|
testRepo.git.deleteBranch("integration"); |
|
|
|
testRepo.git.checkout("topic1", "integration"); |
|
|
|
|
|
|
|
testRepo.git.checkout("master", "topic2"); |
|
|
|
final String commitFile2 = "commitFile2"; |
|
|
|
commit(commitFile2, johnDoe, "Commit number 2"); |
|
|
|
assertTrue("scm polling did not detect commit2 change", project.poll(listener).hasChanges()); |
|
|
|
final MatrixBuild build2 = build(project, Result.SUCCESS, commitFile2); |
|
|
|
assertTrue(build2.getWorkspace().child(commitFile2).exists()); |
|
|
|
assertBuildStatusSuccess(build2); |
|
|
|
assertFalse("scm polling should not detect any more changes after build", project.poll(listener).hasChanges()); |
|
|
|
} |
|
|
|
|
|
|
|
public void testEnvironmentVariableExpansion() throws Exception { |
|
|
|
FreeStyleProject project = createFreeStyleProject(); |
|
|
|
project.setScm(new GitSCM("${CAT}"+testRepo.gitDir.getPath())); |
|
|
0 comments on commit
5bdffc3