/** * @deprecated as of 1.23 */ public SubversionSCM(List<ModuleLocation> locations, boolean useUpdate, boolean doRevert, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions) { this(locations, useUpdate ? (doRevert ? new UpdateWithRevertUpdater() : new UpdateUpdater()) : new CheckoutUpdater(), browser, excludedRegions, excludedUsers, excludedRevprop, excludedCommitMessages, includedRegions); }
/** * @deprecated as of 1.23 */ public SubversionSCM(List<ModuleLocation> locations, boolean useUpdate, boolean doRevert, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions) { this(locations, useUpdate?(doRevert?new UpdateWithRevertUpdater():new UpdateUpdater()):new CheckoutUpdater(), browser, excludedRegions, excludedUsers, excludedRevprop, excludedCommitMessages, includedRegions); }
/** * @deprecated as of 1.23 */ public SubversionSCM(List<ModuleLocation> locations, boolean useUpdate, boolean doRevert, SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, String includedRegions) { this(locations, useUpdate ? (doRevert ? new UpdateWithRevertUpdater() : new UpdateUpdater()) : new CheckoutUpdater(), browser, excludedRegions, excludedUsers, excludedRevprop, excludedCommitMessages, includedRegions); }
@Exported public WorkspaceUpdater getWorkspaceUpdater() { if (workspaceUpdater != null) { return workspaceUpdater; } // data must have been read from old configuration. if (useUpdate != null && !useUpdate.booleanValue()) { return new CheckoutUpdater(); } if (doRevert != null && doRevert.booleanValue()) { return new UpdateWithRevertUpdater(); } return new UpdateUpdater(); }
@Exported public WorkspaceUpdater getWorkspaceUpdater() { if (workspaceUpdater!=null) return workspaceUpdater; // data must have been read from old configuration. if (useUpdate!=null && !useUpdate) return new CheckoutUpdater(); if (doRevert!=null && doRevert) return new UpdateWithRevertUpdater(); return new UpdateUpdater(); }
@Exported public WorkspaceUpdater getWorkspaceUpdater() { if (workspaceUpdater != null) { return workspaceUpdater; } // data must have been read from old configuration. if (useUpdate != null && !useUpdate) { return new CheckoutUpdater(); } if (doRevert != null && doRevert) { return new UpdateWithRevertUpdater(); } return new UpdateUpdater(); }
@Override public List<External> perform() throws IOException, InterruptedException { if (!isUpdatable()) return delegateTo(new CheckoutUpdater()); return delegateTo(new CheckoutUpdater()); return delegateTo(new CheckoutUpdater());
return delegateTo(new CheckoutUpdater()); return delegateTo(new CheckoutUpdater()); return delegateTo(new CheckoutUpdater()); return delegateTo(new CheckoutUpdater()); listener.getLogger().println("Polled jobs are " + instance.getDescriptorByType(SCMTrigger.DescriptorImpl.class).getItemsBeingPolled()); return delegateTo(new CheckoutUpdater());
@Override public List<External> perform() throws IOException, InterruptedException { if (!isUpdatable()) return delegateTo(new CheckoutUpdater()); return delegateTo(new CheckoutUpdater());
@Override public List<External> perform() throws IOException, InterruptedException { if (!isSwitchable()) return delegateTo(new CheckoutUpdater()); return delegateTo(new CheckoutUpdater());
/** * Makes sure that quiet operation shows lesser output. */ @Issue("JENKINS-14541") @Test public void testQuietCheckout() throws Exception { SubversionSCM local = loadSvnRepo(); local.setWorkspaceUpdater(new CheckoutUpdater()); FreeStyleProject p = r.createFreeStyleProject("quietOperation"); p.setScm(local); local.setQuietOperation(true); FreeStyleBuild bQuiet = r.assertBuildStatusSuccess(p.scheduleBuild2(0, new Cause.UserIdCause()).get()); List<String> logsQuiet = bQuiet.getLog(LOG_LIMIT); // This line in log should end with --quiet assertTrue(logsQuiet.get(4).endsWith("--quiet")); assertEquals("At revision 1", logsQuiet.get(5)); local.setQuietOperation(false); FreeStyleBuild bVerbose = r.assertBuildStatusSuccess(p.scheduleBuild2(0, new Cause.UserIdCause()).get()); List<String> logsVerbose = bVerbose.getLog(LOG_LIMIT); // This line in log should NOT end with --quiet assertFalse(logsVerbose.get(4).endsWith("--quiet")); assertTrue(logsVerbose.get(5).endsWith("readme.txt")); assertEquals("At revision 1", logsVerbose.get(6)); }
@Test public void configRoundtrip() throws Exception { FreeStyleProject p = r.createFreeStyleProject(); SubversionSCM scm = new SubversionSCM( Arrays.asList( new ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/testSubversionExclusion", "c"), new ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/testSubversionExclusion", "d")), new UpdateUpdater(),new Sventon(new URL("http://www.sun.com/"),"test"),"exclude","user","revprop","excludeMessage",null); p.setScm(scm); r.submit(r.createWebClient().getPage(p,"configure").getFormByName("config")); verify(scm,(SubversionSCM)p.getScm()); scm = new SubversionSCM( Arrays.asList( new ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/testSubversionExclusion", "c")), new CheckoutUpdater(),null,"","","","",null); p.setScm(scm); r.submit(r.createWebClient().getPage(p,"configure").getFormByName("config")); verify(scm,(SubversionSCM)p.getScm()); }
/** * Test that multiple repository URLs are all polled. */ @Issue("JENKINS-3168") @Test public void pollMultipleRepositories() throws Exception { // fetch the current workspaces FreeStyleProject p = r.createFreeStyleProject(); String svnBase = "file://" + new CopyExisting(getClass().getResource("/svn-repo.zip")).allocate().toURI().toURL().getPath(); SubversionSCM scm = new SubversionSCM( Arrays.asList(new ModuleLocation(svnBase + "trunk", null), new ModuleLocation(svnBase + "branches", null)), new CheckoutUpdater(), null, null, null, null, null, null); p.setScm(scm); p.scheduleBuild2(0, new Cause.UserIdCause()).get(); // as a baseline, this shouldn't detect any change TaskListener listener = r.createTaskListener(); assertFalse(p.poll(listener).hasChanges()); createCommit(scm,"branches/foo"); assertTrue("any change in any of the repository should be detected",p.poll(listener).hasChanges()); assertFalse("no change since the last polling",p.poll(listener).hasChanges()); createCommit(scm,"trunk/foo"); assertTrue("another change in the repo should be detected separately",p.poll(listener).hasChanges()); }
@Issue("JENKINS-777") @Test public void ignoreExternals() throws Exception { Proc p = runSvnServe(getClass().getResource("JENKINS-777.zip")); try { FreeStyleProject b = r.createFreeStyleProject(); ModuleLocation[] locations = { new ModuleLocation("svn://localhost/jenkins-777/proja", "no_externals", "infinity", true), new ModuleLocation("svn://localhost/jenkins-777/proja", "with_externals", "infinity", false) }; b.setScm(new SubversionSCM(Arrays.asList(locations), new CheckoutUpdater(), null, null, null, null, null, null)); FreeStyleBuild build = r.assertBuildStatusSuccess(b.scheduleBuild2(0)); FilePath ws = build.getWorkspace(); // Check that the external exists assertTrue(ws.child("with_externals").child("externals").child("projb").exists()); // Check that the external doesn't exist assertTrue(!(ws.child("no_externals").child("externals").child("projb").exists())); } finally { p.kill(); } }
/** * Check out a pinned external and the same url unpinned. * See that we can poll afterward w/o getting confused. */ @Issue("JENKINS-6209") @Test public void pinnedExternals() throws Exception { Proc p = runSvnServe(getClass().getResource("JENKINS-6209.zip")); try { FreeStyleProject b = r.createFreeStyleProject(); ModuleLocation[] locations = { new ModuleLocation("svn://localhost/y", null), new ModuleLocation("svn://localhost/z", null) }; b.setScm(new SubversionSCM(Arrays.asList(locations), new CheckoutUpdater(), null, null, null, null, null, null)); FreeStyleBuild build = r.assertBuildStatusSuccess(b.scheduleBuild2(0)); FilePath ws = build.getWorkspace(); assertEquals(ws.child("z").child("a").readToString(),"za 2\n"); assertEquals(ws.child("y").child("z").child("a").readToString(),"za 1\n"); assertEquals(b.poll(StreamTaskListener.fromStdout()).change, PollingResult.Change.NONE); } finally { p.kill(); } }
@Issue("JENKINS-10942") @Test @Ignore("TODO use docker-fixtures for a reproducible test case") public void multiModuleEnvironmentVariablesWithRevision() throws Exception { FreeStyleProject p = r.createFreeStyleProject(); ModuleLocation[] locations = { new ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant@18075", null), new ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-maven@HEAD", null) }; p.setScm(new SubversionSCM(Arrays.asList(locations), new CheckoutUpdater(), null, null, null, null, null, null)); CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder(); p.getBuildersList().add(builder); r.assertBuildStatusSuccess(p.scheduleBuild2(0).get()); assertEquals("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant", builder.getEnvVars().get("SVN_URL_1")); assertEquals("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-maven", builder.getEnvVars().get("SVN_URL_2")); assertEquals(getActualRevision(p.getLastBuild(), "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant").toString(), builder.getEnvVars().get("SVN_REVISION_1")); assertEquals(getActualRevision(p.getLastBuild(), "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-maven").toString(), builder.getEnvVars().get("SVN_REVISION_2")); }
@Test @Ignore("TODO use docker-fixtures for a reproducible test case") public void multiModuleEnvironmentVariables() throws Exception { FreeStyleProject p = r.createFreeStyleProject(); ModuleLocation[] locations = { new ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant", null), new ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-maven", null) }; p.setScm(new SubversionSCM(Arrays.asList(locations), new CheckoutUpdater(), null, null, null, null, null, null)); CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder(); p.getBuildersList().add(builder); r.assertBuildStatusSuccess(p.scheduleBuild2(0).get()); assertEquals("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant", builder.getEnvVars().get("SVN_URL_1")); assertEquals("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-maven", builder.getEnvVars().get("SVN_URL_2")); assertEquals(getActualRevision(p.getLastBuild(), "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant").toString(), builder.getEnvVars().get("SVN_REVISION_1")); assertEquals(getActualRevision(p.getLastBuild(), "https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-maven").toString(), builder.getEnvVars().get("SVN_REVISION_2")); }
}; b.setScm(new SubversionSCM(Arrays.asList(locations), new CheckoutUpdater(), null, null, null, null, null, null));