Permalink
Please sign in to comment.
Showing
with
103 additions
and 25 deletions.
- +0 −25 src/main/java/hudson/plugins/mercurial/build/Build.java
- +42 −0 src/main/java/hudson/plugins/mercurial/build/BuildChooser.java
- +9 −0 src/main/java/hudson/plugins/mercurial/build/BuildChooserDescriptor.java
- +26 −0 src/main/java/hudson/plugins/mercurial/build/BuildData.java
- +26 −0 src/main/java/hudson/plugins/mercurial/build/DefaultBuildChooser.java
- 0 src/main/resources/hudson/plugins/mercurial/MercurialSCM/help-buildChooser.html
@@ -1,25 +0,0 @@ | ||
-package hudson.plugins.mercurial.build; | ||
- | ||
-/** | ||
- * Capture the status of a Jenkins build vs a Mercurial commit ID | ||
- * @author <a href="mailto:nicolas.deloof@cloudbees.com">Nicolas De loof</a> | ||
- */ | ||
-public class Build { | ||
- | ||
- public int buildNumber; | ||
- | ||
- public String changesetID; | ||
- | ||
- public String branch; | ||
- | ||
- public Build(int buildNumber, String branch, String sha) { | ||
- this.buildNumber = buildNumber; | ||
- this.branch = branch; | ||
- this.changesetID = sha; | ||
- } | ||
- | ||
- @Override | ||
- public String toString() { | ||
- return "Build #" + buildNumber + " of " + changesetID + " on " + branch; | ||
- } | ||
-} |
@@ -0,0 +1,42 @@ | ||
+package hudson.plugins.mercurial.build; | ||
+ | ||
+import hudson.DescriptorExtensionList; | ||
+import hudson.ExtensionPoint; | ||
+import hudson.model.Describable; | ||
+import hudson.model.Hudson; | ||
+import hudson.plugins.mercurial.MercurialSCM; | ||
+ | ||
+import java.io.IOException; | ||
+import java.io.Serializable; | ||
+import java.util.Collection; | ||
+ | ||
+/** | ||
+ * Extension point to identify the revision (commit ID) to be built | ||
+ * | ||
+ * @author <a href="mailto:nicolas.deloof@cloudbees.com">Nicolas De loof</a> | ||
+ */ | ||
+public abstract class BuildChooser implements ExtensionPoint, Describable<BuildChooser>, Serializable { | ||
+ | ||
+ /** | ||
+ * Get a list of revisions (commit IDs or branch names) that are candidates to be built. | ||
+ * @param branchSpec the branch specification, may be a specific branch name or a pattern to monitor multiple branches | ||
+ * @return candidate revisions, may be an empty collection but not null | ||
+ */ | ||
+ public abstract Collection<String> getCandidateRevisions(String branchSpec) throws IOException; | ||
+ | ||
+ /** | ||
+ * Refers back to the {@link MercurialSCM} that owns this build chooser. | ||
+ */ | ||
+ public transient MercurialSCM scm; | ||
+ | ||
+ public BuildChooserDescriptor getDescriptor() { | ||
+ return (BuildChooserDescriptor)Hudson.getInstance().getDescriptorOrDie(getClass()); | ||
+ } | ||
+ | ||
+ public static DescriptorExtensionList<BuildChooser,BuildChooserDescriptor> all() { | ||
+ return Hudson.getInstance().<BuildChooser,BuildChooserDescriptor>getDescriptorList(BuildChooser.class); | ||
+ } | ||
+ | ||
+ private static final long serialVersionUID = 1L; | ||
+ | ||
+} |
@@ -0,0 +1,9 @@ | ||
+package hudson.plugins.mercurial.build; | ||
+ | ||
+import hudson.model.Descriptor; | ||
+ | ||
+/** | ||
+ * @author <a href="mailto:nicolas.deloof@cloudbees.com">Nicolas De loof</a> | ||
+ */ | ||
+public abstract class BuildChooserDescriptor extends Descriptor<BuildChooser> { | ||
+} |
@@ -0,0 +1,26 @@ | ||
+package hudson.plugins.mercurial.build; | ||
+ | ||
+import hudson.Extension; | ||
+ | ||
+import java.io.IOException; | ||
+import java.util.Collection; | ||
+ | ||
+/** | ||
+ * @author <a href="mailto:nicolas.deloof@cloudbees.com">Nicolas De loof</a> | ||
+ */ | ||
+public class DefaultBuildChooser extends BuildChooser { | ||
+ | ||
+ @Override | ||
+ public Collection<String> getCandidateRevisions(String branchSpec) throws IOException { | ||
+ | ||
+ return null; | ||
+ } | ||
+ | ||
+ @Extension | ||
+ public static final class DescriptorImpl extends BuildChooserDescriptor { | ||
+ @Override | ||
+ public String getDisplayName() { | ||
+ return "Default"; | ||
+ } | ||
+ } | ||
+} |
0 comments on commit
63e91a8