diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index 3757fffb466aab1aecf0d8f93487dde474a84017..6c1feeb655a39abe298ab34fd2bf43d93362eef9 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -1053,9 +1053,8 @@ public abstract class AbstractProject

,R extends A /** * Checks if there's any update in SCM, and returns true if any is found. * - *

- * The caller is responsible for coordinating the mutual exclusion between - * a build and polling, as both touches the workspace. + * @deprecated as of 1.346 + * Use {@link #poll(TaskListener)} instead. */ public boolean pollSCMChanges( TaskListener listener ) { return poll(listener).hasChanges(); @@ -1065,8 +1064,8 @@ public abstract class AbstractProject

,R extends A * Checks if there's any update in SCM, and returns true if any is found. * *

- * The caller is responsible for coordinating the mutual exclusion between - * a build and polling, as both touches the workspace. + * The implementation is responsible for ensuring mutual exclusion between polling and builds + * if necessary. * * @since 1.345 */ @@ -1123,7 +1122,7 @@ public abstract class AbstractProject

,R extends A return BUILD_NOW; } else { WorkspaceList l = lb.getBuiltOn().toComputer().getWorkspaceList(); - // if doing non-concurrent build, acquite a workspace in a way that causes builds to block for this workspace. + // if doing non-concurrent build, acquire a workspace in a way that causes builds to block for this workspace. // this prevents multiple workspaces of the same job --- the behavior of Hudson < 1.319. // // OTOH, if a concurrent build is chosen, the user is willing to create a multiple workspace, diff --git a/core/src/main/java/hudson/model/SCMedItem.java b/core/src/main/java/hudson/model/SCMedItem.java index c00c160fd36687aef49a7c3c50d7ea77480707a3..d5c9fc39691a8076da07aa5aba7d452e3b7c2b9a 100644 --- a/core/src/main/java/hudson/model/SCMedItem.java +++ b/core/src/main/java/hudson/model/SCMedItem.java @@ -23,6 +23,7 @@ */ package hudson.model; +import hudson.scm.PollingResult; import hudson.scm.SCM; import hudson.triggers.SCMTrigger; @@ -54,9 +55,21 @@ public interface SCMedItem extends BuildableItem { /** * Checks if there's any update in SCM, and returns true if any is found. * - *

- * The caller is responsible for coordinating the mutual exclusion between - * a build and polling, as both touches the workspace. + * @deprecated as of 1.346 + * Use {@link #poll(TaskListener)} instead. */ boolean pollSCMChanges( TaskListener listener ); + + /** + * Checks if there's any update in SCM, and returns true if any is found. + * + *

+ * The implementation is responsible for ensuring mutual exclusion between polling and builds + * if necessary. + * + * @return never null. + * + * @since 1.345 + */ + public PollingResult poll( TaskListener listener ); } diff --git a/core/src/main/java/hudson/triggers/SCMTrigger.java b/core/src/main/java/hudson/triggers/SCMTrigger.java index 9e740399f22c7f745e1a55c9c8050ff3223e09f0..710464ff7b2896b8e24421f0db3aac8903631db2 100644 --- a/core/src/main/java/hudson/triggers/SCMTrigger.java +++ b/core/src/main/java/hudson/triggers/SCMTrigger.java @@ -316,7 +316,7 @@ public class SCMTrigger extends Trigger { PrintStream logger = listener.getLogger(); long start = System.currentTimeMillis(); logger.println("Started on "+ DateFormat.getDateTimeInstance().format(new Date())); - boolean result = job.pollSCMChanges(listener); + boolean result = job.poll(listener).hasChanges(); logger.println("Done. Took "+ Util.getTimeSpanString(System.currentTimeMillis()-start)); if(result) logger.println("Changes found");