From 7423d30e9e3599889597547295e1a8a659fb19d5 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Sun, 8 Jun 2014 23:48:47 -0400 Subject: [PATCH] [FIXED JENKINS-23365] Noting merge of #1257. --- changelog.html | 3 +++ core/src/main/java/hudson/model/Cause.java | 4 ++-- .../java/hudson/model/listeners/SCMListener.java | 6 +++++- .../main/java/hudson/scm/AbstractScmTagAction.java | 6 ++++++ .../main/java/hudson/scm/ChangeLogAnnotator.java | 1 + core/src/main/java/hudson/scm/ChangeLogParser.java | 3 +++ core/src/main/java/hudson/scm/ChangeLogSet.java | 10 ++++++++++ core/src/main/java/hudson/scm/SCM.java | 13 ++++++++++--- core/src/main/java/hudson/scm/SCMDescriptor.java | 2 +- core/src/main/java/hudson/triggers/SCMTrigger.java | 10 ++++++++++ .../main/java/jenkins/triggers/SCMTriggerItem.java | 3 +-- 11 files changed, 52 insertions(+), 9 deletions(-) diff --git a/changelog.html b/changelog.html index 5b3bb3bde1..a8f6ed04e2 100644 --- a/changelog.html +++ b/changelog.html @@ -61,6 +61,9 @@ Upcoming changes
  • Support the range notation for pagination in API (issue 23228) +
  • + API changes allowing new job types to use SCM plugins. + (issue 23365)
  • API changes allowing to create nested launchers (DecoratedLauncher) (issue 19454) diff --git a/core/src/main/java/hudson/model/Cause.java b/core/src/main/java/hudson/model/Cause.java index 0e2113247b..e07b4107c7 100644 --- a/core/src/main/java/hudson/model/Cause.java +++ b/core/src/main/java/hudson/model/Cause.java @@ -71,7 +71,7 @@ public abstract class Cause { /** * Called when the cause is registered. - * @since TODO + * @since 1.568 */ public void onAddedTo(@Nonnull Run build) { if (build instanceof AbstractBuild) { @@ -90,7 +90,7 @@ public abstract class Cause { * Called when a build is loaded from disk. * Useful in case the cause needs to keep a build reference; * this ought to be {@code transient}. - * @since TODO + * @since 1.568 */ public void onLoad(@Nonnull Run build) { if (build instanceof AbstractBuild) { diff --git a/core/src/main/java/hudson/model/listeners/SCMListener.java b/core/src/main/java/hudson/model/listeners/SCMListener.java index b2f56a8f41..e9c9713c04 100644 --- a/core/src/main/java/hudson/model/listeners/SCMListener.java +++ b/core/src/main/java/hudson/model/listeners/SCMListener.java @@ -63,7 +63,7 @@ public abstract class SCMListener implements ExtensionPoint { * Should be called immediately after {@link SCM#checkout(Run, Launcher, FilePath, TaskListener, File)} is called. * @param pollingBaseline information about what actually was checked out, if that is available, and this checkout is intended to be included in the build’s polling (if it does any at all) * @throws Exception if the checkout should be considered failed - * @since TODO + * @since 1.568 */ public void onCheckout(Run build, SCM scm, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState pollingBaseline) throws Exception {} @@ -106,6 +106,7 @@ public abstract class SCMListener implements ExtensionPoint { * @throws Exception * If any exception is thrown from this method, it will be recorded * and causes the build to fail. + * @since 1.568 */ public void onChangeLogParsed(Run build, SCM scm, TaskListener listener, ChangeLogSet changelog) throws Exception { if (build instanceof AbstractBuild && listener instanceof BuildListener && Util.isOverridden(SCMListener.class, getClass(), "onChangeLogParsed", AbstractBuild.class, BuildListener.class, ChangeLogSet.class)) { @@ -118,6 +119,9 @@ public abstract class SCMListener implements ExtensionPoint { onChangeLogParsed((Run) build, build.getProject().getScm(), listener, changelog); } + /** + * @since 1.568 + */ @SuppressWarnings("deprecation") public static Collection all() { Jenkins j = Jenkins.getInstance(); diff --git a/core/src/main/java/hudson/scm/AbstractScmTagAction.java b/core/src/main/java/hudson/scm/AbstractScmTagAction.java index 076824b436..c098427ac6 100644 --- a/core/src/main/java/hudson/scm/AbstractScmTagAction.java +++ b/core/src/main/java/hudson/scm/AbstractScmTagAction.java @@ -52,6 +52,9 @@ public abstract class AbstractScmTagAction extends TaskAction implements BuildBa @Deprecated protected transient /*final*/ AbstractBuild build; + /** + * @since 1.568 + */ protected AbstractScmTagAction(Run run) { this.run = run; this.build = run instanceof AbstractBuild ? (AbstractBuild) run : null; @@ -74,6 +77,9 @@ public abstract class AbstractScmTagAction extends TaskAction implements BuildBa return SCM.TAG; } + /** + * @since 1.568 + */ public Run getRun() { return run; } diff --git a/core/src/main/java/hudson/scm/ChangeLogAnnotator.java b/core/src/main/java/hudson/scm/ChangeLogAnnotator.java index 80a40d4b94..3a28a37977 100644 --- a/core/src/main/java/hudson/scm/ChangeLogAnnotator.java +++ b/core/src/main/java/hudson/scm/ChangeLogAnnotator.java @@ -76,6 +76,7 @@ public abstract class ChangeLogAnnotator implements ExtensionPoint { * are registered, the object may already contain some markups when this * method is invoked. Never null. {@link MarkupText#getText()} on this instance * will return the same string as {@link Entry#getMsgEscaped()}. + * @since 1.568 */ public void annotate(Run build, Entry change, MarkupText text) { if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogAnnotator.class, getClass(), "annotate", AbstractBuild.class, Entry.class, MarkupText.class)) { diff --git a/core/src/main/java/hudson/scm/ChangeLogParser.java b/core/src/main/java/hudson/scm/ChangeLogParser.java index 52c2fbeb38..32a61769ad 100644 --- a/core/src/main/java/hudson/scm/ChangeLogParser.java +++ b/core/src/main/java/hudson/scm/ChangeLogParser.java @@ -41,6 +41,9 @@ import org.xml.sax.SAXException; */ public abstract class ChangeLogParser { + /** + * @since 1.568 + */ public ChangeLogSet parse(Run build, RepositoryBrowser browser, File changelogFile) throws IOException, SAXException { if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogParser.class, getClass(), "parse", AbstractBuild.class, File.class)) { return parse((AbstractBuild) build, changelogFile); diff --git a/core/src/main/java/hudson/scm/ChangeLogSet.java b/core/src/main/java/hudson/scm/ChangeLogSet.java index d611941df2..472e1eaa94 100644 --- a/core/src/main/java/hudson/scm/ChangeLogSet.java +++ b/core/src/main/java/hudson/scm/ChangeLogSet.java @@ -62,6 +62,9 @@ public abstract class ChangeLogSet implements Iter public final AbstractBuild build; private final RepositoryBrowser browser; + /** + * @since 1.568 + */ protected ChangeLogSet(Run run, RepositoryBrowser browser) { this.run = run; build = run instanceof AbstractBuild ? (AbstractBuild) run : null; @@ -79,10 +82,16 @@ public abstract class ChangeLogSet implements Iter return build.getParent().getScm().getEffectiveBrowser(); } + /** + * @since 1.568 + */ public Run getRun() { return run; } + /** + * @since 1.568 + */ public RepositoryBrowser getBrowser() { return browser; } @@ -116,6 +125,7 @@ public abstract class ChangeLogSet implements Iter /** * Constant instance that represents no changes. + * @since 1.568 */ public static ChangeLogSet createEmpty(Run build) { return new EmptyChangeLogSet(build); diff --git a/core/src/main/java/hudson/scm/SCM.java b/core/src/main/java/hudson/scm/SCM.java index 28ac27b1ba..446df45a68 100644 --- a/core/src/main/java/hudson/scm/SCM.java +++ b/core/src/main/java/hudson/scm/SCM.java @@ -209,7 +209,7 @@ public abstract class SCM implements Describable, ExtensionPoint { * true if {@link SCM} is OK to let Hudson proceed with deleting the workspace. * False to veto the workspace deletion. * - * @since 1.246 + * @since 1.568 */ public boolean processWorkspaceBeforeDeletion(Job project, FilePath workspace, Node node) throws IOException, InterruptedException { if (project instanceof AbstractProject) { @@ -308,6 +308,7 @@ public abstract class SCM implements Describable, ExtensionPoint { * @throws InterruptedException * interruption is usually caused by the user aborting the computation. * this exception should be simply propagated all the way up. + * @since 1.568 */ public SCMRevisionState calcRevisionsFromBuild(Run build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { if (build instanceof AbstractBuild && Util.isOverridden(SCM.class, getClass(), "calcRevisionsFromBuild", AbstractBuild.class, Launcher.class, TaskListener.class)) { @@ -370,6 +371,7 @@ public abstract class SCM implements Describable, ExtensionPoint { * @throws InterruptedException * interruption is usually caused by the user aborting the computation. * this exception should be simply propagated all the way up. + * @since 1.568 */ public PollingResult compareRemoteRevisionWith(Job project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) throws IOException, InterruptedException { if (project instanceof AbstractProject && Util.isOverridden(SCM.class, getClass(), "compareRemoteRevisionWith", AbstractProject.class, Launcher.class, FilePath.class, TaskListener.class, SCMRevisionState.class)) { @@ -445,6 +447,7 @@ public abstract class SCM implements Describable, ExtensionPoint { * interruption is usually caused by the user aborting the build. * this exception will cause the build to be aborted. * @throws AbortException in case of a routine failure + * @since 1.568 */ public void checkout(Run build, Launcher launcher, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile) throws IOException, InterruptedException { if (build instanceof AbstractBuild && listener instanceof BuildListener && Util.isOverridden(SCM.class, getClass(), "checkout", AbstractBuild.class, Launcher.class, FilePath.class, BuildListener.class, File.class)) { @@ -475,7 +478,7 @@ public abstract class SCM implements Describable, ExtensionPoint { /** * Get a chance to do operations after the workspace i checked out and the changelog is written. - * @since 1.534, 1.532.1 + * @since 1.568 */ public void postCheckout(Run build, Launcher launcher, FilePath workspace, TaskListener listener) throws IOException, InterruptedException { if (build instanceof AbstractBuild && listener instanceof BuildListener) { @@ -653,6 +656,9 @@ public abstract class SCM implements Describable, ExtensionPoint { } } + /** + * @since 1.568 + */ protected final void createEmptyChangeLog(File changelogFile, TaskListener listener, String rootTag) throws IOException { FileWriter w = null; try { @@ -686,6 +692,7 @@ public abstract class SCM implements Describable, ExtensionPoint { /** * Returns the list of {@link SCMDescriptor}s that are applicable to the given project. + * @since 1.568 */ public static List> _for(final Job project) { if(project==null) return all(); @@ -715,7 +722,7 @@ public abstract class SCM implements Describable, ExtensionPoint { * Try to guess how a repository browser should be configured, based on URLs and the like. * Used when {@link #getBrowser} has not been explicitly configured. * @return a reasonable default value for {@link #getEffectiveBrowser}, or null - * @since TODO + * @since 1.568 */ public @CheckForNull RepositoryBrowser guessBrowser() { return null; diff --git a/core/src/main/java/hudson/scm/SCMDescriptor.java b/core/src/main/java/hudson/scm/SCMDescriptor.java index df5090c348..242ad88c6d 100644 --- a/core/src/main/java/hudson/scm/SCMDescriptor.java +++ b/core/src/main/java/hudson/scm/SCMDescriptor.java @@ -114,7 +114,7 @@ public abstract class SCMDescriptor extends Descriptor { * When this method returns false, this {@link SCM} will not appear in the configuration screen * for the given project. The default is true for {@link AbstractProject} but false for {@link Job}. * - * @since 1.294 + * @since 1.568 */ public boolean isApplicable(Job project) { if (project instanceof AbstractProject) { diff --git a/core/src/main/java/hudson/triggers/SCMTrigger.java b/core/src/main/java/hudson/triggers/SCMTrigger.java index 585aa142d0..e4b069f855 100644 --- a/core/src/main/java/hudson/triggers/SCMTrigger.java +++ b/core/src/main/java/hudson/triggers/SCMTrigger.java @@ -321,6 +321,9 @@ public class SCMTrigger extends Trigger { @Deprecated public transient /*final*/ AbstractBuild build; + /** + * @since 1.568 + */ public BuildAction(Run run) { this.run = run; build = run instanceof AbstractBuild ? (AbstractBuild) run : null; @@ -331,6 +334,9 @@ public class SCMTrigger extends Trigger { this((Run) build); } + /** + * @since 1.568 + */ public Run getRun() { return run; } @@ -399,6 +405,9 @@ public class SCMTrigger extends Trigger { return item instanceof AbstractProject ? ((AbstractProject) item) : null; } + /** + * @since 1.568 + */ public Item getItem() { return job().asItem(); } @@ -467,6 +476,7 @@ public class SCMTrigger extends Trigger { /** * For which {@link Item} are we polling? + * @since 1.568 */ public SCMTriggerItem getTarget() { return job(); diff --git a/core/src/main/java/jenkins/triggers/SCMTriggerItem.java b/core/src/main/java/jenkins/triggers/SCMTriggerItem.java index 287fe8c0ee..1c916edf52 100644 --- a/core/src/main/java/jenkins/triggers/SCMTriggerItem.java +++ b/core/src/main/java/jenkins/triggers/SCMTriggerItem.java @@ -43,7 +43,7 @@ import jenkins.model.ParameterizedJobMixIn; /** * The item type accepted by {@link SCMTrigger}. - * @since TODO + * @since 1.568 */ public interface SCMTriggerItem { @@ -86,7 +86,6 @@ public interface SCMTriggerItem { * See whether an item can be coerced to {@link SCMTriggerItem}. * @param item any item * @return itself, if a {@link SCMTriggerItem}, or an adapter, if an {@link hudson.model.SCMedItem}, else null - * @since TODO */ @SuppressWarnings("deprecation") public static @CheckForNull SCMTriggerItem asSCMTriggerItem(Item item) { -- GitLab