diff --git a/pom.xml b/pom.xml
index 49e5f13..3bc33e0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,12 +29,12 @@
4.0.0
- org.jvnet.hudson.plugins
+ org.jenkins-ci.plugins
plugin
- 1.392
- ../pom.xml
+ 1.420
+ org.jvnet.hudson.plugins
URLSCM
hpi
1.7-SNAPSHOT
diff --git a/src/main/java/hudson/plugins/URLSCM/URLDateAction.java b/src/main/java/hudson/plugins/URLSCM/URLDateAction.java
index d2a8604..e54aea8 100644
--- a/src/main/java/hudson/plugins/URLSCM/URLDateAction.java
+++ b/src/main/java/hudson/plugins/URLSCM/URLDateAction.java
@@ -1,8 +1,7 @@
package hudson.plugins.URLSCM;
-import hudson.model.Action;
import hudson.model.AbstractBuild;
-import hudson.model.AbstractModelObject;
+import hudson.scm.SCMRevisionState;
import java.io.IOException;
import java.text.DateFormat;
@@ -15,21 +14,18 @@
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
-public class URLDateAction extends AbstractModelObject implements Action {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+public class URLDateAction extends SCMRevisionState {
+ private static final long serialVersionUID = 1L;
- private final HashMap lastModified = new HashMap();
+ private final HashMap lastModified = new HashMap();
- private final AbstractBuild build;
+ private final AbstractBuild, ?> build;
- protected URLDateAction(final AbstractBuild build) {
+ protected URLDateAction(final AbstractBuild, ?> build) {
this.build = build;
}
- public AbstractBuild getBuild() {
+ public AbstractBuild, ?> getBuild() {
return build;
}
@@ -60,10 +56,12 @@ public Map getUrlDates() {
return ret;
}
+ @Override
public String getDisplayName() {
return "URL Modification Dates";
}
+ @Override
public String getIconFileName() {
return "save.gif";
}
@@ -72,6 +70,7 @@ public String getSearchUrl() {
return getUrlName();
}
+ @Override
public String getUrlName() {
return "urlDates";
}
diff --git a/src/main/java/hudson/plugins/URLSCM/URLSCM.java b/src/main/java/hudson/plugins/URLSCM/URLSCM.java
index 2cc53e7..953f24e 100644
--- a/src/main/java/hudson/plugins/URLSCM/URLSCM.java
+++ b/src/main/java/hudson/plugins/URLSCM/URLSCM.java
@@ -9,7 +9,6 @@
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Hudson;
-import hudson.model.Run;
import hudson.scm.ChangeLogParser;
import hudson.scm.NullChangeLogParser;
import hudson.scm.PollingResult;
@@ -118,20 +117,26 @@ public boolean requiresWorkspaceForPolling() {
}
@Override
- public boolean pollChanges(final AbstractProject project,
- final Launcher launcher, final FilePath workspace,
- final TaskListener listener) throws IOException,
+ public SCMRevisionState calcRevisionsFromBuild(
+ final AbstractBuild, ?> project, final Launcher launcher,
+ final TaskListener listener) throws IOException, InterruptedException {
+ return null;
+ }
+
+ @Override
+ protected PollingResult compareRemoteRevisionWith(
+ final AbstractProject, ?> project, final Launcher launcher,
+ final FilePath workspace, final TaskListener listener,
+ final SCMRevisionState state) throws IOException,
InterruptedException {
boolean change = false;
- final Run lastBuild = project.getLastBuild();
- if (lastBuild == null) {
- return true;
- }
- final URLDateAction dates = lastBuild.getAction(URLDateAction.class);
- if (dates == null) {
- return true;
+
+ if (state == null || !(state instanceof URLDateAction)) {
+ listener.getLogger().println("Changes not yet tracked with last build, triggering a new one");
+ return PollingResult.BUILD_NOW;
}
+ final URLDateAction dates = (URLDateAction) state;
for (final URLTuple tuple : urls) {
final String urlString = tuple.getUrl();
try {
@@ -155,9 +160,9 @@ public boolean pollChanges(final AbstractProject project,
+ e.getMessage());
}
}
- return change;
+ return change ? PollingResult.BUILD_NOW : PollingResult.NO_CHANGES;
}
-
+
public static final class URLTuple {
private final String urlString;
@@ -225,19 +230,4 @@ protected FormValidation check() throws IOException,
}
}
- @Override
- public SCMRevisionState calcRevisionsFromBuild(
- final AbstractBuild, ?> arg0, final Launcher arg1,
- final TaskListener arg2) throws IOException, InterruptedException {
- return null;
- }
-
- @Override
- protected PollingResult compareRemoteRevisionWith(
- final AbstractProject, ?> arg0, final Launcher arg1,
- final FilePath arg2, final TaskListener arg3,
- final SCMRevisionState arg4) throws IOException,
- InterruptedException {
- return PollingResult.BUILD_NOW;
- }
}