Polling for changes

From Eclipsepedia

Jump to: navigation, search

The following methods are relevant when Hudson is determining if there has been a change in the SCM:

  • public boolean supportsPolling()
  • public boolean requiresWorkspaceForPolling()
  • before Hudson 1.346: public boolean pollChanges(AbstractProject, Launcher, FilePath, TaskListener)
  • after Hudson 1.346: public PollingResult compareRemoteRevisionWith(AbstractProject, Launcher, FilePath, TaskListener, SCMRevisionState)
  • after Hudson 1.346: public SCMRevisionState calcRevisionsFromBuild(AbstractBuild, Launcher, TaskListener)



This methods determines if the SCM plugin can be used for polling. Default method returns true.


This method should return true if the SCM requires a workspace for polling. What to return depends on the SCM that the plugin is using. For instance the ClearCase plugin requires that a build has been performed before it can poll for changes, whereas Team Foundation Server does not require a workspace to poll for changes. Default method returns true.

pollChanges (<1.346)

This method does the actual polling and should return true or false if there are any changes in the repository. The polling should be as quick as possible and does not need to output any other result than a boolean.

To determine the date to get changes from, use the AbstractProject.getLastBuild().getTimestamp() to get a Calendar object.

compareRemoteRevisionWith (>=1.346)

This method does the actual polling and should return PollingResult.BUILD_NOW or PollingResult.SIGNIFICANT if there are any changes in the repository, or PollingResult.NO_CHANGES if repository is unchanged since the last build.

TODO: describe SCMRevisionState

calcRevisionsFromBuild (>=1.346)

Calculate the state of the workspace of the given build. The returned object is then fed into compareRemoteRevisionWith as the baseline SCMRevisionState to determine if the build is necessary, and is added to the build as an Action for later retrieval.